# How Big is the Library of Babel?

One of my favorite short-story authors is the Argentinean writer Jorge Luis Borges. Many of his stories deal with mind-expanding themes, including "Blue Tigers", about a handful of stones that do not obey the rules of mathematics, "The Book of Sand", about a book with an infinite number of pages, and "The Aleph", a point in space that allows one to observe all other points simultaneously.

However, Borges' most iconic short story is the one called "The Library of Babel", less a narrative with a plot than an extended thought experiment, about a race of people who live in a cosmos that is bizarre indeed. The universe in which these people (Babelians?) live is a vast, apparently endless honeycomb of interlocking hexagon-shaped rooms, each one with two hallways that connect it to other rooms on the same level and a spiral staircase connecting it to rooms both above and below. Every room's walls are occupied by bookshelves that are full of books. Most of the books are complete nonsense, nothing but random combinations of letters, but a few contain tantalizing hints of sense.

One which my father saw in a hexagon on circuit fifteen ninety-four was made up of the letters MCV, perversely repeated from the first line to the last. Another (very much consulted in this area) is a mere labyrinth of letters, but the next-to-last page saysOh time thy pyramids.

As Borges' narrator explains, the people of the Library of Babel have finally discerned the nature of their world, based on two observations: first, that every book uses the same twenty-five symbols for letters and punctuation; second, that no traveler has ever come across two exactly identical books. These people have come to the realization that the Library contains *all books* - that is to say, not just all books that have been written, not just all books that ever will be written, but all possible books, every single permutation of letters of a specified length.

Life in the Library is both a blessing and a curse. The vast - overwhelmingly, crushingly vast - majority of these books are total gibberish; but buried among them, somewhere, there are - there must be - books containing every truth that anyone could ever want to know.

Everything: the minutely detailed history of the future, the archangels' autobiographies, the faithful catalogues of the Library, thousands and thousands of false catalogues, the demonstration of the fallacy of those catalogues, the demonstration of the fallacy of the true catalogue, the Gnostic gospel of Basilides, the commentary on that gospel, the commentary on the commentary on that gospel, the true story of your death, the translation of every book in all languages, the interpolations of every book in all books.

There must be books that tell the true history of the Library of Babel, and explain how such a fantastic cosmos came into existence. There must be books that contain the truth about the existence, nature, and attributes of God. There must be books that tell the true biography of every individual's life, perfectly foretelling their every action from birth to death, if only there was a way to find them; Borges' narrator refers to these books as the Vindications. Of course, because this library contains all possible books somewhere, every such work of perfection will be undetectably camouflaged among an immense number of sinister counterfeits - books that tell you your life story in perfect detail up to the age of thirty, say, but diverge radically thereafter.

Though it is obvious that the Library of Babel must be vast, I did not appreciate just how vast it is until reading Daniel Dennett's discussion of it in *Darwin's Dangerous Idea*. Consider: according to Borges' description, each book in the Library is 410 pages; each page is made up of 40 lines each consisting of 80 positions, and there are 25 possible alphabetic symbols that can fill any of these positions. This works out to 410 x 40 x 80 = 1,312,000 positions per book, each of which can be filled in 25 distinct ways: 25 x 25 x 25... and so on, 1,312,000 times. In other terms, the Library of Babel contains 25^{(410x40x80)} = 25^{1,312,000} books. This is a number compared to which the number of atoms in our universe is infinitesimal.

Since it is all but impossible to get a handle on the size of this number, let us consider something more manageable: the number of variants of just one book, say, *War and Peace*. (I do not know if this book actually has something like the 1,312,000 characters possessed by each book in the Library of Babel, but say for the sake of argument that it does.) In all the vast Library there is only one book that replicates it exactly as it was written by Tolstoy. But how many slight variants are there, versions that differ by just one character?

Again, there are 1,312,000 positions in the book, each one of which can differ from the canonical version in 24 ways (since the original character at that position can be replaced with any of the other characters). Thus there are 24 x 1,312,000 = 31,488,000 one-character variants. By the same logic, there are an incredible 991,493,388,288,000, or about 991 trillion, copies of this book that vary by just two characters (31,488,000 ways to vary one character, times 24 x 1,311,999 = 31,487,976 ways to vary a different character). The number of three-character variants is exponentially larger, and the number of four-character variants larger still; and then there are the versions that differ by five, by six, by seven... (Dennett points out that even a copy with several typos on each page would still be quite recognizable.) And none of this includes translations of the book into other languages, retellings of recognizably the same story in different words, abridged versions, summaries, versions with scrambled page order, versions with alternate endings, commentaries, commentaries on the commentaries, reviews, parodies, scholarly analyses, denunciations, deconstructions...

Just how big a number is this? The estimated volume of the observable universe is 10^{33} cubic light-years, or about 10^{87} cubic centimeters. Assume that the thickness of a sheet of paper is 0.1 mm, and that each sheet is of standard 8.5 x 11-inch dimensions (about 21.6 by 28 cm). Then the volume of a single book is 21.6 x 28 x (400 x 0.01) = about 2400 cubic centimeters. It would take 4.16 x 10^{83} such books to completely fill the volume of the observable universe. How many variants on *War and Peace* would this be?

Incredibly, all the books that were exact duplicates of *War and Peace*, save for a mere *twelve* or fewer single-character differences somewhere in the text, would more than fill the observable universe. (If you're not convinced of this, I've written a simple Java program that calculates the number of books in the Library of Babel that differ from a given book by X single-character changes. Download it here and check my math: BabelCalc.java). And the Library of Babel must contain these books, as well as all the other character variants, plus all the other relevant books mentioned above. The amount of space required to store all these near-duplicates - Tolstoy Space, let us call it - is, by many orders of magnitude, larger than the entire observable universe. And Tolstoy Space is just the infinitesimally small, vanishing fraction of Babel Space devoted to the variants of *one book*. Borges wrote that for every book in the Library there were "several hundred thousand imperfect facsimiles", but we can now appreciate just how much of an understatement that was.