**Required math: calculus**

**Required physics: electrostatics & magnetostatics**

Reference: Griffiths, David J. (2007) Introduction to Electrodynamics, 3rd Edition; Prentice Hall – Problem 5.17.

We calculated the magnetic field of a solenoid with a circular cross-section and found that, for an infinite solenoid

where is the number of turns per unit length and is the current flowing through the wire wrapped around the cylinder.

We can actually find the magnetic field of an infinite solenoid of any cross-section, provided that cross-section is constant over the entire length. First, we use the Biot-Savart law to find the direction of the field. We’ll choose a rectangular coordinate system such that the axis of the solenoid is parallel to the axis. This means that the cross-section of the solenoid is parallel to the plane, so the current has no component (well, OK, it does have a very slight component since the wire is wound as a helix and current does flow down the length of the solenoid, but we can assume here that we’ve got an idealized solenoid where the current flows in closed loops around the axis). That is

Now pick a point on the solenoid at position . If we put the observation point in the plane, then it has coordinates . Then the Biot-Savart law says that the contribution to the magnetic field from a line element at point is

The cross product is what interests us, and we get for the current element under consideration

Because of the symmetry of the solenoid, there is a point on the solenoid at position which has the same current and (since has no component) the same value of . Thus the only difference is that the sign of has changed, so we get

When we add the contributions from these symmetric elements, only the component is left, so we conclude that the field must be entirely in the direction.

The magnitude of the field could be worked out from the Biot-Savart law if we knew the shape of the cross-section, but using Ampère’s law, we can choose a rectangular loop of unit length parallel to the plane. If this loop has both edges outside the solenoid, with the nearer edge in the plane and the farther edge at , then there is no enclosed current so since the contribution from the two edges parallel to the axis cancel (the path along one of these edges is equal and opposite to the path along the other), we get

That is, the field outside the solenoid is constant. At this point, the assumption is made that the field must go to zero at infinite distance (something that doesn’t sit quite right, since we are dealing with an infinite solenoid after all, but anyway) therefore be zero everywhere outside the solenoid.

Inside the solenoid, we could set up another loop that doesn’t cross the current and conclude again that the field inside is also constant. To get its magnitude, we use a loop that *does* cross the current, with one edge inside and one outside. The enclosed current for a unit length is and the only edge that contributes to the line integral is the edge inside the solenoid so we have

Thus the magnetic field inside an infinite solenoid is independent of the cross-sectional shape.

Using a similar technique (example 5.10 in Griffiths), it is possible to show that the magnetic field inside a torus-shaped solenoid (again, the cross-section doesn’t matter) is

where is the radial distance from the axis of the torus, if this places the observation point inside the torus (the field is again zero outside). In this case, the field inside is not constant, but falls off linearly with distance from the axis. For a torus with a radius large compared with its cross-sectional dimensions, we can take to be essentially ‘the’ radius of the torus, so that and the formula reduces to that for a linear solenoid.