Q: How is it possible to pull out derivatives of a wavefunction? In an early derivation, the following equation was stated:
$$\frac\partial{\partial t}\lvert\psi\rvert^2 = \frac{i\hbar}{2m}\biggl(\psi^*\frac{\partial^2\psi}{\partial x^2} - \frac{\partial^2\psi^*}{\partial x^2}\psi\biggr) = \frac\partial{\partial x}\biggl[\frac{i\hbar}{2m}\biggl(\psi^*\frac{\partial\psi}{\partial x} - \frac{\partial \psi^*}{\partial x}\psi\biggr)\biggr].$$
It appears as if the $\frac\partial{\partial x}$ was "taken out" from the expression. Is that valid? If so, why can't it be done a second time, i.e.
$$\frac\partial{\partial x}\biggl[\frac{i\hbar}{2m}\biggl(\psi^*\frac{\partial\psi}{\partial x} - \frac{\partial \psi^*}{\partial x}\psi\biggr)\biggr] = \frac{\partial^2}{\partial x^2}\biggl[\frac{i\hbar}{2m}(\psi^*\psi - \psi^*\psi)\biggr] = 0.$$
If this is also valid, wouldn't the original be $\frac\partial{\partial t}\lvert\psi\rvert^2 = 0$?

A: He's using the following:
$$
\begin{eqnarray}
\frac{\partial}{\partial x} \left(f \frac{\partial g}{\partial x} - g \frac{\partial f}{\partial x}\right) &=& \frac{\partial f}{\partial x} \frac{\partial g}{\partial x} + f\frac{\partial^2 g}{\partial x^2} - \frac{\partial g}{\partial x} \frac{\partial f}{\partial x} - g\frac{\partial^2 f}{\partial x^2} \\
&=& f\frac{\partial^2 g}{\partial x^2} - g\frac{\partial^2 f}{\partial x^2}
\end{eqnarray}
$$
