# Magnetized Sphere

I'm trying to solve the magnetostatic problem of a magnetized sphere using the expansion of $$\frac{1}{|\textbf{r}-\textbf{r}'|}$$ in terms of Legrendre polynomials. For simplicity I assume $$\textbf{M}\left(\textbf{r}\right)=M_{S}\hat{z}$$ inside the sphere and $$0$$ outside, or in spherical coordinates

$$$$\left(\begin{array}{c} M_{r}\\ M_{\theta}\\ M_{\phi} \end{array}\right)=\left(\begin{array}{ccc} \sin\theta\cos\phi & \sin\theta\sin\phi & \cos\theta\\ \cos\theta\cos\phi & \cos\theta\sin\phi & -\sin\theta\\ -\sin\phi & \cos\phi & 0 \end{array}\right)\left(\begin{array}{c} M_{x}\\ M_{y}\\ M_{z} \end{array}\right)\rightarrow\begin{array}{c} M_{r}=M_{S}\cos\theta\\ M_{\theta}=-M_{S}\sin\theta \end{array}$$$$ The quantity $$\nabla_{\textbf{r}}\cdot\textbf{M}\left(\textbf{r}\right)$$ is going to be only nonzero across the surface of the magnetic material. More specifically, we have

\begin{align} \nabla_{\textbf{r}}\cdot\textbf{M}\left(\textbf{r}\right) & =\hat{r}\cdot\hat{r}\frac{\partial M_{r}\left(\textbf{r}\right)}{\partial r}\nonumber \\ & =-M_{S}\cos\theta\delta\left(r-R\right) \end{align} This yields the magnetic field expression

\begin{align} \textbf{H}\left(\textbf{r}\right) & =\nabla_{\textbf{r}}\int_{V_{\infty}}d\textbf{r}'\frac{1}{4\pi\left|\textbf{r}-\textbf{r}'\right|}\left[-M_{S}\cos\theta'\delta\left(r'-R\right)\right] \end{align} Now the idea is to use \begin{align} \frac{1}{\left|\textbf{r}-\textbf{r}'\right|} & =\sum_{l=0}^{\infty}\frac{r_{<}^{l}}{r_{>}^{l+1}}P_{l}\left(\cos\theta\right)\\ \nonumber \\ r_{<} & =\begin{cases} r & r}=\begin{cases} r' & r where $$P_{l}\left(\cos\theta\right)$$ is the Legendre polynomials of order $$l=0,1,2,3$$, and $$\theta$$ is the angle between $$\textbf{r}$$ and $$\textbf{r}'$$. We can rewrite that as

\begin{align} \frac{1}{\left|\textbf{r}-\textbf{r}'\right|} & =\sum_{l=0}^{\infty}\frac{r^{l}}{\left(r'\right)^{l+1}}P_{l}\left(\cos\theta\right)\qquad rr'\\ \nonumber \end{align} To solve the integral, we assume $$\textbf{r}\parallel\hat{z}$$, so that we have $$\theta=\theta'$$

\begin{align} \textbf{H}_{dem}\left(z\right) & =-\frac{M_{S}}{4\pi}\nabla_{\textbf{r}}\sum_{l=0}^{\infty}\int_{0}^{\infty}r'^{2}dr'\int_{0}^{\pi}\sin\theta'd\theta'\int_{0}^{2\pi}d\phi'\frac{r_{<}^{l}}{r_{>}^{l+1}}P_{l}\left(\cos\theta'\right)\cos\theta'\delta\left(r'-R\right)\nonumber \\ & =-\frac{M_{S}}{2}\nabla_{\textbf{r}}\sum_{l=0}^{\infty}\int_{0}^{\infty}r'^{2}dr'\frac{r_{<}^{l}}{r_{>}^{l+1}}\delta\left(r'-R\right)\overset{=\frac{2}{2l+1}\delta_{l1}}{\overbrace{\int_{0}^{\pi}d\theta'\sin\theta'\cos\theta'P_{l}\left(\cos\theta'\right)}}\nonumber \\ & =-\frac{M_{S}}{3}\nabla_{\textbf{r}}\int_{0}^{\infty}r'^{2}dr'\frac{r_{<}}{r_{>}^{2}}\delta\left(r'-R\right) \end{align} For $$r, we obtain \begin{align} \textbf{H}_{dem}\left(z\right) & =-\frac{M_{S}}{3}\nabla_{\textbf{r}}R^{2}\frac{z}{R^{2}}\nonumber \\ \textbf{H}_{dem}\left(\textbf{r}\right) & =-\frac{M_{S}}{3}\nabla_{\textbf{r}}r\cos\theta\nonumber \\ & =-\frac{M_{S}}{3}\left[\hat{r}\cos\theta-\hat{\theta}\sin\theta\right]\nonumber \\ & =-\frac{M_{S}}{3}\hat{z} \end{align} which agrees with the expected result. On the other hand, for $$r>R$$, we obtain \begin{align*} \textbf{H}_{dem}\left(z\right) & =-\frac{M_{S}}{3}\nabla_{\textbf{r}}R^{2}\frac{R}{z^{2}}\\ & =-\frac{M_{S}}{3}R^{3}\nabla_{\textbf{r}}\frac{1}{r^{2}\cos^{2}\theta}\\ & \\ \\ \end{align*} which doesn't agree with the correct result. Any comments where I might be doing something wrong?

EDIT --

Assuming there is no prime on the divergence of the magnetization, we have \begin{align} \textbf{H}_{dem}\left(\textbf{r}\right) & =-M_{S}{\nabla}_{\textbf{r}}\cos\theta\int_{V_{\infty}}d\textbf{r}'\frac{1}{4\pi\left|\textbf{r}-\textbf{r}'\right|}\delta\left(r'-R\right) \end{align} and finally

\begin{align} \textbf{H}_{dem}\left(\textbf{r}\right) &=-M_{S}R^{2}{\nabla}_{\textbf{r}}\cos\theta\int d\theta'd\phi'\frac{\sin\theta'}{4\pi\sqrt{\left|\textbf{r}\right|^{2}+R-2R\left|\textbf{r}\right|\cos\gamma}} \end{align} where $$\gamma$$ is the angle between $$\textbf{r}$$ and $$\textbf{r}'$$. For $$r>R$$ we can use $$$$\frac{1}{\sqrt{\left|\textbf{r}\right|^{2}+R^{2}-2R\left|\textbf{r}\right|\cos\gamma}} =\sum_{l=0}^{\infty}\frac{R^{l}}{r^{l+1}}P_{l}\left(\cos\gamma\right)$$$$ which gives \begin{align*} \textbf{H}_{dem}\left(\textbf{r}\right) & =-\frac{M_{S}}{4\pi}2\pi R^{2}\nabla_{\textbf{r}}\cos\theta\sum_{l=0}^{\infty}\frac{R^{l}}{r^{l+1}}\int_{0}^{\pi}d\theta'\sin\theta'P_{l}\left(\cos\gamma\right) \end{align*}.

How should I proceede from here to obtain the expression you showed? First I have to make $$\gamma$$ map into $$\theta'$$, although I cannot see how this should give something like

$$$$\propto \sum_{l=0}^{\infty}\frac{R^{l}}{r^{l+1}}\overset{=\frac{2}{2l+1}\delta_{l1}}{\overbrace{\int_{0}^{\pi}d\theta'\sin\theta'\cos\theta'P_{l}\left(\cos\theta'\right)}} = \frac{2R}{3r^2}$$$$

The $$\theta$$ in \begin{align} \nabla_{\textbf{r}}\cdot\textbf{M}\left(\textbf{r}\right) & =\hat{r}\cdot\hat{r}\frac{\partial M_{r}\left(\textbf{r}\right)}{\partial r}\nonumber \\ & =-M_{S}\cos\theta\delta\left(r-R\right) \end{align} refers to a fixed direction with respect to the $$z$$ axis. So, when you put it in the integral, it should not be primed.

Then, you are somehow setting $$r_>$$ and $$r_<$$ equal to $$z$$ qt the end of resoliving your integrals. They should just be $$r$$.

So your $$r expression is correct because the $$r$$ and the $$\cos\theta$$ give you the $$z$$ that you had erroneously put to begin with.

But for the $$r>R$$ region, you should get: $$\textbf{H}_{dem}\left(z\right) =-\frac{M_{S}}{3}\nabla_{\textbf{r}}\left(R^{2}\frac{R}{r^{2}}\cos\theta \right) = 2\frac{M_S R^3}{3}\frac{\cos\theta}{r^3}\hat{\mathbf{r}} + \frac{M_S R^3}{3}\frac{\sin\theta}{r^3}\hat{\boldsymbol{\theta}} ,$$ using $$\hat{\mathbf{r}}\cos\theta -\hat{\mathbf{z}} = \sin\theta \hat{\boldsymbol{\theta}},$$ this becomes: $$\textbf{H}_{dem}\left(z\right) = M_S R^3\frac{\cos\theta}{r^3}\hat{\mathbf{r}} - \frac{M_S R^3}{3}\hat{\mathbf{z}} .$$

You can easily prove this is a special case of the general expression for a dipole: $$\mathbf{B}(r>R) = \frac{\mu_0}{4\pi} \left ( -\frac{\mathbf{m}}{r^3} + \frac{3 (\mathbf{m}\cdot \mathbf{r})\mathbf{r}}{r^5} \right ),$$ with $$\mathbf{B} = \mu_0 \mathbf{H}$$ and $$\mathbf{m} = \frac{4\pi}{3}\pi R^3 \mathbf{M}$$.

• Thanks for the answer. However, I still cannot obtain the final result. I've edited my answer to address the points you raised. Could you please take a look? Commented Oct 30, 2020 at 23:39
• You're right. I oversimplified your problem. There must definitely be a cosine at the end, but you also need one to get rid of the Legendre polynomial. I'll remove my answer when you've seen this comment. Commented Oct 31, 2020 at 0:36
• I can’t delete it because the answer has been upvoted Commented Oct 31, 2020 at 8:11
• No worries. Exactly. I thought that the cosine would arise due to alignment between r and z axis. Note we have to do this alignment at some point to make $\gamma$ map into $\theta$ Commented Nov 1, 2020 at 16:11