Static Fields: Fall-2026
HW 02 (SOLUTION): Due W1 D5: Math Bits

  1. Mass Density Consider a rod of length \(L\) lying on the \(z\)-axis. Find an algebraic expression for the mass density of the rod if the mass density at \(z=0\) is \(\lambda_0\) and at \(z=L\) is \(7\lambda_0\) and you know that the mass density increases:
    1. with the square of the distance along the rod;

      In the equation for \(\lambda(z)\), "name the things you don't know". \(\alpha\) is the initial value (for \(z=0\)) and \(\beta\) is the proportionality constant. \begin{align*} \lambda(z) &=\alpha +\beta z^2\\ \lambda(0) &=\alpha +\beta 0^2=\lambda_0\\ &\Rightarrow\alpha=\lambda_0\\ \lambda(L) &=\lambda_0+\beta L^2=7\lambda_0\\ &\Rightarrow\beta=\frac{6\lambda_0}{L^2}\\ \lambda(z) &=\lambda_0\left(1+\frac{6}{L^2} z^2\right) \end{align*}

    2. exponentially.

      In the equation for \(\lambda(z)\), "name the things you don't know". There are two parameters in an exponential function, \(\alpha\) is an overall multiplicative constant. Since the exponential function is equal to one when the argument is zero, \(\alpha\) gives the initial value (for \(z=0\)). The exponential function also has a parameter \(k\) that makes the exponent dimensionless. \begin{align*} \lambda(z) &=\alpha\, e^{kz}\\ \lambda(0) &=\alpha\, e^{k0}=\lambda_0\\ &\Rightarrow \alpha=\lambda_0\\ \lambda(z) &=\lambda_0\, e^{kz}\\ \lambda(L) &=\lambda_0\, e^{kL}=7\lambda_0\\ &\Rightarrow e^{kL}=7\\ &\Rightarrow kL=\ln 7\\ &\Rightarrow k=\frac{\ln 7}{L}\\ \lambda(z) &=\lambda_0\, e^{z\ln 7 /L} \end{align*}

  2. Charge on a Spiral A charged spiral in the \(x,y\)-plane has 6 turns starting at the origin out to a maximum radius \(R\). The radial distance from the center to a point on the spiral is proportional to \(\phi\). The charge density on the spiral increases linearly as the radial distance from the center increases. At the center of the spiral the linear charge density is \(0~\frac{\textrm{C}}{\textrm{m}}\). At the end of the spiral, the linear charge density is \(13~\frac{\textrm{C}}{\textrm{m}}\). What is the total charge on the spiral?

    Let's start by finding the charge density on the spiral. I know that the charge density increases linearly with the distance from the center of the spiral, so our linear charge density will be proportional to the radius, \(s\). (Notice the two different uses of the word “linear”!) I also know that at the max radius, \(R\), I will have a linear charge density of \(13~\frac{\textrm{C}}{\textrm{m}}\), so I can solve for the proportionality constant, which I'll call \(\alpha\) \begin{align} \lambda(s) &= \alpha s\\ 13 ~\frac{\textrm{C}}{\textrm{m}} &= \alpha R\\ \Rightarrow \alpha&=\frac{13~\frac{\textrm{C}}{\textrm{m}}}{R}\\ \lambda(s) &= \left(13~\frac{\textrm{C}}{\textrm{m}}\right) \frac{s}{R} \end{align}

    I will chop up the spiral into little pieces and find the charge \(\lambda\, d\ell\) on each little piece. Then I will add up (integrate) the charge from each of the little pieces. (Sensemaking: Note that \(\lambda(s)\) has the correct units, since \(s/R\) is unitless---I will suppress the \(\frac{\textrm{C}}{\textrm{m}}\) and restore it at the very end.)

    So the next thing I need to find is \(d\ell\) on a little piece of the spiral. \begin{align*} d\ell&=\vert d\vec r\vert\nonumber\\ &=\vert ds\, \hat s + s d\phi\, \hat\phi + dz\, \hat z\vert\nonumber\\ &=\sqrt{ (ds\, \hat s + s\, d\phi\, \hat\phi)\cdot (ds\, \hat s + s\, d\phi\, \hat\phi) }\nonumber\\ &=\sqrt{ds^2 + s^2 d\phi^2} \end{align*} I am trying to do a line integral, so I need to find \(d\ell\) in terms of a single parameter, but both \(\phi\) and \(s\) are changing. I need to know the relationship between \(\phi\) and \(s\) to proceed further. I'm given the information that \(\phi\) will increase proportionally to the distance from the center of the spiral, which is the radius s, so I can write: \begin{align*} s &= \beta \phi\\ \end{align*} I also know that at the end of the spiral \(s=R\) and the spiral has to revolve 6 times around the center on its way there, so I know know \(\phi_{end} =6(2\pi)=12\pi\), and I can use this information to solve for \(\beta\): \begin{align*} s &= \beta \phi\\ R &= 12\pi \beta \\ \Rightarrow\beta&=\frac{R}{12\pi}\\ s &=\frac{R}{12\pi} \phi\\ \end{align*} Now, zapping this equation with \(d\), I get: \begin{align*} ds &=\frac{R}{12\pi} d\phi\\ \end{align*} I can plug the differential relationship into \(d\ell\), substituting for either \(ds\) or \(d\phi\). Since the charge density is written in terms of \(s\), it is a little simpler to eliminate \(d\phi\), using \(d\phi=\frac{12\pi}{R} ds\): \begin{align*} d\ell&=\sqrt{ds^2 + s^2 d\phi^2}\nonumber\\ &=\sqrt{1 + s^2\left(\frac{12\pi}{R}\right)^2}~ds \end{align*}

    Putting all the pieces together and integrating with respect to \(s\), I have:

    \begin{align*} Q &= \int_0^R \lambda(s)\, d\ell\nonumber\\ &=\int_0^R 13 \frac{s}{R} \sqrt{1 + s^2\left(\frac{12\pi}{R}\right)^2}~ds \end{align*}

    I can integrate using substitution by letting \(u=1 + s^2\left(\frac{12\pi}{R}\right)^2\) and then zapping with \(d\) I get \(du= 2s\left(\frac{12\pi}{R}\right)^2 ds\) and so I have:

    \begin{align*} Q &=\int_{u(0)}^{u(R)} 13 \frac{s}{R} \sqrt{u}~\frac{du}{2s\left(\frac{12\pi}{R}\right)^2}\nonumber\\ &=\int_{u(0)}^{u(R)} \frac{13R}{288\pi^2} \sqrt{u}~du\nonumber \\ &=\left[\frac{13R}{288\pi^2} \frac{2}{3} \left( 1 + s^2\left(\frac{12\pi}{R}\right)^2 \right)^\frac{3}{2}\right]_0^R\nonumber \\ &=\frac{13\frac{\textrm{C}}{\textrm{m}}~R}{432\pi^2} \left(\left( 1 + 144\pi^2 \right)^\frac{3}{2}-1\right)\nonumber \\ &\approx \left(163.53 \frac{\textrm{C}}{\textrm{m}}\right)R \end{align*}

    Sense-making: How can I be confident that an answer like this is correct? The dimensions work out (I can see that the square root is dimensionless, and the extra overall factor of \(R\) cancels the \(1/L\) in the units of the linear charge density, \(13~\frac{\textrm{C}}{\textrm{m}}\), to leave only Coulombs. I can also check limiting cases: If I let the radius of the spiral go to 0, I get \(Q=0\), which makes sense. Similarly, if I let \(R\rightarrow \infty\) we see our charge becomes infinite, which should happen if I have an infinite spiral with a finite charge density.

  3. Distance Formula in Curvilinear Coordinates

    The distance \(\left\vert\vec r -\vec r\,{}'\right\vert\) between the point \(\vec r\) and the point \(\vec r'\) is a coordinate-independent, physical and geometric quantity. But, in practice, you will need to know how to express this quantity in different coordinate systems.

    1. Find the distance \(\left\vert\vec r -\vec r\,{}'\right\vert\) between the point \(\vec r\) and the point \(\vec r'\) in rectangular coordinates.

      In rectangular coordinates: \begin{align*} \left| \vec r -\vec r\,{}'\right| &= \left|(x\hat{x}+y\hat{y}+z\hat{z}) -(x\,{}'\hat{x}+y\,{}'\hat{y}+z\,{}'\hat{z})\right|\\ &= \left|((x-x')\hat{x}+(y-y')\hat{y}+(z-z')\hat{z}) \right|\\ &= \sqrt{((x-x')\hat{x}+(y-y')\hat{y}+(z-z')\hat{z}) \cdot ((x-x')\hat{x}+(y-y')\hat{y}+(z-z')\hat{z})}\\ &= \sqrt{(x-x\,{}')^2+(y-y\,{}')^2+(z-z\,{}')^2} \end{align*}

      Sense-making: This is the Pythagorean Theorem!

    2. Show that this same distance written in cylindrical coordinates is: \begin{equation*} \left|\vec r -\vec r\,{}'\right| =\sqrt{s^2+s\,{}'^2-2ss\,{}'\cos(\phi-\phi\,{}') +(z-z\,{}')^2} \end{equation*}

      Hint: You may want to use the textbook: GMM: Change of Coordinates

      In cylindrical coordinates: \begin{align*} x &= s\cos\phi\\ y &= s\sin\phi\\ z &= z \end{align*} Plug these coordinates into the ANSWER to the first part, above. Then simplify using appropriate trig identities including an addition formula. Now would be a good time to learn how to find the trig identities quickly online or in a reference book.

      (Note: You might be tempted to do this calculation by starting with an expression for the position vector using both cylindrical coordinates and cylindrical basis vectors. This strategy is impossible because the cylindrical basis vectors at \(\vec r\) and \(\vec r'\) are different from each other, so you cannot subtract these vectors without resorting to fancy differential geometry/general relativity! If you don't yet know about cylindrical basis vectors, ignore this comment for now.)

      \begin{align*} \left|\vec r -\vec r\,{}'\right| &= \sqrt{(s\cos\phi-s\,{}'\cos\phi\,{}')^2 +(s\sin\phi-s\,{}'\sin\phi\,{}')^2 + (z-z\,{}')^2}\\ &= \left[s^2(\cos^2\phi+\sin^2\phi) +s\,{}'^2(\cos^2\phi\,{}'+\sin^2\phi\,{}')\right.\\ &~~~\left. -2s\,{}' s(\cos\phi\cos\phi\,{}'+\sin\phi\sin\phi\,{}') +(z-z\,{}')^2\right]^{\frac{1}{2}}\\ &= \sqrt{s^2+s\,{}'^2-2ss\,{}'\cos(\phi-\phi\,{}')+(z-z\,{}')^2} \end{align*}

    3. Show that this same distance written in spherical coordinates is: \begin{equation*} \left\vert\vec r -\vec r\,{}'\right\vert =\sqrt{r'^2+r\,{}^2-2rr\,{}' \left[\sin\theta\sin\theta\,{}'\cos(\phi-\phi\,{}') +\cos\theta\cos\theta\,{}'\right]} \end{equation*}

      Hint: You may want to use the textbook: GMM: Change of Coordinates

      In spherical coordinates: \begin{align*} x &= r\sin\theta \cos\phi\\ y &= r\sin\theta \sin\phi\\ z &= r\cos\theta \end{align*} Plug these coordinates into the ANSWER to the first part, above. Also, see the notes in the solution to the cylindrical case. \begin{align*} \left|\vec r -\vec r\,{}'\right| &= \left[(r\sin\theta \cos\phi-r\,{}'\sin\theta\,{}'\cos\phi\,{}')^2\right.\\ &~~\left. +(r\sin\theta\sin\phi -r\,{}'\sin\theta\,{}' \sin\phi\,{}')^2\right.\\ &~~\left. +(r\cos\theta -r\,{}'\cos\theta\,{}')^2\right]^{\frac{1}{2}}\\ &= \left\{ r^2 [\sin^2\theta(\cos^2\phi +\sin^2\phi)+\cos^2\theta]\right.\\ &~~\left. +r\,{}'^2 [\sin^2\theta\,{}'(\cos^2\phi\,{}'+\sin^2\phi\,{}') +\cos^2\theta\,{}' ]\right.\\ &~~\left. -2rr\,{}'[\sin\theta \sin\theta\,{}'(\cos\phi\cos\phi\,{}' +\sin\phi\sin\phi\,{}')+\cos\theta\cos\theta\,{}']\right\} ^{\frac{1}{ 2}}\\ &=\sqrt{r^2+r\,{}'^2-2rr\,{}'[\sin\theta \sin\theta\,{}'\cos(\phi-\phi\,{}') +\cos\theta\cos\theta\,{}']} \end{align*}

      Sense-making: Wow, that is an ugly expression (don't memorize this one, by the way). Let's try some special cases. If \(\phi = \phi\,{}'\), we can use a trig identity to reduce the distance formula to \begin{equation*} \left|\vec r -\vec r\,{}'\right| = \sqrt{r^2+r\,{}'^2-2rr\,{}' \cos\left(\theta - \theta\,{}'\right)} \end{equation*}

      This is the law of cosines, which makes sense because you can easily write the angle between the two vectors in terms of the difference in the polar angles \(\theta\). The same trick doesn't work the same way for \(\theta = \theta\,{}'\), since the difference in \(\phi\) is not the difference in angles---unless \(\theta = \theta\,{}' = \pi/2\), which is on the equator (see next part).

    4. Now assume that \(\vec r\,{}'\) and \(\vec r\) are in the \(x\)-\(y\) plane. Simplify the previous two formulas.

      Cylindrical Coordinates at \(z=0\) and \(z\,{}'=0\) \begin{equation*} \sqrt{s^2+s\,{}'^2-2ss\,{}'\cos(\phi-\phi\,{}')} \end{equation*}

      Spherical Coordinates at \(\theta\,{}'=\frac{\pi}{2}\Rightarrow \cos\theta\,{}'=0\) and \(\sin\theta\,{}'=1\). (Also true for \(\theta\).) \begin{equation*} \sqrt{r^2+r\,{}'^2-2rr\,{}'\cos(\phi-\phi\,{}')} \end{equation*}

      Behold the Law of Cosines once again!