I came across a question regarding the force between two magnetic dipoles $M_1$ and $M_2$ separated by a distance $x$ .
Here in this text book I am given the solution is
$$ B = \cfrac{\mu_0}{4 \pi} \cfrac{2M_1}{x^3}$$ which on differentiating with respect to distance $x$ gives
$$\frac{dB}{dx} =\cfrac{\mu_0}{4 \pi} \cfrac{6M_1}{x^4} $$ Further,
$$ F = -M_2 \frac{dB}{dx} = \cfrac{\mu_0}{4 \pi} \cfrac{6M_1 M_2}{x^4} $$
What is correct explanation of relation of '$\frac{dB}{dx}$' with force here?