Binary
The number system we're familiar with is the decimal number system. We count like this:
0,1,2,3,4,5,6,7,8,9,10,11,12,...
However, there many other number systems out there too. After the decimal number system, the next most well-known one is the binary number system. We count it like this:
0,1,10,11,100,101,110,111,...
Wait, how did we jump from 1 to 10? Or from 11 to 100?
A Closer Look at the Decimal Number System
The word "decimal" uses the "deci-" prefix, meaning one-tenth. The connection to 10 is why the decimal number system is also called the base-10 counting system.
A base-10 number system means we have 10 digits: 0,1,2,3,4,5,6,7,8,9. As we count upwards, we work our way through these digits. When we get to the last digit, we reset the digit in the ones place, then add a new digit in the 10s place, starting with 1 (technically, we increment the 0 to a 1, but we leave out leading zeros when writing a number).
Let's break it down. The digits in the ones place is just worth "1" each. But in the 10s place, we only increment it after 10 increments of the ones place, so it's worth 10 per "digit value". That means a "1" digit has a value of 10, "2" has a value of 20, and so on.
Likewise, when we get to the 100s place, that's a digit of 1 would require 10 increments of the 10s place, which each requires 10 increments in the ones place, meaning it's worth 10 × 10 = 100. This means the digit "1" here is worth 100, a digit of "2" is worth 200, and so on.
Breaking it down, the number 347=300+40+7. For people who like formulas, we just indicate the value as 3×102+4×101+7×100. This makes it easier to think about as we increase to more numbers.
This feels obvious, and rightfully so. After all, this is the number system we're used to using. But it's good to make this explicit as we move on to binary.
Counting in Binary
Let's take a look at the binary system. binary starts with "bi" meaning 2, which is why we also call it the base-2 number system. This time, we're only stuck with 2 digits: 0 and 1. Let's try counting with it, starting from zero.
0
Looks okay so far. Now let's add 1.
1
Still normal, But when we try to add 1 again, we realise we already hit the end of the list of digits. so we reset the digit in the 1s place and increment the digit in the 2s place (in decimal this is the 10s place, but we're in base-2 now).
10
We add 1 again:
11
Let's add 1 more. Just like incrementing 99 to get 100, we'll have to carry over twice to get:
100
In fact, let's count the numbers side by side to compare how they work.
Play around with the counter until you have a clearer understanding of how we count in numbers.
Converting Binary to Decimal
Remember that for decimal numbers, the digit "1" has value 1 in the 1s place, value 10 in the 10s place, and value 100 in the 100s place.
Likewise, in a binary number, we have 2s, 4s, 8s, ... places (powers of 2 instead of powers of 10).
Let's take 11010 in binary for example. We have:
- A 1 in the 16s place,
- A 1 in the 8s place,
- A 0 in the 4s place,
- A 1 in the 2s place, and
- A 0 in the 1s place.
We can sum their values up as such:
1×16+1×8+0×4+1×2+0×1=26
Converting Decimal to Binary
We can do the reverse to convert a number from decimal to binary. Let's start with 45. We notice that the biggest power of 2 that "goes into" 45 is 32=25.
So we get 45=32+13.
Let's break down the next number, 13. The biggest power of 2 that "goes into" 13 is 8=23.
45=32+8+5
The next biggest power of 2 that "goes into" 5 is 4=22. That leaves 1, which is already a power of 2 (20).
45=32+8+4+1
Let's convert the numbers back into powers of 2.
45=25+23+22+20
We have powers of 5, 3, 2, and 0; which means the 6th, 4th, 3rd, and 1st digit from the right (we have to add 1 since we always start from a power of 0) are 1s, and the rest are zeros.
This gives us 101101 as the binary representation of 45.
But Why Binary?
From the earlier examples, you can see that binary representations are much longer than decimal numbers. This may seem inefficient for humans, but it's quite useful for computers.
The relative strength of binary over decimal is in the number of digits. With only 2 digits, we can map states naturally into mechanical representations. A transistor can be on or off, a QR-code can have a black or white square in its grid, and a signal can be in high or low position.
On top of that, computation is easier to represent in electrical circuits when there are only 2 digits. In decimal, we have to represent:
0 + 0 = 0
0 + 1 = 1
0 + 2 = 2
...
4 + 7 = 11
5 + 7 = 12
...
9 + 9 = 18
All that just to perform addition on 2 numbers. In binary, we only need to represent:
0 + 0 = 0
0 + 1 = 1
1 + 0 = 1
1 + 1 = 10 (2 in decimal)
Application to Puzzles
When it comes to puzzle solving, binary number systems should come to mind when you encounter a situation where 2 states naturally comes out. Think light switches in on or off, doors that are open or closed, objects are in or not in a set.
Look out for these concepts in your next puzzles, and happy solving!
Expeditions that build on this
Try These Expeditions Next
Gray Code
Learn about Gray code, a binary numbering system where consecutive values differ by only one bit. Essential for puzzles involving binary states with single-bit transitions.
Binary
Understanding binary number systems, and converting between decimal and binary.
Adversarial Games
Learn how to analyse two-player, zero-sum games by building game trees, classifying positions as winning or losing, and finding optimal strategies.