Courses · Physics 2 · Unit guide
Physics 2: Sources of magnetic field
How currents create magnetic fields, and how to calculate them for wires, loops and coils
This unit covers: The Biot-Savart law, Ampère’s law, fields of wires and solenoids.

Here's a dare: does a long straight wire's magnetic field fall off as one over r squared, like Coulomb's law? It doesn't, and that slip costs points in every electromagnetism unit. We'll build the Biot-Savart law, Ampère's law, wires, loops and solenoids, then solve a classic problem.
Moving Charges Are the Source
Let's start with where magnetic fields come from. A stationary charge makes only an electric field, but once charges move, as they do in a current, they also make a magnetic field. Around a straight wire, the field lines are closed circles centered on the wire. To find their direction, point your right thumb along the current, and your curled fingers show which way the field circulates.
Key points.
- Magnetic fields are produced by moving charges and currents
- Field lines around a straight wire form closed circles
- Right-hand rule: thumb along current, fingers curl with B
- Field lines never start or end, unlike electric field lines
The Biot-Savart Law
The Biot-Savart law tells you the field from one tiny piece of current. We write dB equals mu naught over four pi, times I d l cross r hat, divided by r squared. The cross product means the magnitude carries a sine of theta, the angle between the current element and the line to your point. Mu naught is four pi times ten to the minus seven tesla meters per amp. Then you add up every piece by integrating.
dB = (μ0/4π) I dl × r̂ / r² |dB| = μ0 I dl sinθ / 4πr² μ0 = 4π × 10⁻⁷ T·m/A B = ∫ dB
Key points.
- Each small current element I dl adds a tiny field dB
- dB is perpendicular to both dl and the vector to the point
- Strength falls as one over r squared for each element
- μ0 = 4π × 10⁻⁷ T·m/A, the permeability of free space
Field of a Long Straight Wire
Now let's apply it to a long straight wire, with your point a distance a away. Each element gives dB equals mu naught I dx sine theta over four pi r squared. Geometry gives sine theta equals a over r, and r squared equals x squared plus a squared. That turns the field into mu naught I a over four pi times the integral of dx over x squared plus a squared to the three halves. From minus infinity to infinity, that integral is two over a squared, so B equals mu naught I over two pi a.
dB = μ0 I dx sinθ / 4πr² sinθ = a/r, r² = x² + a² B = (μ0Ia/4π) ∫ dx/(x²+a²)^(3/2) ∫ from −∞ to ∞ = 2/a² B = μ0 I / 2πa
Key points.
- Integrate Biot-Savart along an infinite wire
- B = μ0 I / 2πa at perpendicular distance a
- Field falls as 1/a, not 1/a²
- Direction given by the right-hand rule
Field at the Center of a Current Loop
The circular loop is even friendlier. At the center, every element sits the same distance R away, and each one is perpendicular to the line to the center, so sine theta is one. That means B equals mu naught I over four pi R squared times the integral of d l. The total length is two pi R, so B equals mu naught I over two R. Stack N turns and you multiply by N.
dB = μ0 I dl / 4πR² B = (μ0 I / 4πR²) ∮ dl ∮ dl = 2πR B = μ0 I / 2R N turns: B = Nμ0 I / 2R
Key points.
- Every element is the same distance R from the center
- Each dl is perpendicular to r̂, so sinθ = 1
- Single loop: B = μ0 I / 2R, along the axis
- N turns: B = Nμ0 I / 2R; an arc of angle θ gives μ0Iθ/4πR
Force Between Parallel Wires
Since each wire makes a field, a second wire nearby feels a force. Wire one makes a field of mu naught I one over two pi d at wire two, and the force per unit length is mu naught I one I two over two pi d. Here's the part students flip: currents in the same direction attract, and opposite currents repel. That's the reverse of what like charges do, so check it with the right-hand rule.
Same direction currents
- Wires attract each other
- F/L = μ0 I1 I2 / 2πd
- Like a magnet's opposite poles
Opposite direction currents
- Wires repel each other
- Same force magnitude per length
- Equal and opposite on each wire
Ampère's Law
Biot-Savart always works, but the integrals can get ugly. Ampère's law is the shortcut for symmetric problems. It says the line integral of B around any closed path equals mu naught times the current enclosed by that path. Currents outside the loop can affect B at points on the path, but they add nothing to the total integral. The trick is choosing a path where B is constant and parallel to the path.
The line integral of B around any closed loop equals μ0 times the net current passing through that loop. Ampère's law
Key points.
- ∮ B · dl = μ0 I_enc around any closed loop
- Only current passing through the loop counts
- Always true, but only easy with high symmetry
- Use it when B is constant along a chosen path
How to Use Ampère's Law
Here's the recipe. First, look at the symmetry and pick an Amperian loop, a circle for wires, a rectangle for solenoids. Second, arrange it so B is constant in size and parallel to the path, or perpendicular where it's zero. Third, count the current poking through the loop, with signs from the right-hand rule. Finally, the integral becomes B times the loop length, so you solve for B. For a wire, B times two pi r equals mu naught I.
- Choose a loop matching the symmetry
- Make B constant and parallel along it
- Find the enclosed current I_enc
- Write B × (loop length) = μ0 I_enc
- Solve for B and check direction
Solenoids and Toroids
A solenoid is a long coil, and inside it the field is strong and uniform while outside it's nearly zero. Take a rectangular Amperian loop with one side of length L inside. Only that side contributes, so B L equals mu naught n L I, giving B equals mu naught n I, where n is turns per meter. With a thousand turns per meter and two amps, that's about two and a half millitesla. A toroid gives mu naught N I over two pi r.
Key points.
- Ideal solenoid: B = μ0 n I inside, n = turns per length
- Field inside is uniform; outside is nearly zero
- Toroid: B = μ0 N I / 2πr inside the core
- Rectangular Amperian loop gives the solenoid result
Worked Problem: Field Inside a Thick Wire
Here's a classic exam problem. A long wire of radius two millimeters carries ten amps spread uniformly, so find B one millimeter from the axis. Draw a circle of radius r inside. Its enclosed current is I times r squared over R squared. Ampère's law gives B times two pi r equals mu naught I r squared over R squared, so B equals mu naught I r over two pi R squared. Plugging in gives five times ten to the minus four tesla.
I_enc = I r²/R² B · 2πr = μ0 I r²/R² B = μ0 I r / 2πR² B = (2×10⁻⁷)(10)(10⁻³)/(4×10⁻⁶) B = 5 × 10⁻⁴ T
Key points.
- Wire radius R = 2.0 mm carries I = 10 A uniformly
- Inside, only the fraction r²/R² of current is enclosed
- Inside: B = μ0 I r / 2πR², growing linearly with r
- At r = 1 mm, B = 5 × 10⁻⁴ T; maximum at the surface
Remember this
Remember this: currents make magnetic fields, Biot-Savart adds them up piece by piece, and Ampère's law is the symmetry shortcut. A long wire falls as one over r. Now quiz yourself on these problems..
Practice this unit
- Physics 2: Sources of Magnetic Field quiz15 multiple-choice questions with explanations · no account needed
- Physics 2: Electric Charge and Coulomb’s Law quiz15 multiple-choice questions with explanations · no account needed
- Physics 2: Electric Fields and Gauss’s Law quiz15 multiple-choice questions with explanations · no account needed
- Physics 2: Sources of Magnetic Field32 flashcards · study free
- Physics 2: Electric Charge and Coulomb’s Law32 flashcards · study free
- Physics 2: Electric Fields and Gauss’s Law34 flashcards · study free
- Physics 2: Electric Potential32 flashcards · study free
Every Physics 2 deck and quiz: the Physics 2 page.
Other Physics 2 unit guides
- Electric charge and Coulomb’s lawStudy guide
- Electric fields and Gauss’s lawStudy guide
- Electric potentialStudy guide
- Capacitance and dielectricsStudy guide
- Current and resistanceStudy guide
- DC circuitsStudy guide
- Magnetic fields and forcesStudy guide
- Electromagnetic inductionStudy guide
- AC circuits and electromagnetic wavesStudy guide
Try it with your own material
Upload a PDF, slides or notes and study the deck in minutes. Making your own cards is free with no limits.