This demonstration was designed and built by a group of students in the PHYS 13H class at UCSB.

The idea of magnetic levitation is quite fascinating. In 1839, Samuel Earnshaw presented a paper to the Cambridge Philosophical Society, in which he showed that it is impossible to place a collection of bodies, subject only to electrostatic forces, in such a way that they remain in a stable equilibrium configuration. This is now known as Earnshaw's Theorem. You can see a copy of the original paper here. The actual reference is Transactions of the Cambridge Philosophical Society, 7 (1842), p. 97. The paper at the link above is an excerpt from the whole volume, which is available from Google Books here. (The title is “On the Nature of the Molecular Forces which regulate the Constitution of the Luminiferous Ether.”) As you might guess, this theorem also applies to magnetic forces as well. In fact, it is true for any force that varies with the inverse square of distance, or any combination of such forces. (You can, however, trap ions to move around in a stable trajectory by means of a static magnetic field with a static electric field, as in a Penning trap, and if you can generate a strong enough magnetic field, you can take advantage of a material’s diamagnetism to levitate it. See demonstrations 68.69 -- Magnetic materials, and 72.10 -- The Meissner effect.) An explanation of Earnshaw’s theorem follows a description of this demonstration.

How this demonstration works:

There are several ways by which one can avoid the consequences of Earnshaw’s theorem. One way is to use fields that vary with time, as in the Paul ion trap, in which one can keep ions in a stable orbit by using RF electric fields. In a mesmerizing novelty toy called the Levitron®, a magnetic rotor floats above a static magnetic field, stabilized by coupling of its rotational motion to the field. Prof. Martin D. Simon at UCLA has posted links to information on the Levitron®, including two interesing papers on the physics, here. Another way is to use feedback and control, which is how the apparatus in the photograph above works. At the top is an electromagnet, which comprises a coil of copper wire wound around a 3/8″-diameter ferrite core. The bob, floating below the electromagnet, is made of a ping pong ball with two rare-earth disc magnets glued to it at opposite poles. The magnet on top is attracted by the field of the electromagnet. Inside the copper pad below the bob is a Hall probe, whose output current depends on the strength of the magnetic field due to the magnet on the bottom of the bob. (See demonstration 68.57 -- Hall effect.) At the base of the unit is an Arduino Duemilanove microcontroller, which monitors the Hall current from the probe and adjusts the current through the electromagnet accordingly. If the bob begins to fall, the magnetic field at the Hall probe increases, also increasing the Hall current. The microcontroller responds by increasing the current through the electromagnet (which it drives via a power transistor), pulling the bob upwards. If the bob rises too far, the decreasing field at the Hall probe causes the Hall current to decrease. In response, the microcontroller lowers the current through the electromagnet, allowing the bob to fall. The probe and microcontroller are capable of responding to small enough changes in the magnetic field from the bob, that the bob never moves very far from its equilibrium position, and it appears to hang in one spot. (If you look closely, or gently feel the bob, you can tell that it is quickly jiggling up and down over a very small distance.) A small, white LED light, mounted on the plate that holds the coil, illuminates the bob for effect.

Earnshaw’s theorem:

Perhaps the most direct way to arrive at Earnshaw’s theorem is via Gauss’s theorem (or the divergence theorem) and the expression for flux. Gauss’s theorem states that as the number of surface elements approaches infinity, and the size of the individual volume elements approaches zero, the surface integral of a function, F, over a volume, V, gives the integral of the divergence of F over that volume, or

S F · da = ∫V div F · dv, or, for the electric field, ∫S E · da = ∫V div E · dv.

Since Gauss’s law states that ∫S E · da = 4π ∫V ρ dv, we have div E = 4πρ.

(div F = ∇ · F, which is (i ∂/∂x + j ∂/∂y + k ∂/∂z)F · (iFx + jFy + kFz) which equals (∂Fx/∂x + ∂Fy/∂y + ∂Fz/∂z).)

The electric field is the negative gradient of the potential, or E = -∇V

(V is not to be confused with the aformentioned volume. ∇F = (i ∂/∂x + j ∂/∂y + k ∂/∂z)F.)

Putting these two equations together, we have -div grad V = 4πρ, or ∇ · V = -4πρ, or ∇2 V = -4πρ. (∇2 = (∂2/∂x + ∂2/∂y + ∂2/∂z), and is called the Laplacian. This last equation, ∇2 V = -4πρ, is called Poisson’s equation.) In a region where there are no charges, 4πρ = 0,
and -∇2 V = 0. This equation is called Laplace’s equation.

There are perhaps several ways of interpreting these equations to arrive at Earnshaw’s theorem. Edward M. Purcell (in Electricity and Magnetism; Berkeley Physics Course, Volume 2) notes that an interesting property of potential functions that satisfy Laplace’s equation (a class called harmonic functions) is that their average over the surface of any sphere, not necessarily a small one, equals their value at the center of the sphere. We can imagine a sphere with a point charge, q, outside it, and a quantity of charge, q′, evenly distributed over it. The work required to bring the charge q′ and distribute it on the sphere is q′ multiplied by the average potential over the sphere due to the charge q. The work should be the same if we had the charge q′ on the sphere first, and then brought in q from infinity, but if we did that, it would also be the same as if the charge q′ were concentrated at the center of the sphere. Thus the potential at the center of the sphere equals the average potential over the whole sphere. Since potentials of multiple charges merely add, this must also be true for any collection of charges that lie outside our sphere.

For a system to be in stable equilibrium, it must be in a potential energy minimum. (See demonstration 32.20  Neutral, stable and unstable equilibrium.) What does this have to do with our sphere? If we imagine that there is a point P at which a charged particle would be in stable equilibrium, this means that if we displace the particle in any direction, it should experience a restoring force pushing it back towards P. This would require that the electric field point inwards towards P from every direction, or outwards in every direction from P, depending on the sign of the charge on our particle. This is impossible unless there is a charge at P (besides our test particle). What this means for the electrical potential is that it would have to be either higher or lower at P than at all points surrounding P. For a function whose average value over a sphere equals its value at the center, this is not possible.

It is possible for a charged particle to be in equilibrium in an electric field, just not a stable one. For example, a positive or negative charge placed midway between two equal positive charges is in equilibrium, but if it is positive, displacing it in a direction perpendicular to the line between the other two charges causes it to travel along this line, away from the two charges, and if it is negative, then displacing it towards either positive charge sends it towards that postive charge.

You can find explanations of Earnshaw’s theorem here and here.

References:

1) Purcell, Edward M. Electricity and Magnetism (New York: McGraw-Hill Book Company, 1965) pp. 53-62.