1  Theory of Computer Science / Understanding Binary


Understanding Binary
Why do computers use Binary numbers?
Computers can only understand 2 things... Power on and Power off! Power on = 1 Power off = 0 As there are only two possible states, the base 2 binary system is perfect for computers. Everything that a computer will process, receive or display has to be converted into binary. 
Units of Memory
Unit Name 
Memory value 
1 Bit 
A single 1 or 0 
1 Nibble 
4 Bits 
1 Byte 
8 Bits 
1 KB 
1024 Bytes 
1 MB 
1024 KB 
1 GB 
1024 MB 
1 TB 
1024 GB 
Binary Conversion
To understand binary numbers further, we need to know how to convert them. We need to convert them both from Binary to denary and vice versa.
To begin you should write out the numbers from left to right 128, 64, 32, 16, 8, 4, 2, 1... WHY these numbers? You simply double the number each time starting from 1 and working from right to left.
Once you have this table you can use it to convert binary to denary AND denary to binary
Lets say that you have been asked to convert the Binary number 00011011 into a denary (Base 10) number...
Step 1 = Draw out a table with the numbers mentioned above
Step 2 = Write out the binary number 00011011 into the table, below the aforementioned numbers
See the table below...
128 
64 
32 
16 
8 
4 
2 
1 
O 
O 
O 
1 
1 
O 
1 
1 
Once you have this table with your binary number inserted, you can complete the conversion by adding up the numbers that have a 1 below them. so in this example we would need to perform the following calculation:
16 + 8 + 2 + 1 = 27
So the answer is 00011011 in denary = 27
16 + 8 + 2 + 1 = 27
So the answer is 00011011 in denary = 27
Bigger numbers and binary
You may have noticed that the biggest number that can be made with one byte is 255 and that you can make 256 different numbers If you include 0.
But what if you want a number bigger than 256?? surely this is limited...
Well to solve this you can us more bits to represent higher numbers. What this means is that instead of using 1 byte (8 bits) to represent a denary number we can use 2 bytes (16 bits).
How?
The method for doing this is exactly the same as using one byte. You still write down the table with the numbers 128, 64, 32, 8, 4, 2, 1 however you continue with another 8 numbers that double from 128... confused? see the table below.
But what if you want a number bigger than 256?? surely this is limited...
Well to solve this you can us more bits to represent higher numbers. What this means is that instead of using 1 byte (8 bits) to represent a denary number we can use 2 bytes (16 bits).
How?
The method for doing this is exactly the same as using one byte. You still write down the table with the numbers 128, 64, 32, 8, 4, 2, 1 however you continue with another 8 numbers that double from 128... confused? see the table below.
32768 
16384 
8192 
4096 
2048 
1024 
512 
256 
128 
64 
32 
16 
8 
4 
2 
1 