Line element (dl) in spherical coordinates derivation/diagram I'm trying to figure out how to derive the formula for an infinitesimal length $\mathrm dl$, specifically, the first formula in this Wikipedia section:
$$\mathrm d\mathbf r=\mathrm dr\hat{\boldsymbol r}+r\mathrm d\theta\hat{\boldsymbol \theta}+r\sin\theta\mathrm d\varphi\hat{\boldsymbol\varphi}\;,$$
where $\hat{\boldsymbol r}$, $\hat{\boldsymbol\theta}$ and $\hat{\boldsymbol\varphi}$ are mutually orthogonal unit vectors in the directions of increasing $r$, $\theta$ and $\varphi$, respectively.
If I could see a good diagram it would probably be enough, but I can't find any.
 A: The general form of the formula you refer to is
$$\mathrm d\mathbf r=\sum_i\frac{\partial \mathbf r}{\partial x_i}\mathrm dx_i=\sum_i\left\lvert\frac{\partial \mathbf r}{\partial x_i}\right\rvert\;\frac{\frac{\partial \mathbf r}{\partial x_i}}{\left\lvert\frac{\partial \mathbf r}{\partial x_i}\right\rvert}\mathrm dx_i=\sum_i\left\lvert\frac{\partial \mathbf r}{\partial x_i}\right\rvert\;\mathrm dx_i\hat{\boldsymbol x}_i\;,$$
that is, the change in $\mathbf r$ is decomposed into individual changes corresponding to changes in the individual coordinates. To apply this to the present case, you need to calculate how $\mathbf r$ changes with each of the coordinates. With the conventions being used, we have
$$\mathbf r=\pmatrix{r\sin\theta\cos\varphi\\r\sin\theta\sin\varphi\\r\cos\theta}\;.$$
Thus
$$\frac{\partial\mathbf r}{\partial r}=\pmatrix{\sin\theta\cos\varphi\\\sin\theta\sin\varphi\\\cos\theta}\;,$$
$$\frac{\partial\mathbf r}{\partial \theta}=\pmatrix{r\cos\theta\cos\varphi\\r\cos\theta\sin\varphi\\-r\sin\theta}\;,$$
$$\frac{\partial\mathbf r}{\partial \varphi}=\pmatrix{-r\sin\theta\sin\varphi\\r\sin\theta\cos\varphi\\0}\;.$$
Then the desired coefficients are the magnitudes of these vectors:
$$
\begin{eqnarray}
\left\lvert\frac{\partial\mathbf r}{\partial r}\right\rvert&=&1\;,\\
\left\lvert\frac{\partial\mathbf r}{\partial \theta}\right\rvert&=&r\;,\\
\left\lvert\frac{\partial\mathbf r}{\partial \varphi}\right\rvert&=&r\sin\theta\;.
\end{eqnarray}$$
