Both the magnets are placed in the field of one another, hence potential energy of dipole (2) is U2=−M2B1cos0∘=−M2B1 =M2×4πμ0⋅r32M1
By using F=−drdU, force on magnet (2) is F2=−drdU2=−drd(4πμ0⋅r32M1M2) =−4πμ0⋅6r4M1M2
It can be proved ∣F1∣=∣F2∣=F =4πμ0⋅r46M1M2 ⇒F∝r41