1.9

## National STEM Learning Centre

Skip to 0 minutes and 7 secondsMICHAEL ANDERSON: So let's have a look at how base 2 or the binary system works.

Skip to 0 minutes and 12 secondsPAULA KELLY: So on our table, it's similar to how we had it before with powers of 10. This time, though, we're having powers of 2 because we're counting in base 2.

Skip to 0 minutes and 21 secondsMICHAEL ANDERSON: So it might be useful to write the values of each column above. So for example, 2 to the power of 0, that's going to give us 1. 2 to the power of 1 is 2. 2 squared, 2 times 2, is 4. 2 cubed is 8. And you'll notice that each of these columns, each time to where we move from right to left, we're doubling. So 1 times 2 times 2 times 2. So the next one is going to be 16, then 32, and then 64. And we can keep on doubling.

Skip to 0 minutes and 50 secondsPAULA KELLY: So to have a look at how this differs from our denary system, should try and write some numbers in binary.

Skip to 0 minutes and 56 secondsMICHAEL ANDERSON: OK. So with the number 1, we're just going to put-- we're just going to put a 1 in there. Now, in base 2, we're not allowed to use any of the digits other than 0's and 1's. So to represent the number 2, what we're going to do is we're going to say, well, that's one 2 and zero 1's. So 2 in this system is written as a 1 and then a 0, like we had the 1 before just being a 1.

Skip to 1 minute and 22 secondsPAULA KELLY: So here, we're quite familiar with this from our base 10, but this shows this is quite different when we're counting in base 2.

Skip to 1 minute and 29 secondsMICHAEL ANDERSON: Yeah. So if we wanted to make the number 3, for example, well, to make 3, I need one 2 and I need one 1. So 2 plus 1 gives me my 3. What do you think 4 is going to look like?

Skip to 1 minute and 43 secondsPAULA KELLY: So for 4, then, we want to find just here a 4. We're fine. So 1 of these. Then I wouldn't need any other digits, so that would give us one 4, which is 4.

Skip to 1 minute and 56 secondsMICHAEL ANDERSON: And it's really tempting to almost think as 4 as two 2's, but we couldn't put the number 2 in there, so yeah, it goes to a 1-0-0.

Skip to 2 minutes and 3 secondsPAULA KELLY: Let's try a different number.

Skip to 2 minutes and 5 secondsMICHAEL ANDERSON: OK. So slightly larger. Let's have a look at, say, 17.

Skip to 2 minutes and 9 secondsPAULA KELLY: So if we've got our values of our powers of 2, 16 is the nearest we can get, is the nearest one that's just below our value. So let's have one of those, so a 16.

Skip to 2 minutes and 23 secondsMICHAEL ANDERSON: So if we're at 16, then we're only one away. So 16 add 1 more would give us 17. So if I put a 1 in this column, that means we've got one 16 and one 1. 16 add 1 gives us 7. So I'm just going to pop some zeros in here because we don't need any 2's, We? Don't need any 4's., and we don't need any 8's. So 17 in binary is 1-0-0-0-1.

Skip to 2 minutes and 48 secondsMICHAEL ANDERSON: OK. Let's do 14.

Skip to 2 minutes and 52 secondsPAULA KELLY: So again, we'll scan our numbers and get as near as we can to 14. So 16 is going to be too big. So let's have one of these 8's. So to get from 8 to 14, I need 6 more. So again, our nearest one is 4. We'll have one of those. So far, we've got an 8, a 4, to give us 12. We need two more to get 14. Let's have one of these 2's. We're at 14 already. We need no 1's.

Skip to 3 minutes and 23 secondsMICHAEL ANDERSON: Perfect. So 14 in binary is 1-1-1-0 because we need one 8, one 4, and one 2 to make 14. So knowing your powers of 2 is pretty important.

Skip to 3 minutes and 34 secondsMICHAEL ANDERSON: Shall we look another number?

Skip to 3 minutes and 37 secondsMICHAEL ANDERSON: So we could have a look at 45.

Skip to 3 minutes and 41 secondsPAULA KELLY: So same again. If we find the nearest one we can get to, 64 is too big. Let's have one of these 32's. We'll have one of those. So 32 from 45. Got 13 left.

Skip to 3 minutes and 54 secondsMICHAEL ANDERSON: OK. So the 16 is too big, so we definitely don't need any 16's.

Skip to 4 minutes and 1 secondPAULA KELLY: We're looking for 13. 8 will fit in there. Let's have one of those.

Skip to 4 minutes and 5 secondsMICHAEL ANDERSON: So far, we've got a 32 and an 8, which uses 40. So we're just looking for another 5. So we could have one of the 4's, and then we're only 1 away. So I can put a 1 in the Ones column, and we don't need any 2's.

Skip to 4 minutes and 19 secondsPAULA KELLY: Fantastic. So 45 we made up of a 32, an 8, a 4, and a 1. Altogether got 45.

Skip to 4 minutes and 28 secondsMICHAEL ANDERSON: So 45 in binary is 1-0-1-1-0-1.

Skip to 4 minutes and 34 secondsSo these numbers seem to get quite long quite quickly, but they represent the same number as we do in base 10. Shall we look at one more example?

Skip to 4 minutes and 42 secondsMICHAEL ANDERSON: OK. So let's have a look at the number 31.

Skip to 4 minutes and 46 secondsPAULA KELLY: OK. So very close to one of our powers of 2, but not quite. So we'll have a 16. So 16 away from 31. 15 are left. So we'll need an 8.

Skip to 5 minutes and 0 secondsMICHAEL ANDERSON: And that gets us to 24.

Skip to 5 minutes and 3 secondsPAULA KELLY: So remaining, we just have--

Skip to 5 minutes and 7 secondsPAULA KELLY: So we just need another 4.

Skip to 5 minutes and 9 secondsMICHAEL ANDERSON: Yeah. So that gets us to 28.

Skip to 5 minutes and 12 secondsPAULA KELLY: OK. 3 are left. So let's have another one.

Skip to 5 minutes and 16 secondsMICHAEL ANDERSON: So now we're on 30.

Skip to 5 minutes and 18 secondsPAULA KELLY: So 1 is left.

Skip to 5 minutes and 19 secondsMICHAEL ANDERSON: So another 1 in the Ones column.

Skip to 5 minutes and 21 secondsPAULA KELLY: So 31 in binary is 1-1-1-1-1-1.

Skip to 5 minutes and 26 secondsMICHAEL ANDERSON: So this number is a little bit like having 999 in our base 10 system because 32, what will that give us?

Skip to 5 minutes and 36 secondsPAULA KELLY: That would then carry over all of these. We'd just need one of our 32's. Because we already have the number that we need, the rest of this can be replaced of 0's.

Skip to 5 minutes and 48 secondsMICHAEL ANDERSON: Great. So you might want to have a go at writing some numbers in binary yourself.

# Other number bases: binary

Earlier in the course we saw how base ten works. It is thought that we use base ten as we have ten digits: eight fingers and two thumbs on our hands. We can count using any number as our number base. Students studying computer science are required to be able to work in binary: base two and hexadecimal: base sixteen.

## Binary: base two

Base two only uses the digits 0 and 1. Numbers are grouped in twos. The number 2 is written as one lot of two and no units (10). The number three is one lot of two and one unit (11) and the number four is written as one lot of four, no twos and no units (100).

In base ten numbers are grouped into units, tens, hundreds, thousandths etc i.e. powers of ten. In binary; base two, numbers are grouped into powers of two, units, twos, fours, eights, sixteens and so on. Base sixteen uses the digits 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F. A is the symbol used for ten, B for eleven, C for twelve up to F for fifteen. The number sixteen is written as 10 i.e. one sixteen and no units.

In this video Paula and Michael convert numbers from base 10 into base 2.

## Problem worksheet

Now complete questions 9 and 10 from this week’s worksheet.

## Teaching resources

If you would like to explore further how to convert between binary, denary and hexadecimal then see these teaching resources: