Proving virial theorem my class is using Griffiths, and I've been assigned to prove the Virial theorem. Of course, there are innumerable resources devoted to working through solutions to his problems, and I use this gentleman's excellent work to check my answers and clarify things I don't understand: http://www.physicspages.com/2012/10/09/virial-theorem/
In this case, however, I'm not able to follow one of his steps and I wonder if I'm misunderstanding how to compute commutators.
I follow him up until step 4; step 5 simply doesn't seem to follow and I can't figure out what I'm doing wrong.
For step 5 I'm getting : $-\frac{\hbar^3}{2mi}\left[\frac{\partial ^2x}{\partial x^2}\frac{\partial}{\partial x} + x\frac{\partial ^3}{\partial x^3}\right]f + \frac{x\hbar}{i}\left[V\frac{\partial f}{\partial x} - \frac{\partial V}{\partial x} f \right] + \frac{\hbar^3}{2mi}x\frac{\partial ^3 f}{\partial x^3}$.
I feel like $\frac{\partial ^2x}{\partial x^2}\frac{\partial}{\partial x}= 0$ because the second derivative of x is zero, and then the other term in the brackets on the left should cancel with the last term. That only leaves the middle term; I don't think this is correct but I can't for life of me figure out what mistake I'm making.
P.S. I'm actually supposed to prove the 3D version, but I'm working through the 1D version first; I'm a little concerned that if I can't figure out the 1D version the 3D will be a nightmare; though it seems superficially like it ought to be a straightforward generalization.
 A: Note that 
\begin{eqnarray}
\frac{\partial^2}{\partial x^2}\left(x \frac{\partial f}{\partial x}\right) &=& \frac{\partial }{\partial x}\left[\frac{\partial }{\partial x} \left(x \frac{\partial f}{\partial x}\right)\right] =
 \frac{\partial }{\partial x}\left[x\frac{\partial^2f }{\partial x^2} + \frac{\partial f}{\partial x}\right] \\ &=& x \frac{\partial^3f }{\partial x^3} + \frac{\partial^2f }{\partial x^2} + \frac{\partial^2f }{\partial x^2} = x \frac{\partial^3f }{\partial x^3} + 2\frac{\partial^2f }{\partial x^2} \tag{1}
\end{eqnarray}
Now
\begin{eqnarray}
[H, xp]f &=& \left(-\frac{\hbar^2}{2m} \frac{\partial^2 }{\partial x^2} + V(x)\right)\left(x + \frac{\hbar}{i} \frac{\partial }{\partial x}\right)f - \left(x + \frac{\hbar}{i} \frac{\partial }{\partial x}\right)\left(-\frac{\hbar^2}{2m} \frac{\partial^2 }{\partial x^2} + V(x)\right)f \\
&=&-\frac{\hbar^3}{2mi}\frac{\partial^2 }{\partial x^2} \left(x \frac{\partial f}{\partial x}\right) + \frac{\hbar}{i}V(x)x\frac{\partial f}{\partial x} + \frac{\hbar^3}{2mi} x \frac{\partial^3f }{\partial x^3} - x\frac{\hbar}{i}\frac{\partial }{\partial x}\left(V(x)f \right) \\
&\stackrel{(1)}{=}& -\frac{\hbar^3}{2mi} \left(x \frac{\partial^3f }{\partial x^3} + 2\frac{\partial^2f }{\partial x^2} \right)  + \frac{\hbar}{i}V(x)x\frac{\partial f}{\partial x} + \frac{\hbar^3}{2mi} x \frac{\partial^3f }{\partial x^3} - x\frac{\hbar}{i}\left(\frac{\partial V}{\partial x}f + V\frac{\partial f}{\partial x} \right) \\
&=& -\frac{\hbar^3}{mi} \frac{\partial^2f }{\partial x^2} - \frac{\hbar}{i}x\frac{\partial V}{\partial x}f \tag{2}
\end{eqnarray}
We can then conclude that 
$$
\frac{i}{\hbar}[H, xp] = -\frac{\hbar^2}{m} \frac{\partial^2 }{\partial x^2} - x\frac{\partial V}{\partial x} = 2\frac{p^2}{2m} - x\frac{\partial V}{\partial x}  = 2 T - x\frac{\partial V}{\partial x}\tag{3}
$$
Using Ehrenfest Theorem we arrive to 
$$
\frac{d}{dt}\langle xp \rangle =2 \langle T \rangle - \left\langle x \frac{\partial V}{\partial x}\right\rangle
$$
