# Working with binary

`1`

and `0`

– and the rather bold statement was made that, using just these symbols, it can do any computation!How can this be? How can you even add up two numbers, say 12 and 6, if you only have the ability to use `1`

s and `0`

s?To answer this question, we should first take a brief look at the nature of numbers. When you were learning to do basic arithmetic, when you were a child, you probably learned about counting in ones, tens, hundreds and thousands.This is called base 10. When writing down numbers, you begin at 0, count up to 9, then go back to 0 again, but add an additional digit in the next column.You could ask yourself, why is it we have 10 separate symbols to represent all our numbers? Why not 5? Then counting would look like this:The answer is most probably because we have 10 fingers and thumbs, although it’s not really known. Some cultures around the world count in different bases, and most people in the world are fairly happy using base 12 and base 60 when telling the time.The Turing machine uses base 2, or what is often called binary. Here’s an example of counting in binaryYou might recall that this is exactly what your Turing machine did in the last step.So to answer the original question – how could a Turing machine add the numbers 12 and 6? – the answer is that the machine would use the binary representations of these numbers.## Converting binary to denary

Here’s an example of simultaneously counting in both binary and denary.So how can we convert from one to another?We said earlier that when you were learning about numbers as a child, you probably used the terms ones, tens, hundreds, thousands. These are all powers of 10.We can then arrange these values horizontally to be used as headings.Now we can write in a number – in this case

`09032`

– and we can see that it is made up of `0 x 10000`

, `9 x 1000`

, `0 x 100`

, `3 x 10`

and `2 x 1`

:In binary we can do the same thing, but using powers of 2.Again, a the values are arranged as headings.As we did with denary, we can write in a binary number such as `10111`

.Now we can see it is made up of `1 x 16`

, `0 x 8`

, `1 x 4`

, `1 x 2`

and `1 x 1`

. So if this was in denary it would be the number 23.Have a practice on the following binary numbers and see if you can work out what they would be in denary. There’ll be a quiz on this in the next section.`1010`

1001

10001

Converting numbers back the other way isn’t much more difficult. If we wanted to convert the number `21`

into binary we would do it like this:We keep dividing the number by a power of two, and then using the remainder for the next division.Reading off from the table, we can see that `21`

in binary is `10101`

.Have a go at converting the following denary numbers into binary.`7`

15

40

You can compare your answers in the comments section, or even challenge each other to do more binary to denary and denary to binary calculations.#### How Computers Work: Demystifying Computation

## Our purpose is to transform access to education.

We offer a diverse selection of courses from leading universities and cultural institutions from around the world. These are delivered one step at a time, and are accessible on mobile, tablet and desktop, so you can fit learning around your life.

We believe learning should be an enjoyable, social experience, so our courses offer the opportunity to discuss what you’re learning with others as you go, helping you make fresh discoveries and form new ideas.

You can unlock new opportunities with unlimited access to hundreds of online short courses for a year by subscribing to our Unlimited package. Build your knowledge with top universities and organisations.

Learn more about how FutureLearn is transforming access to education