# An introduction to binary

The binary numbering system uses only two digits for all numbers! These are 0 and 1.

**Q1.** When we looked at denary, we saw that the digit itself was important to indicate the 'worth' of a number but more importantly, the position of a digit relative to the other digits in a number was very important. The positions were worth the following in denary:

10^{7} |
10^{6} |
10^{5} |
10^{4} |
10^{3} |
10^{2} |
10^{1} |
10^{0} |

10000000 | 1000000 | 100000 | 10000 | 1000 | 100 | 10 | 1 |

Can you fill in the following partially completed table showing what each position in binary is worth?

27 | 23 | 21 | |||||

128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |

**Q2.** Consider the denary number 6. Let's convert it into binary. The biggest binary number we can fit into 6 is 4. That leaves us with 2 left over. The biggest binary number we can fit into 2 is 2. that leaves us with 0. We can't fit any 1s in 0. The denary number 6 is therfore the same as the binary number 110.

Consider the denary number 23. The biggest binary number we can fit into 23 is 16. That leaves us with 7. We can't fit any 8s into 7. We can fit a 4, and that leaves us with 3. We can fit a 2 into 3 and that leaves us with a 1. We can fit a 1 into 1. The denary number 23 is therefore the same as the binary number 10111.

Consider the denary number 34. The biggest binary number we can fit into 34 is 32. That leaves 2. We can't fit any 16s into 2. We can't fit any 8s into 2. We can't fit any 4s into 2. We can fit a 2 into 2 and that leaves 0. We can't fit a 1 into 0. The denary number 34 is the same as the binary number 100010.

Whenever you are going to convert numbers, always write down first what each bit position is worth. It will really help you avoid making mistakes. For the moment, 8 positions is more than enough.

128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |

- Without using a calculator, work out the binary equivalent of the denary number 9.
- Without using a calculator, work out the binary equivalent of the denary number 18.
- Without using a calculator, work out the binary equivalent of the denary number 73.

**Q3.** We only have 2 digits in binary. They are 0 and 1. We can use our table showing what each position is worth to help us count in binary. Study this table carefully, to see how we worked out the binary version of each denary number as we counted up from zero. Complete the table up to 25.

Denary | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |

0 | 0 | |||||||

1 | 1 | |||||||

2 | 1 | 0 | ||||||

3 | 1 | 1 | ||||||

4 | 1 | 0 | 0 | |||||

5 | 1 | 0 | 1 | |||||

6 | 1 | 1 | 0 | |||||

7 | 1 | 1 | 1 | |||||

8 | 1 | 0 | 0 | 0 | ||||

9 | 1 | 0 | 0 | 1 | ||||

10 | 1 | 0 | 1 | 0 | ||||

11 | 1 | 0 | 1 | 1 | ||||

12 | 1 | 1 | 0 | 0 | ||||

13 | 1 | 1 | 0 | 1 | ||||

14 | ||||||||

15 | ||||||||

16 | ||||||||

17 | ||||||||

18 | ||||||||

19 | ||||||||

20 | ||||||||

21 | ||||||||

22 | ||||||||

23 | ||||||||

24 | ||||||||

25 |

**Q4.** Each position in binary is known as a '**bit**'. A group of 4 bits is known as a '**nibble**'. A group of eight bits is known as a '**byte**'. When you write a denary number, you usually miss out any leading zeros. Eg.

**34 is the same as 00034****5366 is the same as 05366**

It's not wrong to include leading zeros, but it doesn't change what the number is worth. Indeed, if you type a number into your calculator with leading zeros, it will usually discard them automatically. In binary, however, we often want to write the numbers using a group of 8 bits, called a 'byte'. If there are leading zeros in the number, then so be it - we keep them in! It doesn't change the number in any way.

128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |

For example:

3 in binary using a byte is 0000 0011 (We often write bytes in groups of nibbles, to make the number clearer, but sometimes, we might just write 00000011). notice the leading zeros! We could have just written 11.

26 in binary using a byte is 0001 1010

65 in binary using a byte is 0100 0001

Convert each of the following numbers into a binary byte:

- 7
- 46
- 127

**Q5.** The smallest number that you can represent in binary using a byte is 0000 0000. What is this in denary?**Q6.** The biggest number that you can represent in binary using a byte is 1111 1111. What is this in denary?**Q7.** The smallest number that you can represent in binary using a nibble is 0000. What is this in denary?**Q8.** The biggest number that you can represent in binary using a nibble is 1111. What is this in denary?**Q9.** The bit position worth 1 in a single byte is known as 'Bit 0'. (Programmers usually like to start counting from 0, not 1). The bit position worth 32 is known as 'Bit 5'. Complete the following table for the other bit positions:

128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |

Bit 5 | Bit 0 |

**Q10.** The bit worth the least amount is known as the **Least Significant Bit (LSB)**. It's Bit 0. Can you guess what Bit 7 is known as and what abbreviation is used for it?

**Extension question**

a) Find out where the term 'bit' comes from.

b) How can you tell what numbering system is being used? For example, how can you tell if 101 is 'one hundred and one' using denary or 'five' using binary? Find out using the Internet.