Did you know that I love binary numbers? Probably not as I haven’t raved about it here yet… The joke is that there are 10 types of people in this world: those who understand binary; and those who don’t. If you haven’t got that yet, you will by the end of this post!
I’m going to explain how binary numbers work and how to add numbers in binary. Because that is very useful in your everyday life. And all those 1s and 0s are just pretty.
Now a review of how numbers work: when you were at school you probably used columns with H, T, U etc at the top to add and subtract. Those columns helped you to keep the numbers in line. H was for hundreds, T for tens, U for units and so forth. We use 0 as a placeholder to keep other numerals in the right columns. A numeral 1 written in the tens column means the same as 10 units. A numeral 1 in the hundreds column means 10 tens. Because of these 10s, we call our number system base 10; a ten is 10 times a unit, a hundred is 10 times a ten and so on.
Binary is base 2. This means that each column is 2 times the next column down. When we write these out, we get column titles which are the powers of 2 (yep, that’s how it connects to Pascal’s triangle!): 128; 64; 32; 16; 8; 4; 2; 1.
I am going to work with 4-digit binary numbers here but this works equally for any number of digits. We’ll start by converting a number into binary. I’m going to pick 11.
We start by writing out the column headers:
8 4 2 1
Now we start with the highest number on the list, 8. The number we’re converting is 11. Is 11 bigger than or equal to 8? Yes, so write a 1 in the 8s column, then take 8 away from 11. We are left with 3.
8 4 2 1
The next column is the 4s column. Is our number 3 bigger than or equal to 4? No, so write a 0 in the 4s column.
8 4 2 1
The next column is the 2s column. Is 3 bigger than or equal to 2? Yes, so write a 1 in the 2s column, then take two away from 3, leaving 1.
8 4 2 1
1 0 1
The final column is the 1s column. We have 1 left, is 1 bigger than or equal to 1? Yes, so write a 1 in the 1s column, then take 1 away from our remainder 1, leaving 0.
8 4 2 1
1 0 1 1
So if we write eleven in binary, it is 1011.
Now let’s try adding together in binary. I’m going to add 6 and 7 together in binary. First I need to convert them: 6 in binary is 0110; 7 is 0111. Write these in columns to add, then add up the columns just as you would normally, carrying to the next column if the numbers add to 2 or more:
When you finish adding you will have 1101. Let’s convert this back to check it. There are 1s in the 8, 4 and 1 column, so add together: 8 + 4 + 1 = 13, which is correct! In some ways adding in binary is simpler, as you only have to add small numbers! As long as you don’t have to convert back to decimal, anyway.
Thank you for popping in to see some binary today. Do you understand the joke yet? (If not, convert 10 from binary to decimal) I had so much fun doing some adding of binary numbers to write this that I might write more about binary next week!