The most incomprehensible thing about the world is that it is comprehensible.

- Albert Einstein
4
May
How computers calculate (and plot our demise)

Well the title may be a bit dramatic, but i wanted to do a quick post on binary (0’s and 1’s) and i can only assume that Hollywood is right and computers are indeed plotting our inevitable destruction (and are presumably doing so in binary). Bottomline is, i once again saw a pretty cool video on youtube and wanted to do a quick post about it. Unlike the Brian Cox TED-Talk video though, i know a bit (get it?!) about binary so i’ll explain a little. Here’s the video if you want to skip he explenation, but if you don’t understand how binary math works it might be fun to read below the video first and then watch it (although i’ll admit it’s not as exciting as the video).

Binary addition is one of the simplest thing you can do with binary numbers really, and it gives a neat little window into how computers work (on a very simple level anyway). So lets say you have 3 bits, so your binary code will be any permutation of 3 0’s or 1’s, like 000, 010 101 etc. First off, we need to know how we read binary numbers, so lets call the 3 bits for a,b and c, so our number is abc. We start by numbering each decimal place, counting up from zero, starting from the right, so c is in the zeroth place, b in the first, and a in the second place. We then take our bit, and multiply it by two lifted to the power of whatever decimal place we are in and add them all up. So the mathematical equation would look like this: abc=a*2^2 + b*2^1 + c*2^0. Now we know that 2^0=1, 2^1=2 and 2^2=4 (next places are 8, 16,32 etc. as you see in the video). So putting it all together we see that 101=1*4+0*2+1*1=5.

What happens if i want to add two binary numbers together? Well the math rules are really quite simple, 0+0=0, 1+0=1, 0+1=1 and 1+1=0 (but here you carry the 1 over to the next decimal). So lets say we are looking at 001 (1) and 010 (2), we start and take the first number to the right in both numbers, that’s 1+0=1, second number in both added together is 0+1=1 while the third is 0+0=1, so in the end we get 011, and using the knowledge we had before we see that it’s 3, which is obviously the correct answre for 2+1. These are clearly exceedingly simple numbers, but expanding this into much larger numbers is really just a formality of adding more bits, it obviously takes longer to calculate, but the method is the exact same.

Hopefully that was clear enough, writing math in HTML isn’t the most end-user friendly thing in the world, but as always we can recommend the wikipedia article on it, if you still have questions.

One Response to “How computers calculate (and plot our demise)”

  1. Tim Meyer Says:

    Where do I get one of these?

Leave a Reply

CAPTCHA image