If you line up the entire text  of “Moby Dick,” which was published in 1851, into a giant rectangle, you may notice some peculiar patterns: like these words, which seem to predict the assassination of Martin Luther King. Or these references  to the 1997 death of Princess Di. So, was Herman Melville a secret prophet? The answer is no, and we know that thanks to a mathematical principle called Ramsey theory. It's the reason we can find geometric shapes in the night sky, it's why we can know without checking that at least two people in London have exactly the same number  of hairs on their head, and it explains why patterns can be found in just about any text... even Vanilla Ice lyrics. So what is Ramsey theory? Simply put, it states that given enough elements in a set or structure, some particular interesting pattern among them is guaranteed to emerge. As a simple example, let’s look  at what’s called the Party Problem— a classic illustration of Ramsey theory. Suppose there are at least six people at a party. Amazingly enough, we can say for sure that some group of three of them either all know each other, or have never met before, without knowing a single thing about them. We can demonstrate that by graphing out all the possibilities. Each point represents a person, and a line indicates  that the pair know each other. Every pair only has two possibilities: they either know each other or they don't. There are a lot of possibilities, but every single one has the property  that we're looking for. Six is the lowest number of guests where that's guaranteed to be the case, which we can express like this. Ramsey theory gives us a guarantee that such a minimum number exists for certain patterns, but no easy way to find it. In this case, as the total number of guests grows higher, the combinations get out of control. For instance, say you're trying to find out the minimum size of a party where there's a group of five people who all know each other or all don't. Despite five being a small number, the answer is virtually  impossible to discover through an exhaustive search like this. That's because of the sheer  volume of possibilities. A party with 48 guests has 2^(1128) possible configurations, more than the number of atoms  in the universe. Even with the help of computers, the best we know is that the answer to this question is somewhere between 43 and 49 guests. What this shows us  is that specific patterns with seemingly astronomical odds can emerge from a relatively small set. And with a very large set, the possibilities are almost endless. Any four stars where no three  lie in a straight line will form some quadrilateral shape. Expand that to the thousands  of stars we can see in the sky, and it's no surprise that we can find all sorts of familiar shapes, and even creatures if we look for them. So what are the chances of a text concealing a prophecy? Well, when you factor in  the number of letters, the variety of possible related words, and all their abbreviations  and alternate spellings, they're pretty high. You can try it yourself. Just pick a favorite text, arrange the letters in a grid, and see what you can find. The mathematician T.S. Motzkin  once remarked that, “while disorder is more probable  in general, complete disorder is impossible." The sheer size of the universe guarantees that some of its random elements will fall into specific arrangements, and because we evolved to notice patterns and pick out signals among the noise, we are often tempted to find intentional meaning where there may not be any. So while we may be awed by hidden messages in everything from books, to pieces of toast, to the night sky, their real origin  is usually our own minds.