Let $F(t,k,k')=\exp{(-rt)}.U(w(t)+2k(t)-k'(t))$
We want to calculate the partial derivatives (second and third).
and this is what I found in a book :
$\frac{\partial F}{\partial k}=\frac{\partial (\exp{(-rt)}.U(w(t)+2k(t)-k'(t)))}{\partial k}=2\exp{(-rt)}.U'(w(t)+2k(t)-k'(t))$
But actually this is what I thought of :
$\frac{\partial F}{\partial k}=\exp{(-rt)}\frac{\partial U}{\partial t}\frac{\partial t}{\partial k}=\frac{2\exp{(-rt)}.U'(w(t)+2k(t)-k'(t))}{k'}$
And I don't know where's my mistake, probably I didn't use well the chain rule in this case.
Reasonable questions:
If $U:\Bbb R\longrightarrow\Bbb R$, we can define the composite function $$(t,p,q,r)\longmapsto\varphi(t,p,q,r) = \exp{(-rt)}U(p + 2q -r),$$ and you can ask by the partial derivatives of this function.
Now, using $w,k:\Bbb R\longrightarrow\Bbb R$ we can define another composite function $$t\longmapsto\varphi(t,w(t),k(t),k'(t)) = \exp{(-rt)}U(w(t) + 2k(t) - k'(t)).$$ The derivative (function of one variable!) of this function can be calculated using the chain rule and in the (rather big) expression it will appear the partial derivatives of $\varphi$ (function of several variables!).