Why do two wires with current flowing in the same direction attract each other, and two wires with current flowing in opposite direction repel?
1 Answer
An electric current creates a magnetic field. The fields attract or repel depending on their orientation.
Explanation:
You can determine the direction of the magnetic field on a wire by imaging your right thumb pointing in the direction of the current. The fingers of your right hand will wrap around the wire in the same direction as the magnetic field. With two currents flowing in opposite directions you can determine that the magnetic fields are in the same direction and will therefore repel. When the currents flow in the same direction the magnetic field will be opposite and the wires will attract.
Like a lot of explanations in science, there is the simple one derived hundreds of years ago, and a more complex model that gives the same answer but requires you to understand more advanced topics and mathematics. Read on if you dare.
You can also work this out using relativity and not require a magnetic field. In the frame of reference of the moving charges they will see a length contraction of the universe along the direction of travel. If electrons in both wires are moving in the same direction they see the same number of electrons in the other wire (because they are moving at the same speed.) But they see more protons. The difference in electric charges attract each other. It's a very tiny length difference, but there are lots and lots of charges.
If the currents flow in opposite directions, the electrons will "see" a higher density of electrons in the other wire due to relativistic length contraction. And the wires will repel.
See this great explanation of electromagnetism:
How Special Relativity Makes Magnets Work