You can add up, subtract and multiply by 2 right? If you can’t you are going to struggle with this. If you can’t do those things then look away now. Binary math
is nothing to be afraid of and this brief introduction to the challenge of solving binary math
problems should set you up for success.
So we’ll begin way back in primary school if thats OK. When we started to learn about numbers we were all taught this simple scale. From Right to Left we have U or Units, T or Tens, H or Hundreds and T or Thousands. This will look very familiar to you except maybe you called the first column on the far left Ones not Units - stick with me.
This number above is, as we all know 1234 or 1 x Thousand, 2 x Hundred, 3 x Ten and 4 x Unit. This number is a decimal number and is based on a series of ‘base 10’ - ‘Dec’ is Latin for 10...all good so far. Each of the columns is allocated a ‘base 10’ formula where we designate each a ‘power of’ (shown as a ‘^’ sign) number where the power of is the number of 0’s or the amount we need to multiply by the reach the next decimal boundary.
Lets take Units. To get a number between 0 and 9 we do not need any 10’s at all so these numbers are given a power of figure equal to 0 or 0 x 10.
Units are designated 10 ^ 0.
That about Tens. Well to get a number between 10 and 99 we have a number of Units multiplied by 10 e.g. 3.4 x 10 = 34, 9/9 x 10 = 99. We cannot multiply numbers to bigger than 99 because then we are in the Hundreds column right? Great news., well done for keeping up. so we’ve multiplied units by 10 once.
Tens are designated 10 ^ 1.
Hundreds hold exactly the same rules as Tens but the range of 10 to 99. Just as for Tens we can’t go higher than 9.9 because that would push us into the Thousands column. So we’ve multiplied by 10 twice e.g. 99 x 10 = 99 x 10 = 999.
Hundreds are designated 10 ^ 2
Finally, (but not of course in reality where numbers go on, and on, and on) we have the Thousands column where we have the Units multiplied by 10, then the Hundreds multiplied by 10 then the Hundreds multiplied by 10. Just like for each of Tens and Hundreds we cannot go beyond 9.9 Units or we would be in the Ten Thousands column (not shown).
Thousands are designated 10 ^ 3
Now hopefully you are seeing a pattern here:
10 ^ 0 ( 0 to 9 )
10 ^ 1 ( 10 to 99)
10 ^ 2 ( 100 to 999)
10 ^ 3 ( 1000 to 9999)
So lets now bring in binary. Binary where ‘Bi’ is Latin for two as in Bicycle (2 wheels) or Bi-plane (2 wings) is a base 2 numbering system. In binary you can only ever have a 0 or a 1.
For binary math numbers we follow the same pattern as decimal:
2 ^ 0 (0 or 1)
2 ^ 1 (00, 01, 10, 11)
2 ^ 2 (00, 01, 10, 11, 100, 101, 111)
2 ^ 3 (00, 01, 10, 11, 100, 101, 111, 1000, 1001, 1010, 1100, 1101, 1111)
OK so far hopefully. Lets take something easy. We want to show the number 0 in decimal....it’s 0 right. What about in binary notation? You guessed right it’s a 0. Same for 1...no issues right. What about 2? Well just like where in decimal where we couldn’t go higher than 9 units, in binary we can’t go higher than 1. So for 2, which is higher than 1 we need to (cue the Rocky Horror music) “It’s just a jump to the left” and pop a 1 into the Hundreds (pardon the poor analogy) column.
Here is 1 shown in Binary using the power of ‘^’ notation.
Now lets add 1 to make two - we can’t add 1 to 1 in binary so we need to move the 1 along to the column to the right.
Now we have two in binary
Now we add one - hey we’ve got space for 1 in the most left column and because we can add 1 to zero we’ll put the 1 in there. So here is 2 + 1 = 3 in binary
Right now I want to add one more to make decimal 4. Well the first column has a 1 in it so we can’t put it there and the second column has a 1 in it so we can’t put it there so we’ll have to put it in the third column. The 1 moves along to the left replacing the 1 with 0 as it travels.
Finally here is decimal 4 as binary
So now we’ve covered this lets take a quick recap and hopefully you’ll see a shortcut sequence. We all love a short cut right? So in case you missed it, here is the sequence again for 0, 2 and 4 with 8 thrown in just to make it easy.
Right, here is the point. The first number is decimal 0 and we have 0’s in each of the fields. This is 2 ^ 0. Decimal 2 is 10 in binary or 2 ^ 1. Decimal 4 is 100 or 2 ^ 2 and Decimal 4 is 1000 or 2 ^ 3. I need you to relax now as we do something seriously difficult. I need you guys to multiply a number....by itself!
In all seriousness here is the shortcut. The ‘power of’ number being either 0, 1, 2 or 3 in our case dictates the decimal value. Work with me a little. Lets take Decimal 2. This was binary 10 or 2 ^ 1. So what is 2 x 1? In math what is 2 x 1...it’s 2 right. So a 1 in that second column from the right which indicates ^1 means multiply 2 x 1.
OK lets take decimal 4. This was 2 ^ 2 or indeed 2 x 2 which is 4. What about 8? 2 ^ 3 or 2 x 2 x 2 = 8.
Take it further and jazz it up a little now. What about 16? Well 2 x 2 = 2 x 1 = 2 x 2 = 4 x 2 = 8 x 2 = 16. So how many times did we multiply by 2...5 times? Right so we put a 1 in the fifth column from the left? Yeah so 16 in decimal is 10000 in binary. Shortcuts...love ‘em or hate ‘em, in an exam you need ‘em.
So can we do some maths now?
Cisco have a great game online to help with this sort of binary math and you can find it at this address. I recommend it as a good fun way to consolidate your learning. Cisco Binary Game
Finally, defaultroute.co.uk is supported by me in my spare time and believe me when I say it is a pleasure to do it. I would appreciate your support however by clicking ads where you see them or visiting the store (its amazon fulfilment so you can be assured it’s all good).
I’m also writing a binary math masterclass to cover ip addressing, sub-netting and bitwise operations which we did not cover today (I am bias but I think it’s a piece of quality and I am proud of it). I’ve also produced a video and best of all an actual online multiple choice exam paper (Flash based) to solidify binary maths for your exams. You will receive feedback to solve the question plus a immediate result. Each of these can be purchased separately or as a bundle.
Good luck with your studies and thank you for reading.