## Friday, August 9, 2013

### == Learning Binary ==

Binary is a numeric system that uses the base 2 numeral system. There are only 2 usable digits 0 (or off) and 1 (or on). Binary is the heart of all electronic computers, including but not limited to personal computers, Macs, gaming controls, and cellphones. In computers the only thing it really does is switch between 2 states 0 or 1, from that many combinations we get our digital world as we have it today. In this portion I will be showing how to count in binary.
Take a look at the following:
 Decimal Binary 0 0 1 1 2 10 3 11 4 100 5 101 6 110 7 111 8 1000 9 1001 10 1010 11 1011 12 1100 13 1101 14 1110 15 1111 16 10000 17 10001 18 10010 19 10011 20 10100

Do you see the pattern?
In the decimal system we start with 0, and there are 10 usable digits, 0-9. In binary like mentioned there are only 2 digits 0 and 1. In decimal once you get past 9 you simply increment the first digit to the left (if it doesn't exist then pretend its a 0) and start the sequence over. For example: 00,01,02,03,04,05,06,07,08,09 from here we increment to the next digit and start the sequence over again hence we get 10,11,12,13,14, etc.

In binary its the same concept. 00,01 since 1 is our last usable digit we increment and start the sequence over hence 10,11 from here we repeat the same idea hence 100,101,110,111, etc. Now 100 shown here isn't actually 100 like we use in decimal its value is actually 4. Each place value is different, lets compare it to decimal system:

Note: the value 3,791 is randomly used in this comparison.
Decimal:
 1000 100 10 1 3 7 9 1
Binary:
 2048 1024 512 256 128 64 32 16 8 4 2 1 1 1 1 0 1 1 0 0 1 1 1 1
In the decimal system you multiply the number of its place value, and then add the result of each multiplication. So you take (3x1,000) + (7x100) + (9x10) + (1x1) = 3,791.

In binary it is the same process, just that the place values are different, and easy way to remember is it starts with 1 and is doubled each time. So (1x2,048) + (1x1,024) + (1x512) + (0x256) + (1x128) + (1x64) + (0x32) + (0x16) + (1x8) + (1x4) + (1x2) + (1x1) = 3,791. An obvious way to make this faster is ignore the multiplication part because if its 0 it doesn't add to the value and you can ignore it, and if its 1 just add the place value its because anything multiplied by 1 is equal to itself.

Here is a simple converter: