Introduction to The Binary Number System

i. Counting

Hold up one hand. How far can you count on 4 fingers? If each finger is a binary digit you can count to more than 4. By the end of the lesson you will know how far you can count in binary on 2 hands and even on 2 hands and 2 feet.

Put cards in numeric order, face down, smallest on right. This is zero.

Turn cards over in combination to make a series of numbers in range 0-15. Is there a pattern to the way the cards are turned over?

Make a series of further numbers in range 16-127.

What type of number does each card represent?

What is the biggest number that can be made in 2 cards? 3 cards? etc.

Complete the expression: the biggest number in n cards is: ...

How many numbers do 2 cards represent? 3 cards? 4 cards? etc.

How many cards do you need for 255?

How many numbers can you represent with 10 cards? How is this number used when talking about computers?

Recap: How far can you count on one hand?

What name is given to 2^20? 2^30?

Turn the cards face down again. Put binary numbers on board (pupils can do this). Given a binary number what is its decimal value? Try this in your head then use the cards to check if you are right.

Use digits on hands to show binary numbers and get the answers in denary. What is the largest number you can show on one hand? On two hands? On two hands and two feet?

Extension

What happens to binary numbers when you insert a zero on the right? Or delete the left-most card?

Formal account

Exercises

ii. Addition In Binary

Addition in binary follows these rules:

0+0=0

0+1=1

1+0=1

1+1=0 carry 1

1+1+ carry=1 carry 1

Binary Addition Exercise

iii. Character Codes and Simple Encryption

The ASCII and Unicode values for common codes are as follows:

0 (zero) : 48

Subsequent ASCII codes are 49, 50, 51, 52, 53, 54, 55, 56, 57

A : 65

Subsequent letter codes are 66, 67, etc. Lower case 'a' is 97, others follow on in sequence.

Translate a short message into character codes and pass it to a neighbour to decode.

Your message is encoded but not encrypted. What is the difference between these two words? Can you use a simple strategy to encrypt your message? Compose a different message in code values, encrypt it with a simple method and then pass it to your neighbour to decode. How will they set about decoding it? Hints here.

Useful program here. You can use this to encrypt your emails!

Cryptography is an enormous and complicated field and a significant branch of mathematics.

iv. Hexadecimal

Binary is rather cumbersome for humans to read and write so a shorthand has been developed called hexadecimal. Binary has 2 digits, denary has 10 digits and hexadecimal has 16 digits. The characters used in hexadecimal are: 0-9 + A, B, C, D, E, F. These represent the 4-bit patterns from 0-15:

Hexadecimal value Binary value
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
A (10) 1010
B (11) 1011
C (12) 1100
D (13) 1101
E (14) 1110
F (15) 1111

Thus an 8-bit number can be represented by two hexadecimal digits and a 16-bit number can be represented by 4 hexadecimal digits. The link between binary and hexadecimal is more obvious than that between binary and denary. If you want to know the denary value you will still have to convert from binary or hexadecimal - the 16-times table will come in handy here!

Examples:

AB = 1010 1011 (=10 x 16 + 11 = 171 in denary)

4F = 0100 1111 (=4 x 16 + 15 = 79 in denary)

Home