# Calculating the magnetic field around a current-carrying wire of arbitrary length using Maxwell's Equations

Hello I'm trying to use Maxwell's Equations to calculate the electromagnetic fields around different charge/current situations like from a charge using $$\nabla \cdot E = \frac{\rho}{\epsilon_0}$$ to obtain Coulomb's Law. One area I'm getting stuck on however is the magnetic field around a current-carrying wire of finite length. I know how to do this with the Biot–Savart law for wires of many shapes, but I can't seem to figure it out starting from just the Ampere-Maxwell equation: $$\nabla\times B=\mu_0(J+\epsilon_0\frac{\partial E}{\partial t})$$. I'm not sure how I can incorporate wire length into these equations and I keep getting the equation for a wire of infinite length.

Here's my general process:

There is a straight wire with length $$l$$ and radius $$r$$ carrying a current $$I$$. We want to find the strength of the magnetic field $$B$$ at a distance of $$x$$ from the center of the wire. The point is aligned vertically with the line so that the distance between the point and either ends of the wire are equal.

We start off with the Ampere-Maxwell equation:

$$\nabla\times B=\mu_0(J+\epsilon_0\frac{\partial E}{\partial t})$$

We can drop $$\epsilon_0\frac{\partial E}{\partial t}$$ since the electric field does not change.

$$\nabla\times B=\mu_0 J$$

The current density $$J$$ is expanded to $$\frac{I}{\pi r^2}$$:

$$\nabla\times B=\frac{\mu_0 I}{\pi r^2}$$

To find $$B$$ we can use Stokes' Theorem, showing that the magnetic field along the circumference $$L_1$$ of a circle $$A_1$$ is found by integrating the magnetic curl within that circle (assuming symmetry):

$$\int_{L_1} B_1 \cdot dL_1 = \iint_{A_1} \nabla \times B \cdot dA_1$$

In the above diagram, the circle has the radius $$r$$ and is positioned in the center of the wire, so solving for $$B_1$$ should give us the magnetic field at the surface of wire. To find it at a distance of $$x$$, we use the fact that there is no current outside the wire. In other words, the curl within in the wire is $$>0$$ and anywhere outside of it is $$=0$$. Therefore, for any radius $$>r$$ of the circle, the integral within it will be constant and equal to that of circle $$A_1$$.

So if we have a second circle $$A_2$$ with radius $$x$$:

$$\int_{L_1} B_1 \cdot dL_1 = \iint_{A_1} \nabla \times B \cdot dA_1 = \iint_{A_2} \nabla \times B \cdot dA_2 = \int_{L_2} B \cdot dL_2$$

$$\iint_{A_1} \nabla \times B \cdot dA_1 = \int_{L_2} B \cdot dL_2$$

Assuming perfect symmetry, $$B$$ and $$\nabla \times B$$ are constant within the integral so can be pulled out:

$$\nabla \times B\iint_{A_1} dA_1 = B\int_{L_2} dL_2$$

Solving for $$B$$

$$\frac{\mu_0 I}{\pi r^2} \cdot \pi r^2 = B \cdot 2 \pi x$$

$$\mu_0 I = B \cdot 2 \pi x$$

$$B = \frac{\mu_0 I}{2 \pi x}$$

However, this is the equation for the magnetic field around a wire of infinite length. I'm trying to find one for length $$l$$. I'm at a complete loss as to where in the previous steps I would use $$l$$. Also why is an infinite wire the result of these steps, nowhere did I specify the length of wire.

What I'm asking is, starting from the last Maxwell equation, how would I calculate the magnetic field around a wire of finite length? What am I doing wrong? Any help/insight would be appreciated.

A finite segment of current by itself is inconsistent with Maxwell’s equations. Specifically, it violates the continuity equation. So you will not be able to find such a solution.

You will either need to have the current go in a loop or have a changing charge density at either end of the wire. The changing charge density will produce a changing E field which in turn will induce a magnetic field. It is this field that distinguishes the finite and the infinite case.

• Thanks for answering. Where can I read more about the continuity equation? I didn't know it even existed. Also, how would I calculate the field in the center of a circle of current?
– nreh
Apr 11, 2021 at 2:21
• @Xertz you can read more about the continuity equation here google.com/amp/s/www.wikihow.com/… Regarding the field in the center of a circle of current that is far too big of a topic to provide in comments. You should ask a full question, although I would recommend checking for duplicates first.
– Dale
Apr 11, 2021 at 3:16
• +1. Maxwell’s Equations are not sufficient for a classical theory of electromagnetism. Apr 11, 2021 at 3:56
• @Gilbert Okay now I'm even more puzzled. I've always assumed that Maxwell's Equations are the foundation of classical electromagnetism and that you can derive all other formulas such as Coulomb's Law or Faraday's Law, and even the Biot-Savart law. Could you please elaborate, where could I learn more about this? I've been using Wikipedia and physics websites for most of my learning, and nowhere have I read this.
– nreh
Apr 11, 2021 at 20:23
• @Xert, You need Maxwell's Equations, the Lorentz Force Law, and all of the constitutive relationships for any matter. Maxwell's equations alone are insufficient. And, of course, you also need boundary conditions as always. But Maxwell's equations are often justifiably described as the foundation of classical EM. Those other equations are more ancillary, but still necessary.
– Dale
Apr 11, 2021 at 23:13