To understand a little about how computers work, you'll need to know about binary

Click here and log into Brainpop for an excellent overview of binary- If you were asked to count to nine, then you'd probably do something along the lines of the following. (Click to reset)

- But what happens when you want to go higher than nine?
- You suddenly run out of new numbers and have to reuse digits you've already used.

- The counting system we use is called base 10, often called
*denary*. This means we have 10 unique numbers (0 up to 9). When we start counting and reach the number 9 and want to continue, we use a preceding 1 (to indicate that we have a single unit of 'tens'), and then start counting from 0 again. - We're not 100% sure why we count in 10s, but it's probably because we have ten fingers.

- Not all cultures count using base 10.
- Conduct some research online (5 mins) to see if you can find out about other numbering systems used by other cultures.

- Computers
**don't use base 10** - Computers chips are basically constructed from transistors that are organised to act as switches.
- You'll learn more about transistors in the next lesson, but for now think of each transistor as a switch. I can be
*ON*or*OFF*(in much the same way as a light-switch can). - This means that computers use a base 2 numbering system, called
**binary**.*ON*is represented by the number 1 and*OFF*is represented by the number 0.

- Counting in binary looks like this

- You can compare binary and denary numbers below.

- You can convert between binary and denary or denary and binary fairly easily.
- The exercises below will help you learn how to do this.
- To convert from binary - denary
- Click on the cards, so that they flip over, until the number shown below the cards matches the binary number you are trying to convert. (ignoring preceding 0's)
- Count the number of spots that are displayed in total.
- This is your denary number.

- To convert from denary - binary
- Click on the cards to flip them until you have the correct number of spots showing, equal to the denary number you are trying to convert.
- Read off the binary number (ignoring preceding 0's) that are displayed below.

- Try converting 1001 from binary into denary, you should get the number 9
- Try converting 19 from denary into binary, you should get the number 10011

- Have you figured out the general method yet?
- Notice how many spots are on each card - 1,2,4,8,16….
- Let's see if we can use this pattern to convert larger binary numbers.
- Let's try the number
`10100110`

- The number consists of 8
*bits*(We use the term bit to describe each unit) - Let's write out the number

1 0 1 0 0 1 1 0

- Now above the binary number, write the number of spots that would have appeared on each card. (Start on the right, with the number
`1`

and then double it each time.

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

- Now multiply each bit by the denary number above it.

128 64 32 16 8 4 2 1 1 0 1 0 0 1 1 0 X ----------------------------- 128 0 32 0 0 4 2 0

- Now calculate the sum of these numbers

128 + 32 + 4 + 2 = 166

- Have a go yourself with the following binary numbers -
`1001011`

,`1110110`

,`11111111`

- Let's try converting from denary to binary.
- We'll use the number 200.
- We'll start by writing out the spots that would have been on the cards.

128 64 32 16 8 4 2 1

- Now we need to do a little mental arithmetic. Starting from the left, we see that the number 128 can
*go into*200. 200/128 = 1 with a remainder of 72. - Let's write a 1 below the 128

128 64 32 16 8 4 2 1 1

- We're left with a 72 remainder.
- We now move to the next number - 64. 64 can
*go into*72. 72/64 = 1 remainder 8 - Let's write a 1 below the 64.

128 64 32 16 8 4 2 1 1 1

- We're left with an 8 remainder.
- We now move to the next number - 32. 32 can not
*go into*8. - So we write a 0 below the number 32

128 64 32 16 8 4 2 1 1 1 0

- We still have the remainder 8. 16 can not
*go into*8

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

- We still have the remainder 8. 8 can
*go into*8 with a remainder of 0.

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

- As all we have left is 0, we can add trailing 0's to our number.

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

- So our binary number is
`11001000`

- Have a go yourself with the following denary numbers -
`47, 128, 201`

- To get you Silver Badge convert the following numbers from binary to denary & complete the table
- 1001, 1100, 10001, 10101, 1111101, 11001010

- To get your Gold Badge convert the following numbers from denary to binary + the table below & do something you should never do ever again...explain a joke
- 9, 22, 45, 125, 201, 254, 300

Why do some people find this funny

**"There are 10 kinds of people in the world, those who understand binary and those who donâ€™t**

- Adding binary numbers is pretty much the same as adding denary numbers.
- Try performing the following additions
- 100 + 11
- 100 + 100
- 100 + 1100
- 11001 + 10101 Stuck? Try here

Badge It!

- Try performing the following additions