Binary System
Binary System
There are a number of very common needs for a computer, including the need to store
and view data.
Computers use electrical signals that are on or off, so they have to see everything as a
series of binary numbers. This data is represented as a sequence of 1s and 0s (on and
off). All data that we want a computer to process needs to be converted into this binary
format.
What is binary?
Binary is a number system that only uses two digits: 1 and 0. All information that is
processed by a computer is in the form of a sequence of 1s and 0s. Therefore, all data
that we want a computer to process needs to be converted into binary.
People use the decimal number system in their day-to-day lives. This system has 10
digits that we can use: 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9.
The value of each place value is calculated by multiplying by 10 (ie by the power of 10).
The first few place values look like this:
1 0 2 4
To convert a binary number to decimal, start by writing out the binary place values. In
decimal, the place values are 1, 10, 100, 1000, etc – each place value is 10 times
bigger than the last. In binary, each place value is 2 times bigger than the last (ie
increased by the power of 2). The first few binary place values look like this:
128 64 32 16 8 4 2 1
128 64 32 16 8 4 2 1
1 0 1 0 1 0 0 0
128 + 0+ 32 + 0+ 8+ 0+ 0+ 0
So 1010 1000 in binary is equal to 168 in decimal.
Start by writing out the first few binary place values (128, 64, 32, 16, 8, 4, 2, 1).
128 64 32 16 8 4 2 1
Start at the far left point and say “Can 128 be taken away from 199?”. If it can, do
that.
199 – 128 = 71. Because 128 could be taken off, put a 1 in the ‘128’ place value
column:
128 64 32 16 8 4 2 1
128 64 32 16 8 4 2 1
1 1
And again for 32: 7 – 32 won’t work, so put a 0 in that place value column.
128 64 32 16 8 4 2 1
1 1 0
Try again for 16: 7 – 16 won’t work, so add a 0 to that place value column.
128 64 32 16 8 4 2 1
1 1 0 0
Next is 8: 7 – 8 won’t work. Add a 0 to the ‘8’ place value column.
128 64 32 16 8 4 2 1
1 1 0 0 0
Try again for 4: 7 – 4 = 3, so add a 1 to the ‘4’ place value column.
128 64 32 16 8 4 2 1
1 1 0 0 0 1
128 64 32 16 8 4 2 1
1 1 0 0 0 1 1
And finally, 1: 1 – 1 = 0 – add a 1 to the ‘1’ place value column.
128 64 32 16 8 4 2 1
1 1 0 0 0 1 1 1
Note that binary numbers are usually written in blocks of four, separated by a space (eg
0111 1011). In decimal, numbers are often written in blocks of three (eg 6 428 721).
Adding binary
When two numbers are added together in denary, we take the first number, add the
second number to it and get an answer. For example, 1 + 2 = 3.
There are four rules that need to be followed when adding two binary numbers. These
are:
0+0=0
1+0=1
1 + 1 = 10 (binary for 2)
1 + 1 + 1 = 11 (binary for 3)
Example
Let’s try adding together two binary numbers: 0101 0011 and 0111 0110.