If I place two bar magnets with like poles facing they repel. However, if I place
a 2cm wide bar of unmagnestised steel (a keeper) between them then both are attracted
to the keeper, ie the attractive force to the keeper is greater than the repulsive force
between the opposite poles. Why is this?

Kirsten Franklin, a physicist at Otago University, responded.

The question you’re asking here is really a very old one. The ability of magnetic
materials like lodestone to attract iron has been known of and puzzled over
since ancient times. The Arabian Nights tales mention a mountain that would
tear the nails out of ships that came near. The Greek wise man Thales of Miletus
believed that the attraction was due to the stones having a soul. A superstition
from the Middle Ages was that a magnet could cure gout but garlic removed its
power, although this could be restored with goat’s blood.

It is a basic property of magnets that they have two poles, which we refer to as
north and south. Opposite poles attract and like poles repel, so as you say,
the bar magnets normally repel each other if you try to force the like poles
together. However, a magnet will always attract an unmagnetised piece of
iron or steel, and this is what is happening when both magnets are attracted
to the keeper.

The iron in the magnets and the steel keeper is special because it is what we
call ‘ferromagnetic’. A ferromagnetic material acts like a whole lot of tiny little
bar magnets that tend to line up the same way as their neighbours. These form
into little regions with the same alignment, called magnetic domains. The
magnetisation of the material depends on the degree of alignment of the
domains. In a permanent magnet, like the bar magnets, these domains are
largely pointing in the same direction and stay that way; in unmagnetised iron
there are as many domains pointing one way as the other.

You’re no doubt familiar with how a magnetic field can move other magnets –
just think of how a compass needle twists to line up with the Earth’s magnetic
field. If we put unmagnetised iron near another magnet, it will become magnetised
as the iron atoms change their alignment, and the domains that line up with the
magnetic field start to dominate. If you put the north pole of a bar magnet
against the steel keeper, it will produce a south pole on the keeper’s surface,
so the opposite poles attract and the keeper attaches to the magnet.

If you can find some other bits of steel, you might like to experiment with making
the middle piece thinner. How thin do you think it can be and still have both magnets stick?