# Is it correct to say “like poles attract, unlike poles repel” while two magnets are placed such that one is inside another?

As we know a solenoid is considered as a electromagnet(magnet) if there's a current flowing through it. if a soft iron core is placed inside the solenoid, the former get magnetised. Consider the solenoid as a hollow bar magnet, and the magnetised soft iron core inside as a bar magnet. The poles of the magnets next to each other is of same polarity. Is there attracting force between the two magnets? If so, does it mean "like poles attract, unlike poles repel" while two magnets are placed such that one is inside another?

• it's the other way around. like poles repel, unlike poles attract. – robert bristow-johnson Apr 8 '15 at 19:19
• @robertbristow-johnson in the situation described by the OP, the like pole of the inner magnet would be attracted to orienting towards the like pole of the other magnet – Jim Apr 8 '15 at 19:21
• A solenoid coil is not like a bar magnet. It is like a sleeve around a bar magnet. The magnetic lines of force go down the inside and up the outside (or vice versa). – Mike Dunlavey Apr 8 '15 at 19:21
• and i think, @Jimnosperm, that it's still the case: whether it's a bar magnet or a solenoid, N attacts S and N repels N. – robert bristow-johnson Apr 8 '15 at 19:24
• i get it now, spurred on by @MikeDunlavey's comment. outside of the solenoid opposites attract. the main difference between a bar magnet and a solenoid is that there isn't the hollow interior of a bar magnet where "like poles attract". i stand corrected. – robert bristow-johnson Apr 9 '15 at 0:42

A solenoid induces a magnetic field in the iron bar kept inside it. This is not the same as inserting a permanent bar magnet inside the solenoid.

The induced magnetic field is in the same direction as the original magnetic field. One way of thinking about this is that the domains in the iron bar line up with the external field, producing a net magnetic field in the same direction as the original.

However if you consider a permanent bar magnet kept in a solenoid, and the solenoid was large enough such that the bar magnet could rotate in any arbitrary direction, once the solenoid is switched on, the bar magnet will align itself with the solenoid's field. This has to do with minimizing the energy in the magnetic field. The energy is given by $$E = - m .\vec{B}$$

so clearly if $m$ and $B$ are in the same direction, it is a lower energy configuration than if $m$ and $B$ are in opposite directions.

A solenoid can behave like a bar magnet but its not a bar magnet. When a current is passed through a solenoid magnetic field is induced in and around it, field lines of which resemble those of a bar magnet. But the solenoid doesn't become a bar magnet. We do not talk about poles of a solenoid but the field in and around it. Its just a magnetic field created like the magnetic field created around a current carrying wire, field lines of which encircles the wire. A magnet needle placed in the magnetic field, $B$, of a current carrying wire will align itself in the way that the field lines of $B$ will appear to enter the S-pole of the needle and leave the N-pole.
Similarly, if you put a bar magnet inside a solenoid the bar magnet will align itself with the field inside the solenoid in the same way as shown in the figure.

The bigger rectangle is the solenoid and the smaller one is a bar magnet. Field lines inside the solenoid enters the S-pole of the bar magnet and leaves the N-pole.
If we put a soft iron core in place of the bar magnet, the field lines inside the solenoid will be concentrated inside the core because of its high permeability relative to air. The field will align the dipoles in the core like the bar magnet in the previous explanation.

• "we do not talk about north pole and south pole of a solenoid." really?? whether it's a bar magnet or a solenoid, magnetic forces are the consequence of circular (or some loop geometry) motion of charge. "N" and "S" are conventions, just like "+" and "-" and the right-hand rule. + charge going around clockwise on some plane causes an N pole coming out of the face of that plane according to the right-hand rule. it's the same whether it's a bar magnet or a solenoid (even if there is a measurable current in the latter). – robert bristow-johnson Apr 8 '15 at 19:29
• @robertbristow-johnson we generally do not talk about poles of a solenoid but we talk more about the field when there is a current through it. But we always and often talk about N and S pole of a bar magnet. I felt the OP has a misconception about the magnetic field of the solenoid which I tried to explain by drawing "field lines" And a solenoid really isn't a bar magnet. Its better to talk about fields and explain with the help of "field lines" to avoid confusions. – Jolie Apr 9 '15 at 18:19
• i see the error of my ways (take a look at the comments to the OP). i stand corrected. – robert bristow-johnson Apr 9 '15 at 18:22

"Like poles repel, unlike poles attract" is kind of a misleading analogy(I find it strange that I realized this after reading your question).

What actually is happening is that the tiny magnetic dipoles inside the magnetic material(a bar of iron, for example) align with the direction of the magnetic field. Look at this field line diagram of a bar magnet.
(source: tutorvista.com)

Observe that the field to the right of the north pole is rightward in direction. Now what happens if you place a tiny magnetic dipole in this region?

It will rotate and try to align with the direction of the magnetic field. That means its magnetic dipole moment vector will have the same direction as the magnetic field vector. The North-South poles of this dipole will arrange in such a way that the south pole faces the north pole of the magnet.

Now consider the case of a large bar of iron, which has similar numerous tiny dipole described above, whose directions are randomly oriented and cancel out in the absence of a magnetic field. When you bring this bar near to the north pole of the magnet, all those tiny dipoles align with the direction of the magnetic field inside the bar. This leads to a greater net dipole moment of the bar, which we also refer to as the north-south poles of this bar. Observe that the south pole will be formed near the north pole.

The same thing happens when you place this bar inside a solenoid. Suppose you have a solenoid whose field inside goes from left to right. The net dipole moment you'll observe will be such that the south pole is towards the left, and the north pole towards the right. This you see as the north pole forming near the north pole of the solenoid.

All that is happening is that the tiny magnetic dipoles are aligning in direction to the magnetic field.

A magnetic pole is just the location where field lines leave (North) or enter (South) a magnet. A hollow magnet therefor has internal poles such that again the good old rule applies that unlike poles attract and likes repel.