Given
$f= \rho u^2$
$W_1 = \begin{pmatrix} \rho\\ \rho u\\ \end{pmatrix} $ , $W_{1p} = \begin{pmatrix} \rho\\ u\\ \end{pmatrix} $
I want to find the Hessian of $f$ with respect to $W_1$. The actual Hessian is easily found by taking one derivative after another. However, I would like to use the product rule and chain rule to avoid the following.
$\dfrac{\partial W_1}{\partial W_{1p}} = \begin{bmatrix} 1 & 0 \\ u & \rho \\ \end{bmatrix} $ , $\dfrac{\partial W_{1p}}{\partial W_{1}} = \left(\dfrac{\partial W_1}{\partial W_{1p}}\right)^{-1} = \begin{bmatrix} 1 & 0 \\ -u/\rho & 1/\rho \\ \end{bmatrix} $
$\dfrac{\partial f}{\partial W_{1}} =\dfrac{\partial f}{\partial W_{1p}}\dfrac{\partial W_{1p}}{\partial W_{1}} =\begin{bmatrix} u^2 & 2 \rho u \\ \end{bmatrix} \begin{bmatrix} 1 & 0 \\ -u/\rho & 1/\rho \\ \end{bmatrix} = \begin{bmatrix} -u^2 & 2u \\ \end{bmatrix} $
So far, so good, the first derivative is easily achieved. Now repeat.
$\dfrac{\partial^2 f}{\partial W_{1}^2} =\dfrac{\partial}{\partial W_{1}} \left( \dfrac{\partial f}{\partial W_{1p}}\dfrac{\partial W_{1p}}{\partial W_{1}} \right) =\dfrac{\partial\left( \begin{bmatrix} -u^2 & 2u \\ \end{bmatrix} \right)}{\partial W_{1}} =\dfrac { \partial\left( \begin{bmatrix} -u^2 & 2u \\ \end{bmatrix} \right) } {\partial W_{1p}} \dfrac{\partial W_{1p}}{\partial W_{1}}$
$ \dfrac{\partial^2 f}{\partial W_{1}^2}= \begin{bmatrix} 0 & -2u \\ 0 & 2 \\ \end{bmatrix} \begin{bmatrix} 1 & 0 \\ -u/\rho & 1/\rho \\ \end{bmatrix} = \begin{bmatrix} \dfrac{2u^2}{\rho} & -\dfrac{2u}{\rho} \\ -\dfrac{2u}{\rho} & \dfrac{2}{\rho} \\ \end{bmatrix} $
Here is my real issue. My equations are in fact much more complicated and the first derivative $\left( \dfrac{\partial f}{\partial W_{1p}}\dfrac{\partial W_{1p}}{\partial W_{1}} \right)$ is insanely long. Each term by itself is relatively manageable so I would like to use the product rule in this way:
$\dfrac{\partial}{\partial W_{1p}} \left( \dfrac{\partial f}{\partial W_{1p}}\dfrac{\partial W_{1p}}{\partial W_{1}} \right) \dfrac{\partial W_{1p}}{\partial W_{1}} = \left( \dfrac{\partial^2 f}{\partial W_{1p}^2} \dfrac{\partial W_{1p}}{\partial W_{1}} + \dfrac{\partial f}{\partial W_{1p}} \left( \dfrac{\partial}{\partial W_{1p}} \left( \dfrac{\partial W_{1p}}{\partial W_{1}} \right) \right) \right) \dfrac{\partial W_{1p}}{\partial W_{1}} $
Of course the above does not work (or I wouldn't be posting here).
Why am I not allowed to use the product rule?
If I am allowed, how could I do it properly?