# The Mathematics of the Library

This post serves as a companion piece to my essay Imagining the Unimaginable: How Borges’ “The Library of Babel” Relates to Multiverse Theory. It serves no other purpose than to host and explain all of the mathematics used in that essay. Also please note that all of the math present here (with the exception of Appendix IV: Sizable Collections) is not my own work, but is instead the work of William Goldbloom Bloch, who discusses the amazing mathematical properties of the library in his book The Unimaginable Mathematics of Borges’ Library of Babel. If you’re at all interested in mathematics, I highly recommend this book as it’s a profoundly interesting read.

Appendix I: The Number of Books

During the course of his story, Borges’ gives us crucial information. Not only does he inform us that all of the library’s books follow the same format, but he gives us the exact numbers we need. He tells us:

“…each book is of four hundred and ten pages; each page, of forty lines, each line, of some eighty letters which are black in color.”

He also tells us that all books use the same twenty-five characters, those being twenty-two letters, the period, the comma, and the space. We can use this information to our advantage with a field of mathematical study known as Combinatorics. Combinatorics is the study of combinations of objects within a finite set while following specific guidelines. To show what we’re going to do, I would like to begin instead with a set of ten symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. If there were but a single slot to fill with one of these symbols, how many possibilities exists?

The answer, naturally enough, is ten. Now, what if we were to fill two slots, and repetition of the same symbol is allowed — how many possible combinations would exist?

Of course, the answer is 100, or 10^2. Now, what if we were to fill three slots in this same manner?

We find that there are 1000 combinations, or 10^3.

By now, a pattern is beginning to emerge. We find that in finite sets of symbols with repetition allowed, we can determine the number of possible combinations by using an exponent B^n, where B is the number of symbols in our finite set and n is the number of symbols we’re using for each combination, or rather the number of slots we need to fill with symbols.

So, we know that there are twenty-five characters in all of the library’s books, and we know that repetition of characters must certainly be allowed, and we know that all books contain 1,312,000 characters (this is achieved simply by multiplying the numbers we were given: 410 pages, 40 lines per page, 80 characters per line; 410 * 40 * 80 = 1,312,000). Therefore, we can conclude that there are 25^1312000 books within the library.

Appendix II: The Size of the Collection

To put the massive size of the library’s collection into perspective, we can compare it to the size of the universe. Based on modern research, we can give an overgenerous upper bound to the size of our universe, which we’ll present as a cube with dimensions equally measured as 10^27. Such a cube would have a volume of 10^81 cubic meters.

Next, we need to convert the number of books in the library from a base of 25 to a base of 10. Using a logarithm, we can easily make the conversion thanks to the logarithm’s properties concerning exponents.

So, we now have the number of books in the library as an exponent with a base of ten, and we have the volume of the universe as an exponent with a base of ten. If we assume we can fill 1000 or 10^3 books into a cubic meter, which is an incredibly generous assumption, how many books could we fill in the entire universe? Thankfully, such a calculation is incredibly easy; two exponents that share the same base can be easily multiplied or divided by adding or subtracting the powers of those exponents respectively.

Despite our overly generous assumption about the size of the universe, and despite our incredibly generous assumption about how many books can be fit into a cubic meter, we still find that the universe can’t even hold a fraction of the books in the library’s collection. In fact, we find that the number of universes of this one’s size required to hold the entire library’s collection is:

A reminder that the number presented above is far bigger than it actually appears. Remember that in the case of exponents with a base of ten, the number that exponent actually represents starts with the digit 1 and is followed by 1,834,013 zeros.

Appendix III: Misprints

Given that the library’s collection is total, we know that misprint copies of otherwise perfect books must exist, but the question is how many misprint copies are there? First, we need a way to calculate the number of books based on what the misprinted character actually is. If the character in question is supposed to be an “I,” that’s one correct character that has been misprinted as one of twenty-four incorrect characters. All possible incorrect characters must be accounted for.

Next, we require a way to calculate the number of books based on where the misprinted characters are located within the book. Remember that a single misprinted character could be located in any one of the book’s 1,312,000 slots.

Therefore, it follows that both of these things should be included in the same formula, multiplying the two to account for the total number of misprinted copies of the book based on the number of misprinted characters in question. In the case of a single misprinted character, the calculation is simple.

Once a second misprinted character is introduced, our formula must be adjusted just ever so slightly. Given our knowledge of combinatorics, we know that we can easily turn the first half of our formula into an exponent to represent all of the combinations of misprinted characters. As for the second half of our formula, we require a way to determine the combinations of slots in the book where the misprinted characters are located without allowing for repetition (both misprinted characters can’t be located in the same slot). Combinatorics provides us with a binomial coefficient that does this wonderfully. Now our formula appears as

Where M is the number of copies of the misprinted book, and k is the number of misprinted characters in question. Now, we can easily determine how many copies of our book exist with two misprinted characters.

Now with three.

As we can see, the number of books in question grows exponentially with each new misprinted character.

Appendix IV: Sizable Collections

We still possess the number of books in the library’s collection with a base of 10 from earlier, so comparing this number with the calculated number of universes in the multiverse is simple. If it matters that humans be able to distinguish one universe from another, then the number of universes in the multiverse is:

Or:

And if it doesn’t matter that humans be able to distinguish one universe from another, then the number of universes in the multiverse is:

Or:

In either case, the number of universes in the multiverse completely overshadows the number of books in the library.