1 of 57

Lesson 4:

Numbers in binary

Year 8 – Data Representations – Representations: from clay to silicon

2 of 57

Discussion

Starter activity

Take a look at these strange coins (let’s call them ‘boins’).

You only have one of each.

Is there any amount that you won’t be able to pay with these?

You won’t be asked to pay for anything over 31.

Discuss this with the person next to you.

3 of 57

Starter activity

The answer is no.

We can include or exclude each of these boins to form any sum up to 31.

Example: 13

4 of 57

Starter activity

The answer is no.

We can include or exclude each of these boins to form any sum up to 31.

Example: 26

5 of 57

In this lesson, we will...

Objectives

Explore how a sequence of binary digits can represent numbers.

Convert between decimal and binary numbers.

6 of 57

You’ve seen this before

Activity 1

What do we call these symbols?

How many of them are there?

0 1 2 3 4 5 6 7 8 9

We call these symbols digits.

There are 10 of them.

A sequence of decimal digits represents a number.

A sequence of decimal digits represents a number.

Let’s think about this.

7 of 57

Activity 1

4

2

10

1

These are called

multipliers or weights

40

2

+

The sum of the products

is the number

8 of 57

Activity 1

3

1

4

100

10

1

300

10

4

+

+

9 of 57

Activity 1

2

7

1

8

1000

100

10

1

+

2000

700

10

8

+

+

Can you see a pattern

in the multipliers?

10 of 57

Activity 1

2

7

1

8

1000

100

10

1

+

2000

700

10

8

+

+

Multipliers are

powers of ten

⨉10

⨉10

⨉10

⨉10

11 of 57

Activity 1

We use 10 digits and the

decimal (base-10) system

for numbers.

This is probably because we have

10 fingers to count with.

‘digitus’ is Latin for ‘finger’

2

7

1

8

1000

100

10

1

+

2000

700

10

8

+

+

12 of 57

Enter binary

Activity 2

We will use two digits and the

binary (base-2) system

for numbers.

Same reasoning as in decimal.

Leibniz (1646–1716)

13 of 57

You’ve seen this before

Activity 2

What do we call these symbols?

How many of them are there?

0 1

We call these symbols binary digits.

There are only 2 of them.

A sequence of binary digits represents a number.

Let’s think about this.

14 of 57

Activity 2

1

0

0

1

In binary, there are also multipliers or weights

15 of 57

Activity 2

1

0

0

1

8

4

2

1

In binary, there are also multipliers or weights

16 of 57

Activity 2

0

8

0

1

1

0

0

1

8

4

2

1

⨉2

⨉2

⨉2

Multipliers are

powers of 2

+

+

+

The sum of the products

is the number

9

in decimal

17 of 57

Activity 2

1

0

0

1

8

4

2

1

9

in decimal

8

1

18 of 57

Activity 2

In binary, we use 2 digits and

the binary (base-2) system

for numbers.

It is convenient for systems

using switches.

1

0

0

1

8

4

2

1

9

in decimal

8

1

19 of 57

Activity 2

In a sense, binary digits act like switches:

Flip one to on, and the corresponding multiplier is included in the sum

4

2

8

1

1

0

0

1

9

in decimal

20 of 57

Activity 2

Let’s try another example.

0

1

0

1

1

21 of 57

Activity 2

Always start with the multipliers.

What will the next one be?

0

1

0

1

8

4

2

1

1

22 of 57

Activity 2

Each multiplier is twice as big as the one before it.

0

1

0

1

8

4

2

1

1

16

⨉2

23 of 57

Activity 2

Can you see the decimal number yet?

0

1

0

1

8

4

2

1

1

16

24 of 57

Activity 2

When a binary digit equals 1, its multiplier is included in the sum.

0

1

0

1

8

4

2

1

1

16

4

0

0

1

+

+

+

16

+

25 of 57

Activity 2

When a binary digit equals 1, its multiplier is included in the sum.

0

1

0

1

8

4

2

1

1

16

16

1

4

26 of 57

Activity 2

Compute the sum:

this is the decimal number.

0

1

0

1

8

4

2

1

1

16

16

1

4

21

in decimal

27 of 57

Activity 2

Again, bits are like switches:

a value of 1 means that the multiplier is included in the sum.

0

1

0

1

1

16

1

4

21

in decimal

4

2

8

1

16

28 of 57

Convert binary to decimal: instructions

Activity 3

Write multipliers over the bits:

Start with 1 on the right, and double as you go from right to left.

For each bit set to 1, select its corresponding multiplier.

Add up the selected multipliers:

the sum is the decimal number.

1

0

1

0

1

4

2

1

⨉2

⨉2

⨉2

8

16

⨉2

16

2

8

26

in decimal

29 of 57

Convert binary to decimal

Activity 3

1

0

1

0

1

26

in decimal

4

2

8

1

16

30 of 57

Activity 3

Remember the boins?

1

0

1

0

1

4

2

8

1

16

31 of 57

Bits to numbers

Activity 3

Solve the problems!

‘Translate’ binary numbers back to the familiar decimal system.

Write the answers on your worksheet.

32 of 57

Bits to numbers: answers

Activity 3

Solve the problems!

‘Translate’ binary numbers back to the familiar decimal system.

Exchange worksheets with a classmate.

Check your peer’s answers and then discuss them together.

When you have finished, ask your teacher to check your work.

33 of 57

Whose cake is it?

Activity 3

You should now be able to understand this puzzle.

34 of 57

Whose cake is it?

Activity 3

There are 10 kinds of people in this world: those who understand binary and those who don’t.

35 of 57

Decimal to binary

Activity 4

Now, we will do the opposite: start with a decimal number and work out the corresponding binary number.

There are a few ways to do this.

We are only going to examine one of them.

36 of 57

Decimal to binary

Activity 4

Which binary digits do I set to 1?

Which multipliers do I select to ‘assemble’ a sum of 13?

8

4

2

1

16

13

37 of 57

Decimal to binary

Activity 4

Start with the leftmost bit.

Go through the bits from left to right.

8

4

2

1

16

13

38 of 57

Decimal to binary

Activity 4

Do I set this binary digit to 1?

Do I need to select multiplier 16

to ‘assemble’ a sum of 13?

No. It should be set to 0.

Setting it to 1 would include 16 in the sum,

i.e. the sum would exceed 13.

8

4

2

1

16

13

0

39 of 57

Decimal to binary

Activity 4

Do I set this binary digit to 1?

Do I need to select multiplier 8

to ‘assemble’ a sum of 13?

Yes. It should be set to 1.

Setting it to 0 would exclude 8 from the sum, so the sum would never reach 13

(because the rest of the multipliers only add up to 7).

8

4

2

1

16

13

0

1

5

8

13-8=

40 of 57

Decimal to binary

Activity 4

Do I set this binary digit to 1?

Do I need to select multiplier 4

to ‘assemble’ a sum of 5?

Yes. It should be set to 1.

Setting it to 0 would exclude 4 from the sum, so the sum would never reach 5

(because the rest of the multipliers only add up to 3).

8

4

2

1

16

0

1

5

1

1

4

8

5-4=

41 of 57

Decimal to binary

Activity 4

Do I set this binary digit to 1?

Do I need to select multiplier 2

to ‘assemble’ a sum of 1?

No. It should be set to 0.

Setting it to 1 would include 2 in the sum,

i.e. the sum would exceed 1.

8

4

2

1

16

0

1

1

1

4

8

0

42 of 57

Decimal to binary

Activity 4

Do I set this binary digit to 1?

Do I need to select multiplier 1

to ‘assemble’ a sum of 1?

Yes.

8

4

2

1

16

0

1

1

1

4

8

0

1

1

13

in decimal

43 of 57

Decimal to binary

Activity 4

Let’s try another example.

44 of 57

Decimal to binary

Activity 4

Do I set this binary digit to 1?

Do I need to select multiplier 16

to ‘assemble’ a sum of 22?

Yes. It should be set to 1.

Setting it to 0 would exclude 16 from the sum, so the sum would never reach 22

(because the rest of the multipliers only add up to 15).

8

4

2

1

16

22

1

16

6

22-16=

45 of 57

Decimal to binary

Activity 4

Do I set this binary digit to 1?

Do I need to select multiplier 8

to ‘assemble’ a sum of 6?

No. It should be set to 0.

Setting it to 1 would include 8 in the sum,

i.e. the sum would exceed 6.

8

4

2

1

16

6

1

0

16

46 of 57

Decimal to binary

Activity 4

Do I set this binary digit to 1?

Do I need to select multiplier 4

to ‘assemble’ a sum of 6?

Yes. It should be set to 1.

Setting it to 0 would exclude 4 from the sum, so the sum would never reach 6

(because the rest of the multipliers only add up to 3).

8

4

2

1

16

1

0

6

1

2

4

16

6-4=

47 of 57

Decimal to binary

Activity 4

Do I set this binary digit to 1?

Do I need to select multiplier 2

to ‘assemble’ a sum of 2?

Yes. It should be set to 1.

That makes the sum exactly 2.

Set the rest of the digits to 0.

8

4

2

1

16

1

0

1

2

4

1

16

2

0

0

22

in decimal

2-2=

48 of 57

Numbers to bits

Activity 4

Now, you will be given some numbers in decimal.

Can you work out the corresponding binary numbers?

Write the answers on your worksheet.

49 of 57

Numbers to bits: answers

Activity 4

Exchange worksheets with a classmate.

Check your peer’s answers and then discuss them together.

When you have finished, ask your teacher to check your work.

Now, you will be given some numbers in decimal.

Can you work out the corresponding binary numbers?

50 of 57

Homework

Practise converting between binary and decimal

Explorer task: The Voyagers

Programming challenges

Plus: any activities that you did not complete during this lesson

51 of 57

Next lesson

Summary

In this lesson, we...

Explored how numbers can be represented as sequences of decimal and binary digits.

Converted between decimal and binary numbers.

Next lesson, we will...

Examine how we count the number of binary digits in sequences that are really long.

52 of 57

The Voyagers

Interlude

Have you heard of the Voyager spacecraft?

53 of 57

The Voyagers

Interlude

Both spacecrafts carry a golden phonograph record with sounds and images...

54 of 57

The Voyagers

Interlude

Both spacecrafts carry a golden phonograph record with sounds and images, along with instructions on how to decode them.

55 of 57

The Voyagers

Interlude

Take a look at some of the instructions.

Do the symbols look familiar?

56 of 57

The Voyagers

Interlude

Here is one of the images on the record.

It’s like a cheat sheet for reading numbers!

57 of 57

The Voyagers

Interlude

All the numbers on the instructions are encoded in binary, using ❙ and ━.

Why do you think this choice was made?