When i have the function $r=\sqrt{x^2+y^2+z^2}$ and I want to take it's second derivative with respect to x, I have $r_x=\frac{x}{r}$, and if I try to apply chain rule $\frac{d}{dx}r_x=(r_x)_r \cdot r_x+r_{xx}$ because of total derivative. Refering to the last term $r_{xx}$, if I calculate it with r as constant w.r.t. x, it gives the correct answer $\frac{1}{r}$, but for that I should ignore the dependency of r as function of x. How I am allowed to go over this and just ignore I am back at the same problem again?
Thanks in advance.
$$r^2=x^2+y^2+z^2 $$
Taking the partial with respect ot $x$ of $r^2$ gives
\begin{eqnarray} 2r\frac{\partial r}{\partial x}&=&2x\\ r\frac{\partial r}{\partial x}&=&x\label{1}\tag{1}\\ \frac{\partial r}{\partial x}&=&\frac{x}{r}\label{2}\tag{2}\\ \end{eqnarray}
Taking the partial with respect to $x$ of equation \eqref{1} gives
\begin{eqnarray} \left(\frac{\partial r}{\partial x}\right)^2+r\frac{\partial^2r}{\partial x^2}&=&1\\ \left(\frac{x}{r}\right)^2+r\frac{\partial^2r}{\partial x^2}&=&1\\ \frac{\partial^2r}{\partial x^2}&=&\frac{r^2-x^2}{r^3}\\ \frac{\partial^2r}{\partial x^2}&=&\frac{y^2+z^2}{r^3} \end{eqnarray}