# Taylor expansion of second order

I have to find the Taylor expansion of second order of the following functions with center the given point $(x_0, y_0)$.

1. $f(x, y)=(x+y)^2, x_0=0, y_0=0$
2. $f(x, y)=e^{-x^2-y^2}\cos (xy), x_0=0, y_0=0$

I have done the following:

The Taylor expansion of second order of $f: \mathbb{R}^n \rightarrow \mathbb{R}$ is:

$$f(\overrightarrow{x_0}+\overrightarrow{h})=f(\overrightarrow{x_0})+\sum_{i=1}^{n}h_i \frac{\partial{f}}{\partial{x_i}}(\overrightarrow{x_0})+\frac{1}{2}\sum_{i,j=1}^{n}h_ih_j\frac{\partial^2{f}}{\partial{x_i}\partial{x_j}}(\overrightarrow{x_0})+R_2(\overrightarrow{h}, \overrightarrow{x_0})$$

where $\frac{R_2(\overrightarrow{h}, \overrightarrow{x_0})}{||\overrightarrow{h}||^2} \rightarrow 0$ when $\overrightarrow{h} \rightarrow \overrightarrow{0}$.

1. $$f((x_0, y_0)+(h_1, h_2))=f(x_0, y_0)+h_1\frac{\partial{f}}{\partial{x}}(x_0, y_0)+h_2\frac{\partial{f}}{\partial{y}}(x_0, y_0)+\frac{1}{2}h_1^2\frac{\partial^2{f}}{\partial{x^2}}(x_0, y_0)+\frac{1}{2}h_1 h_2 \frac{\partial^2{f}}{\partial{x}\partial{y}}(x_0, y_0)+\frac{1}{2}h_2h_1\frac{\partial^2{f}}{\partial{y}\partial{x}}(x_0, y_0)+\frac{1}{2}h_2^2\frac{\partial^2{f}}{\partial{y^2}}(x_0, y_0)+R_2(\overline{h}, (x_0, y_0))$$

We have:

$$f(0, 0)=0 \\ \frac{\partial{f}}{\partial{x}}=2(x+y) \Rightarrow \frac{\partial{f}}{\partial{x}}(0,0)=0 \\ \frac{\partial{f}}{\partial{y}}=2(x+y) \Rightarrow \frac{\partial{f}}{\partial{y}}(0,0)=0 \\ \frac{\partial^2{f}}{\partial{x^2}}=2 \Rightarrow \frac{\partial^2{f}}{\partial{x^2}}(0,0)=2 \\ \frac{\partial^2{f}}{\partial{y^2}}=2 \Rightarrow \frac{\partial^2{f}}{\partial{y^2}}(0,0)=2 \\ \frac{\partial^2{f}}{\partial{x}\partial{y}}=2 \Rightarrow \frac{\partial^2{f}}{\partial{x}\partial{y}}(0,0)=2$$

So $$f(h_1, h_2)=\frac{1}{2}h_1^22+h_1h_22+\frac{1}{2}h_2^22+R_2(\overrightarrow{h}, \overrightarrow{0})=h_1^2+2h_1h_2+h_2^2+R_2(\overrightarrow{h}, \overrightarrow{0})=(h_1+h_2)^2+R_2(\overrightarrow{h}, \overrightarrow{0})$$ Since $f(h_1, h_2)=f(h_1, h_2)+R_2(\overrightarrow{h}, \overrightarrow{0})$

so $R_2(\overrightarrow{h}, \overrightarrow{0})=0$

2. $$f((x_0, y_0)+(h_1, h_2))=f(x_0, y_0)+h_1\frac{\partial{f}}{\partial{x}}(x_0, y_0)+h_2\frac{\partial{f}}{\partial{y}}(x_0, y_0)+\frac{1}{2}h_1^2\frac{\partial^2{f}}{\partial{x^2}}(x_0, y_0)+\frac{1}{2}h_1 h_2 \frac{\partial^2{f}}{\partial{x}\partial{y}}(x_0, y_0)+\frac{1}{2}h_2h_1\frac{\partial^2{f}}{\partial{y}\partial{x}}(x_0, y_0)+\frac{1}{2}h_2^2\frac{\partial^2{f}}{\partial{y^2}}(x_0, y_0)+R_2(\overrightarrow{h}, (x_0, y_0))$$

We have:

$$f(0,0)=1 \\ \frac{\partial{f}}{\partial{x}}=e^{-x^2-y^2}(-2x\cos (xy)-y\sin (xy)) \Rightarrow \frac{\partial{f}}{\partial{x}}(0,0)=0 \\ \frac{\partial{f}}{\partial{y}}=e^{-x^2-y^2}(-2y\cos (xy)-x\sin (xy)) \Rightarrow \frac{\partial{f}}{\partial{y}}(0,0)=0 \\ \frac{\partial^2{f}}{\partial{x^2}}=e^{-x^2-y^2}((4x^2-y^2-2)\cos (xy)+4xy\sin (xy)) \Rightarrow \frac{\partial^2{f}}{\partial{x^2}}(0,0)=-2 \\ \frac{\partial^2{f}}{\partial{y^2}}=e^{-x^2-y^2}((-4y^2-xy-2)\cos (xy)+4 xy \sin (xy)) \Rightarrow \frac{\partial^2{f}}{\partial{y^2}}(0,0)=-2 \\ \frac{\partial^2{f}}{\partial{x}\partial{y}}=e^{-x^2-y^2}(3xy \cos(xy)+(2y^2+2xy-1)\sin (xy)) \Rightarrow \frac{\partial^2{f}}{\partial{x}\partial{y}}(0,0)=0$$

So $$f(h_1, h_2)=1+\frac{1}{2}h_1^2(-2)+\frac{1}{2}h_2^2(-2)+R_2(\overrightarrow{h}, \overrightarrow{0})=1-h_1^2-h_2^2+R_2(\overrightarrow{h}, \overrightarrow{0})$$ where $\frac{R_2(\overrightarrow{h}, \overrightarrow{0})}{||\overrightarrow{h}||^2} \rightarrow 0$ when $\overrightarrow{h} \rightarrow \overrightarrow{0}$.

Is this correct?? Could I improve something at the formulation??

i will take the second question first. we will need the following two expansions: $$e^x = 1 + x + \frac12x^2 + \cdots, \cos x = 1 - \frac 12x^2 + \cdots\tag 1$$
now \begin{align}e^{-(x^2+y^2)}\cos(xy) &= \left(1 - (x^2+y^2) + \cdots\right)\left(1 - \frac12 x^2y^2 + \cdots\right)\\ &=\left(1 - x^2-y^2) + \cdots\right)\left(1 - \frac12 x^2y^2 + \cdots\right)\\ &= 1 - x^2 - y^2+\cdots\end{align}