I am working through the following example to refresh my memory on how to use the chain rule when changing variables: Change of variables (PDE)
\begin{equation} \begin{split} \frac{\partial{V}}{\partial{t}} + S\frac{\partial{V}}{\partial{S}} + \frac{1}{2}S^2\frac{\partial^2{V}}{\partial{S}^2} &= V \\ \end{split} \end{equation}
by setting:
$V(S,t) = v(x(S),\tau(t))$
$x(S) = \ln(S)$
$\tau(t) = \frac{1}{2}(T-t)$
$v(x,\tau) = e^{-\frac{1}{2}x - \frac{9}{4}\tau}u(x,\tau)$
Using these I managed to reach to the following stage:
\begin{equation} \begin{split} \frac{\partial{v}}{\partial{\tau}}\frac{\partial{\tau}}{\partial{t}} + S \frac{\partial{v}}{\partial{x}}\frac{\partial{x}}{\partial{S}}-v + \mbox{the second order term} = 0 \end{split} \end{equation}
I am unable to follow how to get $\frac{1}{2}S^2\frac{\partial^2{V}}{\partial{S}^2}$ in to the following form: $\frac{1}{2}S^2\left( \frac{\partial^2{x}}{\partial{S^2}}\frac{\partial{v}}{\partial{x}}+ \left(\frac{\partial{x}}{\partial{S}}\right)^2\frac{\partial^2{v}}{\partial{x^2}} \right)$
Could someone please explain how to get the second order term into that form?