Einstein himself said that God doesn’t roll dice. But he was wrong. And in fact, anyone who has ever played role-playing games knows that God probably had to roll quite a few dice to come up with a character like Einstein.

—Larry Wall, creator of the Perl programming language

Last week, I introduced the idea of quantum states in terms of the polarization of light, which is one of the simplest quantum systems. Despite the length of the post, I could only begin to explain the mechanics of quantum mechanics, either conceptually or mathematically, so today I’m going to fill in a few details — and elaborate a bit more on randomness and indeterminacy.

A common misconception is that randomness means complete unpredictability, when nothing could be farther from the truth. If you flip a coin, it will come up heads about half the time, and tails every other time (Discworld aside). That’s incredibly predictable! Sure, any particular toss can’t be absolutely predicted in advance, but the probability of any single toss is unchanged.

Polarization is a little trickier, because we can’t know the probability of an individual photon getting through a polarizing filter. To recap: if you shine unpolarized light, such as might be emitted from a light bulb, onto a polarizing filter, only about half the photons get through. However, it’s not the same thing as a coin flip: if you send a single photon at the filter at a time, there’s no way to know what the probability was, only whether it got through or not. However, as with coin-flipping, if you repeat the experiment enough times, you’ll see that half get through.

So, how does this work?

### Why only half of photons get through a filter

Again referring back to last week’s post, we considered the case of a stream of unpolarized photons approaching a filter oriented vertically with respect to the lab we’re working in. (Yes, we’re in a lab! Hadn’t you noticed?) We’ll consider each photon to be randomly polarized: the angle of its spin could be horizontal, vertical, or anywhere in between, and we won’t know.

The probability of it getting through the filter is

where is the angle of the polarization compared to a horizontal line. (I’ll explain the details below, for those interested.) The sine function runs between -1 and 1, so when you square it, you get a number between 0 and 1. That implies the probability is between 0 and 100%, depending on the photon’s angle of polarization. By contrast, the probability of a perfect coin coming up tails is always 0.5, which means a 50% chance.

Now let’s assume we have more knowledge than we can ever actually have, and we know what the polarization angle of each photon is before it hits the filter.[**1**] With that godlike information, we can calculate whether it gets through or not. Here’s how it works:

- Take your favorite random-number generator and produce a number between 0 and 360. That’s the random angle of a single photon. I have several random-number generators I use for programs, but there’s also a good one online at Random.org.
- Calculate the sine of that angle (make sure your calculator is set for degrees!), and square it. That’ll give you a number between 0 and 1, which is the probability of that photon getting through.
- Now use your random number generator again to produce a decimal number between 0 and 1. If this number is
*less*than the probability you found in step 2, the photon gets through. If it’s greater than the probability, it doesn’t. - Repeat this process many, many times, keeping track of how many total photons vs. how many actually get through. The ratio of the number that successfully passed through the filter to the total number of photons is your average probability. (You can do this by hand, of course, but it’s going to be easier and less error-prone if you can program it into a computer or programmable calculator.)

The number you get in step 4 should be pretty close to 0.5, though unless you run for a very large number of photons, it probably won’t be *exactly* half.

The video above shows my implementation of the steps above for 200 photons, with about 5 photons added per second. The horizontal axis is the polarization angle, while the vertical represents the probability. The solid blue line is the probability function , while the green dots and red x’s represent the photons. Their horizontal position is the random angle produced in step 1, while their vertical position is the random number between 0 and 1 from step 3. If the photon gets through, I used a green dot; if it didn’t, I used a red x.

As you can see, the number didn’t end up being precisely 0.5, but once you’ve accumulated enough photons it stays pretty close to that value. The figure below shows the results of running 1000 photons, and you can see I got much closer to 0.5 — close enough that the difference is less than a hundredth of a percent.

So what did we do here? We showed that a very predictable result — half of photons from an unpolarized source get through a polarizing filter — can arise from random processes. In the real experiment, we don’t know the angle or the probability: we only know the outcome. However, this set of steps produces exactly what we see in the lab. Quantum physics works.The method we used above, by the way, is known as *Monte Carlo integration*, because we’re actually doing calculus, but we’re using random numbers (which is where the name “Monte Carlo” comes in, for the famous casino) instead of the stuff you might have learned in high school or college. Monte Carlo methods are very useful when you’re trying to accomplish complicated tasks without a clear answer in advance. In this case, we didn’t really need to do it this way, but I like how we can illustrate the principle of randomness in quantum physics.

I began the post with a quote about Einstein; let’s end the non-mathematical part with a quote from the late great paleontologist Stephen Jay Gould.

If you wish to understand patterns of long historical sequences, pray for randomness. Ironically nothing works so powerfully against resolution as conventional forms of determinism. If each event in a sequence has as definite cause, then, in a world of such complexity, we are lost….

The beauty (and simplicity) of randomness lies in the absence of these maximally confusing properties. Coin flipping permits no distinctive personality to any time or moment; each toss can be treated in exactly the same way, whenever it occurs. We can date geological time with precision by radioactive decay because each atom has an equal probability of decaying each instant. If causal individuality intervened—if 10:00 A.M. on Sunday differed from 5:00 P.M. on Wednesday, or if Joe the uranium atom, by dint of moral fiber, resisted decay better than his brother Tom, then randomness would fail and the method would not work.

—Stephen Jay Gould,Eight Little Piggies

### The mathy details

Now let’s step back and look at the math a little more. From the previous post, we noted that

is the quantum state for a single photon from an unpolarized source, where and* * are complex numbers. The individual pieces are the horizontal and vertical polarization states.

As above, we say that each photon has a random polarization angle measured with respect to a horizontal line, so that the angles of 0° and 180° both are horizontal, while 90° and 270° are vertical. We can write the quantum state “ket” as

(Technically we should also include a phase angle in the form , but it won’t have any effect on the outcome.) The corresponding “bra” is

Since the polarization states are orthogonal (you can’t have a photon that’s simultaneously vertically and horizontally polarized),

Now if we pass the random photon through a vertical polarizing filter, the act of measurement is represented by the projection operator

as in the previous post. Acting on our quantum state,

The probability of finding our photon in the vertically polarized state requires multiplying by the bra state:

This is the probability of a single photon getting through, but recall we don’t actually know its angle of polarization: we can’t go any farther with one particle.

However, we now have the tools to figure out how many photons will get through if we fire a large number at the filter. At this point, we can go two directions: we can use the Monte Carlo method as above, or we can finish using calculus. Since I already went through the Monte Carlo process, let’s see the calculus.

If we have a lot of photons each with a random polarization angle, we can reasonably assume over time that every angle will eventually be represented in our sample. That lets us average over all the angles to get the total fraction of photons getting through. This average is an integral:

where I’ve switched to radians for instead of degrees, since they are easier to use. (If you don’t know how to perform this integral, that’s another lesson!)

Arguably the Monte Carlo method is more correct, since integration effectively assumes we have an infinite number of photons representing every angle equally. However, we get the same answer both ways, so it’s hard to get too upset about it. The philosophical implications of the different kinds of math are fascinating, though, and include the question of whether quantum physics is truly compatible with the kinds of mathematical abstraction we use to describe it, or whether it just works well enough that we don’t need to worry our pretty little heads.

### Notes

- If this idea bugs you (e.g. if you’re a physicist who knows how much I’m cheating by letting us know the polarization angle in advance), try this instead: send light through a randomly oriented polarizing filter, so that each photon has a different random polarization. That will act more or less like unpolarized light, but will keep us from needing an impossible degree of knowledge.