On this page
A compass needle turns when a steady current flows in a wire nearby. That is Ørsted's old discovery. A less familiar fact is that the pattern of turning across a flat surface tells you how deep the wire lies below it. If you slide a compass sideways across the line of the wire, the needle turns most when it is right above the wire, and the turning fades on either side. The width of that fading is set by the depth. This idea is the subject of EuPhO 2021 Experimental Problem E1, "Hidden wire", a simulated compass survey, with the problem and official solution. Here is the physics, worked with our own numbers.
This post is physics only. Never dig near buried cables, and never try to locate one yourself. If you need to know where a cable runs, contact the utility company or the local authorities.
What field does a buried wire make at the surface?
A long straight wire carrying current I makes a field B = μ₀I/2πr at distance r, in circles around the wire. The 1/r law and its graph are covered in the magnetic field of a straight wire, so here we use it directly.
Put the wire at depth h, and measure x sideways along the surface from the point straight above it. Then r = √(h² + x²). The field at the surface is tangent to the circle through that point, so it is tilted. Only part of it is horizontal.
Why does only the horizontal part matter to a compass?
A compass needle can turn only in a horizontal plane, so it responds only to the horizontal part of the field. The field is perpendicular to the radius from the wire, and a little geometry gives its horizontal component as B × (h/r):
B_h = μ₀Ih / [2π(h² + x²)]
Straight above the wire (x = 0) the field is entirely horizontal and B_h = μ₀I/2πh. Off to the side, the field tilts and weakens at the same time, so B_h falls off faster than B.
Now let the wire run north–south. Then B_h points east or west, at right angles to Earth's horizontal field B_E. The needle lines up with the total horizontal field, so its angle φ from north obeys
tan φ = B_h/B_E
This is the tangent law you know from the tangent galvanometer. For why a current turns a needle at all, see why a compass needle deflects near a current-carrying wire.
Why does the width of the curve give the depth?
Divide tan φ at x by its peak value at x = 0:
tan φ(x)/tan φ(0) = h²/(h² + x²)
At x = h this is exactly 1/2. So the full width of the tan φ curve at half its height is 2h. A shallow wire gives a sharp, narrow peak; a deep wire gives a low, broad one.
You do not even need the whole curve. Readings at two points are enough, because
tan φ(0)/tan φ(x) = 1 + x²/h², so h = x/√(ratio − 1)
Worked example: a wire 5 cm deep
Take a laboratory setup like the olympiad's: a long wire 5.0 cm below a flat surface, running north–south and carrying a steady 4.0 A. Earth's horizontal field depends on where you are. The IGRF-14 model, from the BGS field calculator, gives about 34 µT in Delhi and 41 µT in Chennai for 2026. We use 35 µT.
Straight above. B_h = μ₀I/2πh = (2 × 10⁻⁷ × 4.0)/0.050 = 16 µT. tan φ = 16/35 = 0.457, so φ = 24.6°.
5 cm to the side. B_h = 16 × 0.05²/(0.05² + 0.05²) = 8.0 µT. tan φ = 0.229, exactly half the peak, and φ = 12.9°.
15 cm to the side. B_h = 16/10 = 1.6 µT, and φ = 2.6°.
Depth from two readings. The ratio of tan φ values at 0 and 15 cm is 0.457/0.0457 = 10, so h = 15/√9 = 5.0 cm. Correct.
Earth's field as a bonus. Once h is known, B_E = μ₀I/(2πh tan φ₀) = 8 × 10⁻⁷/(0.050 × 0.457) = 35 µT.
A deeper wire. At 10 cm and the same current, the peak is only 8.0 µT, or 12.9°, and the half point moves out to 10 cm.
Units check. μ₀I/h is in (T m/A) × A/m = T, as it should be.
The official solution takes the opposite route: it holds the compass at fixed points and changes the current, which turns the data into straight-line graphs. From those it finds h = 5.0 mm and B_E = 4.0 × 10⁻⁵ T, matching the values built into the simulation.
Why reverse the current?
Earth's field is always there, and the needle points along it before any current flows. Reversing the current flips B_h, so the needle swings to the other side of north. Only the wire's part of the reading changes sign, so comparing the two readings separates the wire's field from Earth's and from small fixed errors in how the compass is set down. The official solution uses currents of both signs for exactly this reason.
Why can't a compass find a real household or street cable?
There are three reasons, and they are good physics.
Mains power is AC. Supply in India alternates at 50 Hz. The field reverses 100 times a second, its average is zero, and a compass needle is far too slow to follow it.
Currents come in pairs. A real cable carries the outgoing and return current side by side, so their fields almost cancel a short distance away. Our formula assumes a single wire with no return current nearby.
Depth weakens the signal. Even a single DC wire 0.5 m deep carrying 10 A gives only 4.0 µT straight above it, a turn of 6.5°, easily swamped by nearby steel.
Cable locating is specialist work that uses different equipment, and digging near cables is dangerous. Leave it to the utility or the authorities.
Problems on the field of a straight wire, Earth's field and the tangent law come up in JEE Main and JEE Advanced. Fermi Test Prep offers personalised preparation for JEE Main & Advanced with an AI tutor, live classes, adaptive mocks, mentorship and a study plan that updates based on mastery. For the bridge method used to find faults along a cable, see the Murray loop test.
Quick checklist
A compass sees only the horizontal field: B_h = μ₀Ih/[2π(h² + x²)].
For a north–south wire, tan φ = B_h/B_E.
tan φ falls to half its peak at x = ±h, so the half-height width is 2h.
Two readings give h = x/√(ratio − 1).
Reverse the current to separate the wire's field from Earth's.
A compass cannot find AC cables. Never dig near buried cables; contact the utility or the authorities.



