So it's Friday, April 21, 1820.

A physics professor in Denmark named Hans Christian Oersted is in the middle of a lecture, and he's using a compass and an electric wire for a demonstration.

He turns on the current that runs through the wire, and he notices that the needle in the compass starts to move.

And when he turns the current off, the needle moves back to where it was.

Then, he runs the current through the wire in the opposite direction, and sees the needle move the other way.

What Oersted demonstrated that day was a fundamental discovery: the connection between electricity and magnetism.

And it changed the field of physics forever.

The relationship between electricity and magnetism not only explains what Oersted and his students witnessed in 1820.

It also makes possible much of the technology that's used today - from hydroelectric dams to your smartphone.

It even explains why Earth's magnetic field is essentially keeping you from being cooked alive right now.

And all you really need to understand the basics of magnetism and electricity is this.

[waves hand] [Theme Music] You're probably familiar with the basics of magnets already: They have a north pole and south pole.

Two of the same pole will repel each other, while opposites attract.

Only certain materials, especially those that contain iron, can be magnets.

It depends on their molecular properties.

And other metals, including cobalt, nickel, and iron, are attracted to magnets, even though they aren't magnets themselves.

Like the metal in your refrigerator door.

And there's a magnetic field around Earth, which is why you can use a compass to figure out which way is north.

The magnet in the compass aligns itself with Earth's magnetic field.

Just as we use electric field lines to represent the electric field created by charges, we can draw magnetic field lines to represent the magnetic field created by magnets.

And as with electric fields, the more crowded the lines are, the stronger the magnetic field.

The lines point from the north pole to the south pole - like how electric field lines point from the positive to the negative charge.

But there's a key difference: you can have an electric field spreading outward from a single electric charge.

But that can't happen with magnets because you can't isolate one magnetic pole.

If you chop a bar magnet in half, you don't end up with one north magnet and one south magnet - you end up with two magnets, each with its own north pole and south pole.

This means that the magnetic field lines surrounding a magnet always form closed loops.

We measure magnetic fields using a unit called the tesla, which is one Newton per Ampere-meter.

And 1 tesla is a very strong magnetic field - the fields from some of the strongest superconducting magnets in the world are only 10 teslas.

Now, when Oersted was doing his demonstration on that fateful day in 1820, he was using a regular compass magnet.

But when he brought the magnet close to a wire carrying a current, the magnetic field from that current exerted a force on the needle, moving it to point in a different direction.

Oersted had discovered one of the fundamental principles of electromagnetism: An electric current produces a magnetic field.

After a few more months of experimenting, Oersted figured out that when a current runs through a wire, the magnetic field that it produces surrounds the wire.

Expressed with field lines, the magnetic field would appear as circles, with the wire at their center.

If the current was coming straight towards you, the field lines would be pointing counterclockwise.

And we use the vector B to represent the magnetic field.

The magnitude of the vector is the strength of the magnetic field, and the direction of the vector is the field's direction.

Now, there's an easy way to remember how the direction of the electric current, and the direction of the magnetic field it produces, relate to each other.

It's called the first right-hand rule - because there are actually three right-hand rules.

Just take your right hand, and point your thumb in the direction of the electric current.

Now curl your fingers.

The direction your fingers are curling?

That's the way the magnetic field lines are pointing.

And likewise, if you know the direction of the magnetic field lines, you can use the rule to figure out the direction of the current in the wire.

It really comes in, uh, handy.

Now, if a current running through a wire exerts a force on a magnet, you might expect the opposite to be true as well: That a magnet exerts a force on a current running through a wire.

And it does!

Which is good, because that's what's protecting us from harmful radiation from the Sun right now.

The direction of the force from a magnetic field on a current running through a wire will be perpendicular to both the magnetic field and the current.

Which brings us to the second right-hand rule!

This one helps you keep track of three directions: the direction of the magnetic field, the current, and the force.

Here's how to use the second right-hand rule: Point your arm in the direction of the current.

Then bend your fingers so they're perpendicular to your palm.

This represents the direction of the magnetic field.

Your thumb, which is perpendicular to your fingers, is the direction of the force on the wire.

But what about the strength of that force?

You can use your hands to figure this out, too!

But you'll have to use them to do math.

Sorry.

The magnitude of the force from a magnetic field on a wire is equal to I l B sin theta.

This equation tells us that there are four factors that affect the magnitude of the force.

First, there's the current in the wire - that's I - and the stronger it is, the stronger the force is.

Second, there's the length of the wire running through the magnetic field - that's l - and the longer the wire is, the stronger the force is.

Third, there's the magnetic field, B, and the stronger B is, the stronger the force.

Finally, the closer to perpendicular the current is with respect to the magnetic field's direction, the stronger the force is.

That's where the sine theta comes in - its maximum value is 1, when theta is 90 degrees.

So the current is perpendicular to the magnetic field lines.

That's when the force will be strongest.

Similarly, the minimum value of sine theta is 0, when theta is 0 - so that means the current is parallel to the magnetic field lines.

And in that case, there won't be any force on the wire at all.

Now, all of this math can help us understand how we're being protected right now from solar radiation!

The Sun is constantly shooting radiation towards Earth, in the form of charged particles.

But, luckily for us, Earth has a magnetic field.

Currents are made up of moving electric charges, so it makes sense that a magnetic field would also exert a force on single electric charges that pass through it.

And this is exactly what the Earth's magnetic field does to the charged particles coming from the Sun: it deflects them, sending them spiraling away and protecting us from the worst of the radiation.

Let's suppose you wanted to find the magnitude of the force of the magnetic field on a single charged particle from the Sun.

All you'd have to do is change the equation we used for the force on the current, to account for the fact that we're talking about a single charge.

The equation for the force of a magnetic field on a current says that: the strength of the force is equal to the current, times the length of the wire, times the strength of the magnetic field, times the sine of the angle between the current and the magnetic field.

Now, two of those variables don't apply to a single charge: the current, I, and the length, l. But current is just equal to the number of charged particles passing a given point over a certain amount of time - which we'll call N - times their charge, q, divided by that time, t. For a single charge, N is just 1.

And length is just equal to velocity, v, multiplied by time.

So we can apply these two facts to our equation for force, which tells us that the force on an electric charge moving through a magnetic field, is equal to: q divided by time, multiplied by velocity times time, times the strength of the magnetic field, times the sine of theta.

Those two t's cancel each other out, so the equation simplifies to F = qvBsintheta.

That means that, like the force on a current running through a wire, the force on a single electric charge depends on four factors.

One is the same as with a current: The stronger the magnetic field, the stronger the force.

The other three factors are slightly different from the case with a current: First, the force is stronger, the closer to perpendicular the charge's velocity is to the magnetic field lines.

Which means that if the charge's velocity is parallel to the magnetic field lines, there won't be any force on whatsoever.

Second, the more charge the particle has, the stronger the force.

And third, the faster the particle is moving, the stronger the force.

Finding the direction of this force is where the third right-hand rule comes in: So get your right hand out again!

Straighten your fingers with your thumb stretched outward.

Then point your arm in the direction of the particle's velocity.

Then bend your fingers to make them point in the direction of the magnetic field lines.

This is where things get a little tricky: If the charged particle is positive, your thumb is pointing in the direction of the force.

But if it's negative, the force is pointing in the direction opposite your thumb.

So, electric currents create magnetic fields, and magnetic fields exert forces on electric currents and charges.

Oersted's experiment was simple, but his discovery linked two major fields of physics, and inspired other scientists to do a lot more experimenting.

Today, you learned about magnetism, and the magnetic field created by a current running through a wire.

We also talked about the force from a magnetic field on a current running through a wire, and on a single charge moving through a magnetic field.

And we went through the three right-hand rules.

Crash Course Physics is produced in association with PBS Digital Studios.

You can head over to their channel and check out a playlist of the latest episodes from shows like: First Person, PBS Game / Show, and The Good Stuff.

This episode of Crash Course was filmed in the Doctor Cheryl C. Kinney Crash Course Studio with the help of these amazing people and our equally amazing graphics team, is Thought Cafe.