Friday, December 7, 2012

Library of Babel

Jorge Luis Borges' short story Library of Babel conceives of a library comprised of all possible books.  Specifically, all possible permutations of 25 characters (22 letters, comma, period, space) within books with 410 pages.  (Each page has 40 lines; each line has 80 characters).  This set of books would contain all books written so far (spanning multiple volumes if needed), along with all books that could possibly be written in the future.  The majority of the books in the library would be gibberish, of course.

A few questions, ordered from easy to hard:

  • How many books are in The Library of Babel?

  • How much space would this set of books consume (let's ignore the rooms and shelves, and just stack the books, which measure, say, 6 in. x 4 in. x 1.5 in. )?

  • What proportion of the books would read coherently from start to finish?

In this library, there would be a book explaining the solutions to each of these questions!

1 comment:

  1. Fun problem! We have 3200 characters per page x 410 pages, with 25 possibilities for each gives 25^(3200*410) books. That's a little awkward, but observing that 25^5 is appoximately 10^7 means there's approximately 10^(7*640*410) or 10^1836800 books. Hmmm... a googol is 10^100. That's a lot of googols, so we know we're in trouble already.

    So, each book is 6" x 4" x 1.5"... easier to use metric I think so it's 15 cm x 10 cm x 3.75 cm = 562 cm^3. There's 1,000,000 cm^3 in a cubic meter, so that 0.000562 m^3 per book. That seems manageable.

    Total space needed then is 10^1836800 * 0.000562, or approximately 5*10^183796 m^3

    The diameter of the known universe is about 8.8 x 10^26 meters. Let's call it a sphere (why not?) with volume 6.26*10^81 m3. Hmmm... the universe is a little small. Let's bring in a few extra universes. Dividing, we find we only need about:

    10^1836715 universes to hold this number of books. Maybe I'm a few zeros off. It doesn't seem to matter much though, does it?

    How big would the search engine have to be to find the book you want?