Change of variables chain rule In wikipedia's article regarding the "change of variables" method of solving PDEs, the following example is used:

$ \dfrac{\partial V}{\partial t} + \dfrac{1}{2} S^2\dfrac{\partial^2 V}{\partial S^2} + S\dfrac{\partial V}{\partial S} - V = 0.$
is reducible to the heat equation
$\dfrac{\partial u}{\partial \tau} = \dfrac{\partial^2 u}{\partial x^2}$
by the change of variables
  
  
*
  
*$V(S,t) = v(x(S),\tau(t))$
  
*$x(S) = \ln(S)$
  
*$\tau(t) = \dfrac{1}{2} (T - t)$
  
*$v(x,\tau)=\exp(-(1/2)x-(9/4)\tau) u(x,\tau)$
in these steps:
  
  
*
  
*Replace $V(S,t)$ by $v(x(S),\tau(t))$ and apply the chain rule to get
  
  
  $$\dfrac{1}{2}\left(-2v(x(S),\tau)+2 \dfrac{\partial\tau}{\partial t} \dfrac{\partial v}{\partial \tau} +S\left(\left(2 \dfrac{\partial x}{\partial S} + S\dfrac{\partial^2 x}{\partial S^2}\right) 
\dfrac{\partial v}{\partial x} + 
S \left(\dfrac{\partial x}{\partial S}\right)^2 \dfrac{\partial^2 v}{\partial x^2}\right)\right)=0.$$
  
  
*
  
*Replace $x(S)$ and $\tau(t)$ by $\ln(S)$ and $\dfrac{1}{2}(T-t)$ to get
  
  
  $$\dfrac{1}{2}\left(-2v(\ln(S),\dfrac{1}{2}(T-t))-\dfrac{\partial v(\ln(S),\dfrac{1}{2}(T-t))}{\partial\tau}+\dfrac{\partial v(\ln(S),\dfrac{1}{2}(T-t))}{\partial x} +\dfrac{\partial^2 v(\ln(S),\dfrac{1}{2}(T-t))}{\partial x^2}\right)=0.$$
  
  
*
  
*Replace $\ln(S)$ and $\dfrac{1}{2}(T-t)$ by $x(S)$ and $\tau(t)$ and divide both sides by $\dfrac{1}{2}$ to get
  
  
  $$-2 v-\dfrac{\partial v}{\partial\tau}+\dfrac{\partial v}{\partial x}+ \dfrac{\partial^2 v}{\partial x^2}=0.$$
  
  
*
  
*Replace $v(x,\tau)$ by $\exp(-(1/2)x-(9/4)\tau) u(x,\tau)$ and divide through by $-\exp(-(1/2)x-(9/4)\tau)  u(x,\tau)$ to yield the heat equation.
  

Now my question lies in the first step. I don't get how the $\dfrac{1}{2}S^2\dfrac{\partial ^2 V}{\partial S^2}$ and $S\dfrac{\partial V}{\partial S}$ terms are transformed in that first part. Can someone explain?
 A: First, multiply the Black-Scholes equation by $2$ to get
$$ 2\dfrac{\partial V}{\partial t} + S^2\dfrac{\partial^2 V}{\partial S^2} + 2S\dfrac{\partial V}{\partial S} - 2V = 0. $$
Using $V = \nu(x(S),\tau(t))$, write
\begin{align*}
\frac{\partial V}{\partial S}  &= \frac{\partial \nu}{\partial S} = \frac{\partial \nu}{\partial x}\frac{\partial x}{\partial S};\\
\frac{\partial^{2}V}{\partial S^{2}} &= \frac{\partial}{\partial S}\frac{\partial \nu}{\partial S} = \frac{\partial}{\partial S}\left( \frac{\partial \nu}{\partial x}\frac{\partial x}{\partial S}\right) = \frac{\partial}{\partial S}\frac{\partial \nu}{\partial x}\left(\frac{\partial x}{\partial S} \right) + \frac{\partial \nu}{\partial x}\frac{\partial^{2}x}{\partial S^{2}} = \frac{\partial^{2}\nu}{\partial x^{2}}\left(\frac{\partial x}{\partial S}\right)^{2} + \frac{\partial^{2}x}{\partial S^{2}}\frac{\partial \nu}{\partial x};\\
\frac{\partial V}{\partial t} &= \frac{\partial \nu}{\partial t} = \frac{\partial \nu}{\partial \tau}\frac{\partial \tau}{\partial t}.
\end{align*}
Sub this all in to get
$$2\frac{\partial \nu}{\partial \tau}\frac{\partial \tau}{\partial t} + S^{2}\left(\frac{\partial^{2}\nu}{\partial x^{2}}\left(\frac{\partial x}{\partial S}\right)^{2} + \frac{\partial^{2}x}{\partial S^{2}}\frac{\partial \nu}{\partial x} \right) +2S\frac{\partial \nu}{\partial x}\frac{\partial x}{\partial S} - 2\nu(x(S),\tau(t)) = 0.$$
Group in terms of $\frac{\partial \nu}{\partial x}$ and $\frac{\partial^{2} \nu}{\partial x^{2}}$ and divide by 2.
