\begin{align*} \text{Let }\ u(x,y) &= \pi y^2e^x + y+\pi/2 \\ f(x,y) &= x-cos(u(x,y)) \end{align*}

Deduce the gradient and Hessian of $u(x,y)$

Deduce the gradient and Hessian of $f(0,0)$ at .

The $u(x)$ part is easy enough. I got gradient =

$$\nabla u= \left(\begin{matrix}\pi y^2e^x \\ 2\pi e^x y +1 \end{matrix}\right),\quad$$

Hessian : $$\left(\begin{matrix}\pi y^2e^x & 2\pi e^x y \\ 2\pi e^x y & 2\pi e^x \end{matrix}\right),\quad$$

...
So far so good, but here I'm not sure what the wisest option is.. I could probably find the derivatives of $x-\cos(\pi y^2e^x + y+\pi/2)$ using simple chain rule but I imagine the result will be a mess and the Hessian even worse. Is there a more clever way to do this?

• Chain rule generalizes to higher dimensions, see: en.wikipedia.org/wiki/… – tomasz Jun 17 '12 at 21:26
• There is a more clever way, but it won't help you to avoid messy computations. In fact size of your problem is not so big to use multidimensional chain rule. Just compute this. – Norbert Jun 17 '12 at 22:56

I would use the Taylor expansion $-\cos (t+\pi/2)=\sin t=t+O(t^3)$ as $t\to 0$, setting $t=\pi y^2e^x+y$. The term $O(t^3)$ does not figure in the gradient or the Hessian, which depend only on terms up to the 2nd order. So, the gradient and Hessian of $f$ at $(0,0)$ are the same as for the function $x+\pi y^2 e^x+y$. Is this clever enough?
If not, then expand $e^x=1+O(x)$ and notice that $y^2O(x)$ can be ignored (3rd order term). The function reduces to $x+\pi y^2+y$, with the gradient $\begin{pmatrix}1\\1\end{pmatrix}$ and the Hessian $\begin{pmatrix}0&0\\0&2\pi\end{pmatrix}$.