KeithSchwarz.com  Back  Forward 
The Magic Boxes is an example of using binary numbers to express decimal numbers. That is, expressing numbers as sums of powers of two.
Any number can be expressed as the sum of powers of two. In fact, this principle is the reason that the binary number system works. The binary number system is also known as "base 2," and is the way that computers can perform complex arithmetic so simply. To explain how it works, we first will discover how our number system works. We as humans work in base 10. That means that each successive digit in a number is another power of 10. For example:
147
= 100 + 40 + 7
= (1 x 100) + (4 x 10) + (7 x 1)
= (1 x 10²) + (4 x 10) + (7 x 10^{0})
54
= 50 + 4
= (5 x 10) + (4 x 1)
= (5 x 10) + (4 x 10^{0})
9523
= 9000 + 500 + 20 + 3
= (9 x 1000) + (5 x 100) + (2 x 10) + (3 x 1)
= (9 x 10³) + (5 x 10²) + (2 x 10) + (3 x 10^{0})
So what is binary? There is but one difference between our decimal system and the binary system. The binary number 10 represents our number 2.
Knowing this, it is rather simple to convert a binary number into a decimal number. Here are numerous examples.
11001
= 10000 + 1000 + 1
= (10^{4}) + (10^{3}) + (10^{0}) [Remember that 10 represents 2, so:]
= (2^{4}) + (2^{3}) + (2^{0})
= 16 + 8 + 1
= 25
111
= 100 + 10 + 1
= (10^{2}) + 10 + (10^{0}) [10 = 2, so:]
= (2^{2}) + (2^{1}) + (2^{0})
= 4 + 2 + 1
= 7
1011000
= 1000000 + 10000 + 1000
= (10^{6}) + (10^{4}) + (10^{3}) [Again, 10 = 2]
= (2^{6}) + (2^{4}) + (2^{3})
= 64 + 16 + 8
= 88
So how does this help explain the magic boxes? Simple. Here is the first Magic Box:

Here is that same box, but converted into binary.

Do you see the pattern? The last binary digit ("bit") of each number is 1.
Here's the second box:

And, of course, in binary:

Do you see the pattern here? The secondtolast bit of every number here is 1.
This pattern extends to every single Magic Box. In the first box, the last bit is always 1. In the second, the secondtolast. In the third, the thirdtolast, etc.
So how can you tell what the chosen number is merely by knowing what boxes it's in? Merely take all these binary digits and recompose them back into a decimal number. This may seem difficult, but actually it's quite simple. Just add together the first number in every box, and the sum will be the chosen number.
For example, assume that the reader says that the number is the in the first, fourth, and fifth boxes. This means that the last bit, fourthtolast bit, and fifthtolast bit will all be 1. Here's the math to convert this to decimal:
11001
= 10000 + 1000 + 1
= (10^{4}) + (10^{3}) + (10^{0})
= (2^{4}) + (2^{3}) + (2^{0})
= 16 + 8 + 1
= 25
At first this may seem difficult, but with practice becomes almost second nature (especially if you're a computer scientist and happen to have your powers of two down cold).