gradient and hessian calculation of a complex function 
Hey guys, I have calculated gradient and Hessian of following function as below: $f(x_1,x_2)$ = $(x_1-2x_2)^2 e^{x_1+x_2} $

$\nabla_x f (x_1,x_2) = [(e^{x_1+x_2} (x_1-2x_2)^2 + 2 (x_1-2x_2) e^{x_1+x_2}, -4e^{x_1+x_2}(x_1-2x_2) + e^{x_1+x_2}(x_1-2x_2)^2]$
$\nabla_x^2 f (x_1,x_2) =\begin{bmatrix} e^{x_1+x_2}(x_1^2+4x_1-4x_1x_2+4x_2^2-8x_2 & e^{x_1+x_2} x_1^2-4x_1x_2-2x_1+4x_2^2+4x_2-4 \\ e^{x_1+x_2} x_1^2-4x_1x_2-2x_1+4x_2^2+4x_2-4 & e^{x_1+x_2} (x_1^2-4x_1x_2-8x_1+4x_2^2+16x_2^2+16x_2+8
\end{bmatrix}$
Are my calculations correct? Could you please help me about it? Also, could you please inform me about the writing Taylor Series Expansion with $x^0 = (1, −1)^T$?
 A: Define the variables
$$\eqalign{
&x=\pmatrix{x_1\\x_2},
\quad &a=\pmatrix{\;1\\-2},
\quad b=\pmatrix{1\\1},
\quad A=aa^T \\
&\alpha = x^TAx,\quad &d\alpha = 2x^TA\,dx \\
&\beta = e^{b^Tx},\quad &d\beta = \beta b^Tdx
}$$
Write the function in terms of these new variables.
Then calculate its differential and gradient.
$$\eqalign{
 f &= \alpha \beta \\
df
 &= \beta\,d\alpha + \alpha\,d\beta \\
 &= \big(2\beta\,Ax + \alpha\beta\;b\big)^Tdx \\
g=\frac{\partial f}{\partial x}
 &= 2\beta\,Ax + \alpha\beta\;b \\
}$$
Then calculate the differential and gradient of $g,\,$ i.e. the hessian.
$$\eqalign{
dg
 &= 2\,d\beta\,Ax + 2\beta\,A\,dx + \beta b\,d\alpha+ \alpha b\,d\beta \\
 &= 2\beta\,Axb^Tdx + 2\beta\,A\,dx + 2\beta bx^TA\,dx + \alpha\beta bb^Tdx \\
 &= \big(2\beta\,Axb^T + 2\beta\,A + 2\beta bx^TA + \alpha\beta bb^T\big)\,dx \\
H=\frac{\partial g}{\partial x}
 &= 2\beta\,Axb^T + 2\beta\,A + 2\beta bx^TA + \alpha\beta bb^T \\
}$$
The second order Taylor expansion $\big(\,\|r\|\ll 1\,\big)$ is just
$$\eqalign{
f(x+r) &= f(x) + g^Tr + \tfrac{1}{2}\,r^THr
}$$
