This image by wavegrower [1] has been circulating, together with the question: "Will these jellyfish ever make it back to their original place?"

+Kimberly Chapman pointed out the obvious "yes, because it's an animated GIF and those loop." But here's something you might not expect: even if it weren't an animated GIF, even if these jellyfish were being moved around by a program using random numbers, I could guarantee that they always repeat.

(Or to be a bit more careful, if you watch it long enough, you'll always see

*a* repetition. It might not be the very first position that repeats [2])

Why? Let's imagine a simpler case for a moment, involving a 2x2 grid of jellyfish, each of a different color so we can tell them apart. There are 24 possible ways we could arrange the jellyfish: if you start with an empty grid, there are four places to put the red jellyfish; for each of those places, there are three remaining possible places to put the blue one; for each of those, there are two remaining possible places to put the green one; and once you've chosen those three, there's only one place the yellow one could go. So there are 4*3*2*1=24 possible jellyfish patterns. (Written 4!, "4 factorial")

Each time the jellyfish move, we move from one of these 24 configurations into another. As it happens, the motions below are very limited -- each jellyfish has to move onto a dot next door -- but that turns out not to matter, because even if the jellyfish could teleport, they'd still have to repeat.

Why? Imagine that we look at the first 25 moves. The jellyfish will end up in 25 configurations, but there are only 24 different configurations total, which means that at least one configuration had to happen twice!

This is called the

*pigeonhole principle:* if you have N+1 pigeons in N pigeonholes, at least one hole has to contain two pigeons. (In this case, you have 25 configurations in 24 distinct slots)

If the rule going from one configuration to the next is

*deterministic* -- that is, if the next move depends only on where the jellyfish are right now -- then you know that once a single repetitive loop happens, that loop will continue to repeat forever, because you're back at the first stage of the loop and will then have to go on to the second one, etc.

If the rule isn't deterministic -- say, if each time the jellyfish move randomly -- then a single repetition doesn't guarantee infinite repetition, but you still know that at least one pattern will appear at least twice in any sample of 25 patterns.

The same thing is true for this bigger grid; you just need to wait a bit longer. The 16x16 grid below has 256 jellyfish, so you need to wait for 256!+1 steps -- that's 256*255*...*3*2*1 + 1 steps, or about 8*10^506 steps [3] -- but no matter what, the jellyfish are absolutely guaranteed to repeat.

What's even more interesting is that this may apply to more than just jellyfish. One set of rules that we know are deterministic are the laws of physics. [4] Now, an interesting open question in physics is: is there a minimum granularity of spacetime, so that we can think of the entire universe as being on some kind of extremely fine grid? (When I say "extremely fine," I mean a grid size of the Planck length, about 1.6*10^-35 meters. For comparison, that's as much smaller than a proton as a proton is smaller than the San Francisco Bay Area.)

There are some reasons to believe that this may actually be true (although the geometry is a lot more complicated than a simple grid, and in fact "geometry" isn't even the right word for it; the whole expansion of the universe, from the big bang on, is part of it). If it is, then there's something interesting: we could imagine the entire universe as a gigantic grid, and the current state of the universe is given by deterministic laws about what's on that grid, then we know that

*the state of the universe itself* must ultimately repeat.

Of course, "ultimately" is a pretty long time horizon: if you think the number below is big, that's what we got with only 256 jellyfish. The total number of "jellyfish" needed to describe the universe is going to be something like 10^245, and so the number of moves it would take would be unimaginably huge.

But if this repetition is real, then it has some very interesting consequences. For example, it's one way to explain why we happen to observe physical constants in our universe that are consistent with the existence of human life. [5] If those "constants" are actually controlled by the state of the universe, and the universe ultimately steps through all possible states, then it isn't surprising that we'll look out the window and see the constants that we could survive in; when the universe was in all of those other possible states, we weren't around to see it.

If, on the other hand, the universe has infinitely many states in it, then no recurrence need ever happen; it can keep changing indefinitely, and the entire argument above falls apart. This is one of the very few times that "finite but very big" and "infinite" are meaningfully different in physics.

This sort of analysis is called an "anthropic" analysis, and while it seems unsatisfying in some ways -- it doesn't

*explain* the values of the constants, after all, or tell us what other constants might allow us to exist, it just tells us why they happen to be that right now -- it's a real possibility that this is what's actually going on. The entire debate over this, whether these recurrences (they're called Poincaré Recurrences, after the French mathematician who first described the math above) occur in nature and whether Anthropy is an explanation for the world, is a major open question in fundamental physics today.

So whether the jellyfish are moving in an animated GIF or powering the basic laws of physics, remember this: Finite patterns must always repeat; infinite patterns don't have to.

And now, you may return to staring at the GIF to your heart's content.

[1] Circulating uncredited, mind you. Wavegrower's work can be found at

wavegrower.tumblr.com, and is full of great math images like these. Those who like such things can also find some great ones at

beesandbombs.tumblr.com. Thanks to

+Don Yang for finding the original!

[2] Actually, for this picture we can prove that every state repeats, but the math gets a lot more serious. You can check out this post if you want to know more:

https://plus.google.com/+YonatanZunger/posts/h7aaNSANgVqAmong the things proved in that discussion was that if you have a system with finitely many states, and the rule that maps one state onto the next state is reversible -- that is, you can always tell from any state what the previous state must have been -- then every state is periodic and will repeat infinitely many times.

[3] If you want to be precise about it, it's 857,817,775,342,842,654,119,082,271,681,232,625,157,781,520,279,485,619,859,655,650,377,269,452,553,147,589,377,440,291,360,451,408,450,375,885,342,336,584,306,157,196,834,693,696,475,322,289,288,497,426,025,679,637,332,563,368,786,442,675,207,626,794,560,187,968,867,971,521,143,307,702,077,526,646,451,464,709,187,326,100,832,876,325,702,818,980,773,671,781,454,170,250,523,018,608,495,319,068,138,257,481,070,252,817,559,459,476,987,034,665,712,738,139,286,205,234,756,808,218,860,701,203,611,083,152,093,501,947,437,109,101,726,968,262,861,606,263,662,435,022,840,944,191,408,424,615,936,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,001 steps.

[4] You may have heard something about "quantum randomness," but this isn't actually randomness; the actual evolution of wave functions is completely, 100%, deterministic, even in quantum mechanics.

[5] The Standard Model of particle physics is controlled by about 20 basic constants, like the mass of the electron and the strength of gravity. Our world is weirdly sensitive to some of them: if the down quark were 10% heavier, say, then stars would never form, and neither would nearly any other kind of matter. What controls these 20 values? Good question. We don't know yet.