The Good, The Bad, and the Physics of Gauss’s Law

I both love and hate Gauss’s Law. But before we get into my relationship with a physics equation, let me show you my original motivation for this post. I see this t-shirt sometimes with a Guass’s Law joke. It looks something like this.

Photo: Rhett Allain. Diagram based on a t-shirt.

The caption for this t-shirt says “No Flux Given”. I think there’s a couple of problems with this t-shirt, but it’s still fairly funny. I’m going to explain the error, but I need to first go over some stuff — in particular: electric flux and Gauss’s Law.

What the Flux?

There are a bunch of great jokes that use “flux”. But what is flux? What about a flux capacitor that makes time travel possible?

Photo: Universal Studios/Back to the Future. The Flux Capacitor

No, I don’t actually know anything about flux capacitors — but it’s a cool sounding name.

Even though we don’t have a flux capacitor, you can have all sorts of different kinds of flux. It’s not just electric flux. Let’s start with something that’s easier to visualize. What about rain flux? Rain flux is a measure of how much rain hits a surface.

Imagine that it’s raining and I have a board that is in the rain. Here is a diagram.

Diagram: Rhett Allain. Rain Flux

The rain flux really depends on three things:

  • The rate that rain is falling (I called this F-rain for the flow rate — it’s not a force). Notice that the rain rate IS a vector.
  • The size of the board (it’s the area, A).
  • The angle between the rain and a normal vector to the area (n-hat). We usually describe the orientation of a flat area with a vector that points perpendicular to that area.

So, if you increase the rain rate — you get more rain flux. If you make the area bigger — you get more rain flux. If you decrease the angle (θ) — you get more rain flux.

The electric flux is the same thing except with an electric field instead of rain. Also, the flux is just a mathematical thing. You don’t need a real surface to calculate the flux. It can just be an imaginary surface.

We can define electric flux as the following:

The flux is a scalar — it’s a measure of the electric field that passes through an area. However, the electric field is a vector and the area is a vector (sort of). So that means we use the dot-product of the two vectors to get the flux. If you want the other version of the dot-product, you can use the one with the cosine in it.

But what if the electric field is not a constant vector? What if the area isn’t just a plain flat rectangle? In that case, you need a better definition of the electric flux. How about this?

In this version, the flux is a surface integral of the electric field over the whole surface. I represent this as a double integral because that’s normally how you would do it. But you can think of this as an infinite sum of the electric flux through a bunch of infinitely small squares of size dA with orientation n-hat.

Maybe you can see why I don’t like Guass’s Law. It’s super complicated. It’s very likely that even students in the calc-based introductory physics class haven’t seen surface integrals yet. I pretty much guarantee that the algebra-based students haven’t uses surface integrals.

Gauss’s Law

Now for Gauss’s Law. I don’t want to do surface integrals, so I won’t. Instead I am going to do some numerical calculations in python. It will be more fun and more visually appealing.

Let’s put a square area (1 meter by 1 meter) near a point charge (0.5 meters from the square). I can’t just calculate the electric field and then multiply the area. That won’t work. Just consider two locations on the 1x1 square. Near the middle of the square, the electric field due to the charge is perpendicular to the area and this part of the square is closer to the charge — that means the magnitude of the electric field is as large as it can be.

Now think about a point near the corner. This corner is farther from the electric charge so that the magnitude of the electric field is smaller there. On top of that, the electric field is no longer perpendicular to the that part of the square. So, this means the flux in the corner of the square is less than the flux in the middle of the square.

What if I break this square into 81 smaller squares (9 x 9)? In that case, for each of these smaller squares the electric field is fairly constant and I can calculate the flux as:

Then the total flux will just be the sum of all the fluxes due to each square. Is fluxes even the plural of flux ?OK, check it out. Here is what that looks like.

Animation: Rhett Allain

If you add up the flux for the squares, you get a value of 18.91 V*m. This value will be useful in the next section.

Gauss’s Law

Let’s try something. What if I add a second square that is the same size as that first one, but a little bit closer to the electric charge. This second square won’t change the flux through the original square, but it will have it’s own flux.

For the first square, it has a unit vector for the area (n-hat) pointing to the left. This second square will have n-hat point to the right so that the two area vectors are pointing away from each other. But this will mean that the new square will have the n-hat in the opposite (mostly) direction as the electric field to produce a negative flux. I will make negative fluxes look blue instead of red. Here’s what that looks like.

I turned off the electric field arrows on the blue plate because it was too cluttered. Here are the calculated fluxes for the two squares and the total flux.

The fluxes are close to being opposite — but they aren’t. The charge has a smaller distance to the blue square such that it has a larger negative flux than the red square. But it’s not that much different.

Now imagine that you added four more surfaces between these two squares to close in the sides. If we define the n-hat vector as pointing away from the center of inside of the rectangular cube, then the flux on these sides would be small, but positive. It would make the total flux for this closed surface equal to zero. Wait. You don’t have to imagine it. This is what it looks like. Note: I moved the charge a little bit to get a better view.

Animation: Rhett Allain

But what about the fluxes? Here are the flux values for each side along with the total.

If you want my sloppy python code for that animation, here it is. However, the important part is the flux. Notice that the total flux is just about equal to 0 Vm. It’s not exactly zero because I made the assumption that the electric field is constant for each one of these smaller squares. Let’s just say that it’s zero.

As long as there is a single charge, the total electric flux over this closed surface will be zero Volt-meters. If you think of the electric field, it’s going into that first side (the blue) one to make a negative flux. All the other fluxes are positive. Even if you move the charge to another location that is outside the box, the flux is zero.

Check this out.

As long as there is zero net charge in the box, the total flux is zero. It’s wild.

OK, let’s put a charge INSIDE the box. No, I’m not going to put the charge in the center of the box. Instead, it’s in the upper corner.

You can see that the upper right corner has more solid squares representing a higher flux. But the total flux is now a positive value. Since the charge is inside the box, the electric field is always pointing in a direction similar to the area vectors so that the dot product will be positive.

If you add up all the fluxes, the total would be 115.754 Vm. That number actually has a special meaning. Recall that the electric field due to a point charge has a constant in it.

The term on the bottom is ε-0 (epsilon-naught). It’s the permittivity of free space with a value of:

Now for the fun part. If you take that flux and multiply by ε-0, you get:

Oh, that has units of Coulombs. Wait. What was the value of the charge I put in the box? Yup, it was 1 nC (or 1 x 10^-9 C). Yes, the flux multiplied by the permittivity of free space gives you the charge inside of the box — and the box isn’t even a real surface, it’s just a mathematical surface.

What happens if you make the box bigger? In that case, the electric field on each surface gets smaller since it will be farther from the charge. However, the total area is bigger. Guess what? You get the SAME FLUX!

In fact, it doesn’t matter where you put the charge, it doesn’t matter what size or shape of a surface you have (as long as its a closed surface). The total flux is proportional to the net charge inside the box. This is Guass’s Law.

Mathematically, it can be expressed as the following equation:

The integral with a circle just means “closed integral”. Since the integration variable is dA, this implies a surface integral over a closed surface. But we often just put one integral instead of two because nobody has time for that stuff.

OK, how about a bonus? Here is a box with two charges in it. There is a positive and a negative charge such that the total charge inside is equal to zero. What would the flux look like?

Animation: Rhett Allain

That’s pretty cool. The total flux isn’t exactly zero, but it’s close. Remember, I made an approximation for the flux calculation.

Double secret bonus. Gauss’s Law even works if you let the size of the surface shrink down to zero size. In that case, the equation would look like this.

The upside down triangle is the Del operator. It’s sort of like a derivative as a vector. The ρ (Greek letter rho) is the charge density — the charge per volume. But just in case you see this equation, it’s still Gauss’s Law.

Is Gauss’s Law Useful?

Well, it HAS to be useful — right? The answer is yes, it’s useful. I think the most important part of Gauss’s Law is that it’s part of Maxwell’s Equations. These 4 equations show the relationship between the electric and magnetic fields and that light is an electromagnetic wave traveling at the speed of light.

It can also be used to find the magnitude of the electric field for different charge distributions. But using it isn’t as obvious as many textbooks would like you to believe. Let me show how Gauss’s Law can be used to find the electric field due to a point charge.

Suppose I have a single charge with a value of q. If I have some idea about the field around this charge, I can choose a closed surface to calculate the flux. I know, that seems crazy — just hang on.

It seems reasonable to assume that the electric field is spherically symmetric and points away from a positive charge. Maybe something like this.

If all of these electric field vectors are pointing away from the charge AND I assume the magnitude is constant at a constant distance, then I choose a shape. If I put a sphere around this with a radius r, it would look like this.

Yes, it’s easier to model this in python (GlowScript) than it is to draw it. But now I can do a surface integral to calculate the flux. Seriously. This integral is so easy that I don’t even need to write it down.

At every point on this sphere, the electric field vector is in the same direction as the vector perpendicular to the surface. So, I can write it as this:

Since E is constant, I can pull it out in front of the integral. That leaves just the closed surface integral of dA which is just the area of a sphere.

Boom. That’s the flux. See, that was easy. Now I can set this equal to the total charge inside (which is just q) divided by ε-0 and then solve for E.

There you go. That’s the electric field due to a single charge — from Gauss’s Law. But wait. It’s not really the electric field due to a point charge. It’s just the magnitude of the electric field. Here is a better expression.

See? That’s a vector equation. But we cheated with the Gauss’s Law calculation. In order to use it, you have to already know something about the electric field. It’s still useful in many situations, but it doesn’t always work.

Just think what would happen if you chose a box around that charge instead of a sphere. The surface integral would be super hard (unless you did it my way).

OK, one last thing about Gauss’s Law. I don’t think it should be a major focus in algebra-based physics courses. If you don’t know anything about surface integrals, it’s just a magic trick.

What About That T-Shirt?

I made a version of this shirt on my chalkboard drawing above. It shows a box with a seemingly constant electric field going into and out of the box. Next, it has this equation.

Below that, it says:

No Flux Given.

I sort of “get it”, but not really. Here are my issues.

  • The flux is indeed given. The diagram shows a positive flux plus a negative flux that appears to be equal and opposite. The flux would be 0 Vm.
  • The flux is given again. The equation for the flux says it right there — equal to zero.
  • What the heck is that equation? It has q and dA. Shouldn’t that be E*dA or something? Shouldn’t there be a vector in there? Is q the charge? Help.

How about a different version of this flux-joke? Here is my t-shirt idea.

Photo and Drawing: Rhett Allain

Guess what the caption for this shirt would be. Go ahead…guess.

Fine, here it is:

Flux You.

Ha! Wait, just I just go over the math behind Gauss’s Law just for this silly flux joke? Yup.

Physics faculty, science blogger of all things geek. Technical Consultant for CBS MacGyver and MythBusters. Former WIRED blogger.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store