The Binary System

"There are ten types of people in this world... those who know binary, and those who don't." -Anonymous

So what exactly is the binary system? To start off, let's ask what exactly the decimal system is first. The decimal system is what
we use commonly, and it is basically universal. It is a base 10 counting system, which means there are 10 digits, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. After reaching 9, the number
of digits are exhausted, and a "1" is in this case, carried to the "tens" place to make a 10, and the pattern repeats itself infinitely. The binary system however is a base
2 counting system, meaning there are 2 numbers, 0 and 1. Just like the decimal system, a "1" is carried over when the number of digits are exhausted, except instead of being
exhausted at 9, it is used up at 1, and instead of a ones, tens, hundreds, thousands place, it is the 1s, 2s, 4s, 8s, 16s, place. As you may notice now, the place values are
actually the "powers" of the "base". The ones place is 10 to the 0, the tens, 10 to the 1, and the hundreds, 10 to the 2, and the same thing with binary.
To draw a parallel between the two counting systems, with decimal first, followed by its binary counterpart, 0 is 0, 1 is 1, 2 is 10, 3 is 11, 4 is 100, 5 is 101 and so on. This method of counting takes getting
used to and may be hard to wrap your head around in the beginning. The next step is learning how to convert between the two counting systems. For low numbers, it is easy to count out, but what if you were asked to write out the decimal number 352 in binary? Although it may seem all but impossible, there is a very simple algorithim trick that when learned, will allow you to convert easily from binary to decimal, and vice versa. Again, we will draw the parallel with the decimal system. Although it may sound intuitive and trivial to do so, let us write out the number 352 in this way: 100 10 1
To make the number 352, we simply multiply the number with its place value, and then add them up so that we get: 300 + 50 + 2, which makes 352. You are probably
thinking it is trivial at this point, but now think back to what was said about binary and the 1s, 2s, 4s, place. Drawing from what we just did here, let us do the same thing with
the binary number 11101.3 5 2 16 8 4 2 1
Same as before, we multiple the numbers by its place values and add them all up: 16 + 8 + 4 + 1 = 29, and as you can see now, even thought
it is still easy, this suddenly looks a lot less trivial. Manipulating this another way, we can convert decimal numbers to binary as well. Lets take the number 352. We first
find the biggest power of 2 which will fit in to 352, which is 256. Writing out a similar table we used previously, we mark down a 1 below 256 and then subtract that from 352, leaving
96. Moving down the line, 128 does not fit in to 96, so a 0 is marked below 128, and we move on to 64. 64 does fit in to 96, we mark down a 1 below 64, and then subtract it from 96 to get
32. 32 is next in line, and that perfectly knocks off the 32 to 0, meaning we are done! This should be what it looks like: 1 1 1 0 1 256 128 64 32 16 8 4 2 1
Meaning 352 in decimal is 101100000 in binary. Now let us quickly consider the adding, subtracting, multiplying and dividing binary numbers. Should we expect
it to work the same? Or is it going to be completely different in another base? With a few quick easy examples, it is very easy to convince yourself that it is the same, although
once again, it may be very hard to wrap your head around it, especially with subtraction. We will however stop there and not discuss decimals and other more complex mathematical functions.
1 0 1 1 0 0 0 0 0 |