Let O be the centre of a bar magnet having magnetic length 2l. Let p be the point on the axial line of the bar magnet at a distance r from the centre O of the bar magnet.
Let $q_{m}$ be the pole strength of each pole of the magnet. Let a unit north pole be placed at point P.
Magnetic field intensity at P due to north pole of the bar magnet, $\overrightarrow{B_{1}}$ = Force experienced by unit north pole at P due to north pole of the magnet ,
$$\overrightarrow{B_{1}} = \frac{F}{q_{0}}= \frac{\frac{\mu_{0}}{4\pi}\frac{q_{m}.q_{0}}{(r-l)^{2}}}{q_{0}}$$
$$\overrightarrow{B_{1}} = \frac{\mu_{0}}{4 \pi}\frac{q_{m}}{(r-l)^{2}} along NP$$
$$\overrightarrow{B_{1}} = \frac{\mu_{0}}{4 \pi}\frac{q_{m}}{(r-l)^{2}}\hat{i}$$
similarly , magnetic field intensity at a point P due to south pole of the bar magnet ,
$$\overrightarrow{B_{2}} = \frac{\mu_{0}}{4 \pi}\frac{q_{m}}{(r+l)^{2}}(-\hat{i})$$
$\therefore$ Net magnetic field intensity at a point P due to the bar magnet.
$$\overrightarrow{B_{a}} = \overrightarrow{B_{1}}+\overrightarrow{B_{2}}$$
$$\overrightarrow{B_{a}}= \left [\frac{\mu_{0}}{4 \pi}\frac{q_{m}}{(r-l)^{2}} \right] \hat{i}+\left [\frac{\mu_{0}}{4 \pi}\frac{q_{m}}{(r+l)^{2}}\right](- \hat{i})$$
$$\overrightarrow{B_{a}}= \left [\frac{\mu_{0}}{4 \pi}\frac{q_{m}}{(r-l)^{2}} - \frac{\mu_{0}}{4 \pi}\frac{q_{m}}{(r+l)^{2}}\right] \hat{i}$$
$$\overrightarrow{B_{a}}= \frac{\mu_{0}}{4 \pi} .q_{m} \left[ \frac{1}{(r-l)^{2}} - \frac{1}{(r+l)^{2}}\right] \hat{i}$$
$$\overrightarrow{B_{a}} = \frac{\mu_{0}}{4\pi}q_{m} \left[\frac{(r+l)^{2}-(r-l)^{2}}{(r-l)^{2}(r+l)^{2}} \right]\hat{i}$$
$$\overrightarrow{B_{a}} = \frac{\mu_{0}}{4\pi}q_{m} \left[\frac{(r+l)^{2}-(r-l)^{2}}{(r-l)(r+l)(r-l)(r+l)} \right]\hat{i}$$
$$\overrightarrow{B_{a}} = \frac{\mu_{0}}{4\pi}q_{m} \left[\frac{(r+l)^{2}-(r-l)^{2}}{(r^{2}-l^{2})(r^{2}-l^{2})} \right]\hat{i}$$
$$\overrightarrow{B_{a}} = \frac{\mu_{0}}{4\pi}q_{m} \left[\frac{r^{2}+l^{2}+2rl-[r^{2}+l^{2}-2rl]}{(r^{2}-l^{2})^{2}} \right]\hat{i}$$
$$\overrightarrow{B_{a}} = \frac{\mu_{0}}{4\pi}q_{m} \left[\frac{r^{2}+l^{2}+2rl-r^{2}-l^{2}+2rl]}{(r^{2}-l^{2})^{2}} \right]\hat{i}$$
$$\overrightarrow{B_{a}} = \frac{\mu_{0}}{4\pi}q_{m}\left [ \frac{2r.2l}{(r^{2}-l^{2})^{2}} \right ]\widehat{i}$$
since $q_{m} \times 2l=m$ , dipole moment
$$\overrightarrow{B_{a}} = \frac{\mu_{0}}{4\pi}\left [ \frac{2mr}{(r^{2}-l^{2})^{2}} \right ]\widehat{i}$$
if the magnet is of very small length , then $l^{2} <<r^{2}$
$$\therefore \overrightarrow{B_{a}} = \frac{\mu_{0}}{4\pi}\left [ \frac{2mr}{r^{4}} \right ]\widehat{i}$$
$$\therefore \overrightarrow{B_{a}} = \frac{\mu_{0}}{4\pi}\left [ \frac{2m}{r^{3}} \right ]\widehat{i}$$
Direction of $\overrightarrow{B_{a}}$ is along the direction of magnetic dipole moment $\overrightarrow{m}$. Thus , angle between $\overrightarrow{B_{a}}$ and $\overrightarrow{m}$
