Chain rule for a function of a multivariable function I've got confused in something which should not be too confusing. But...
If we have some function  $f(r)$, where $r=\sqrt{x^2+y^2+z^2}$, then what is $f'(r) = \frac{df}{dr}$?
I thought it would be this: $\frac{df}{dr} = \frac{∂r}{∂x} + \frac{∂r}{∂x} + \frac{∂r}{∂x}$, but something is not right here. What is confusing me so much is the absense of the part differentiating the variable $r$ itself.
Say, if I had $f(r) = r^2$, I would say $f'(r) = 2r(\frac{∂r}{∂x} + \frac{∂r}{∂x} + \frac{∂r}{∂x})$. But $2r$ is $\frac{df}{dr}$... Please help :)
 A: Think of $r$ as a function of three variables:
$$r(x,y,z)=\sqrt{x^2+y^2+z^2}$$
$r$ is therefore a function from $\mathbb{R}^3$ to $[0,\infty)$.
Now you have a function $f$ defined on $[0,\infty)$, whose range is $\mathbb{R}$, say, and you are looking at the composition $f\circ r$. This function starts in $\mathbb{R}^3$, and ends up in the range of $f$. By a common abuse of notation, you choose to denote this function by $f(r)$, but what it really means is the composition $f\circ r$. If you are going to differentiate it as a function from $\mathbb{R}^3$ to $\mathbb{R}$, you will be relying on the chain rule, which tells you that:
$${\partial (f\circ r)\over\partial x}(x_0,y_0,z_0)=f'(r(x_0,y_0,z_0))\cdot {\partial r\over \partial x}(x_0,y_0,z_0)$$
and by further abuse of notation, this is often denoted as 
$${df\over dr}{\partial r\over \partial x}\enspace{\rm{or}}\enspace f'(r){\partial r\over \partial x}$$
In a similar way you obtain the other two partial derivatives. The result is a vector of three components, known as the gradient of $f$, which can be written as $f'(r)\nabla r$, where $\nabla r$ is the gradient of $r$, and $f'(r)$, is a number, both evaluated at the point $(x_0,y_0,z_0)$. So the derivative of $f\circ r$ at the point $(x_0,y_0,z_0)$ is the vector:
$$f'(r(x_0,y_0,z_0))\cdot({\partial r\over \partial x}(x_0,y_0,z_0),{\partial r\over \partial y}(x_0,y_0,z_0),{\partial r\over \partial z}(x_0,y_0,z_0))$$
