So we can think permanent magnets to be composed of large number of tiny magnetic dipoles? You can hear this in very elementary introductions. I would guess this is some kind of approximation to the spins of the atoms, or something... There is energy stored in the magnetic field, so if these magnetic dipoles would rearrange themselves so that their magnetic fields would cancel, the system would reach lower potential. Why does this not happen with permanent magnets?