Nicky

# An easy introduction to binary for non-specialist computing teachers

Just been given computing as a new subject to teach?

Had a look through the syllabus and thought “Crikey, what is all this about?”

Never fear, we are here to offer you at least a little help when it comes to that very technical sounding subject of binary.

“But isn’t binary just a load of 0’s and 1’s?”

Well yes and no. It is represented as 0s and 1s but what you have to teach your students is what those 0s and 1s mean.

## So, what is binary?

Binary is an alternative way of storing data. Usually, people start off by learning about binary numbers so that’s how we shall start too.

Computers use electricity, no great revelation there, you may think! Well, you’re right.

But... have you ever considered how all that data and those billions of lines of complex programming instructions that computers need are actually stored inside the computer? Probably not, but it’s a good place to start.

Let’s look at how a computer would store a simple number. We’ll go for the number 6, for no reason in particular, I just like it.

The computer needs to store it as an electrical signal.

Inside a computer chip are billions of tiny things called Floating Gate Transistors (FGTs) which can store an electrical charge. They work by adding (charging) or removing (discharging) electrons to and from the gate which are interpreted as either on (if charged) or off (if there is no charge).

Each FGT is insulated and electrons can only pass through the insulation when a particular current is applied. The oxide traps the electrons in the FGT so they cannot escape until they are forced out by another current.

The great thing about this system is the electrons stay where you put them. So even once the power is removed, the electrons stay in their place until they are moved again, thus allowing data to be stored even once the computer is switched off.

Each of these FGTs represent a single piece of data known as a bit. 8 of them together represent a byte. And to represent the number 6 in a byte, it would look like this.

It may look like a very inefficient way of storing them and you may wonder why they don’t just have 6 FGTs or bits to represent the number 6.

In fact, the system that is used is incredibly elegant. To represent the number 1 billion, instead of using 1 billion bits, it can actually be stored in just 30 bits. And we’ll look at how it can do that in a little while.

## How is binary written?

As we’ve seen, each bit represents either on or off. Now, it wouldn’t be very user friendly to write off, off, off, off, off, on, on, off each time we wanted to write the bit equivalent of the number 6 so we use a shorthand where 0 = off and 1 = on.

Therefore the number 6, written how it would be stored electronically, is 00000110. And that is what binary is. It's a number system that only allows 2 different digits, either a 0 or 1.

In fact, we see that all over the place and it has been used on everyday switches with the 1 representing on and 0 representing off.

And we even have the 0 and 1 combined on some buttons.

## How does the computer use the binary values?

As we’ve seen, binary is used to represent if each of the FGT are charged with electrons or not.

And this is how computers store data, all data, whether that is a simple number, text, an image, sound clip or an instruction.

When we program a computer, we generally use something called a high-level language such as Python, Scratch or a multitude of other programming languages you may have heard of. But the computer needs to convert that language into electrical pulses so it can work with it.

Inside the memory there are separate areas to state whether the FGTs in that area are treated as instructions or as data. In a program, the programmer will also need to state if the data is to be treated as text, a number or image etc.

## Converting numbers into binary

I mentioned earlier that most people start off by converting numbers into binary and that’s where we’ll start too.

The numbers we are taught to use, when we first start to count, are known as decimal, denary or even base 10 numbers and this number system uses 10 digits.

0, 1, 2, 3, 4, 5, 6, 7, 8 and 9

Binary or sometimes known as “base 2”, has only 2 digits.

0 and 1

With both of these numbering systems the smallest digit is on the right. For a decimal system if we look at the number four hundred and fifty-seven, the smallest number (the units) is shown on the right.

Reading from the right to the left, each column is worth 10 times more than the previous column.

The 7 represents 7 x one, the 5 represents 5 x ten and the 4 represents 4 x hundred. Add them together and we get four hundred and fifty-seven (457).

It is the same in binary, the smallest unit is on the right, but with binary each column is worth double the previous one.

For any columns where there is a 1 add up the column values so in this case 4 + 2 = 6.

And there you have it. Our 6 is converted to 00000110 in binary. Usually, people don’t include the leading zeros (the ones on the left before the first 1) so this will usually be written as 110.

10101 would be 16 + 4 + 1 which is 21.

To go back to our earlier example of 1 billion in 30 digits, if you’re interested, it is 111011100110101100101000000000.

## Teaching binary to your computing classes

Teaching binary doesn’t need to be daunting. Introduce your pupils to why computers use binary and help them with converting simple binary numbers into decimal.

There are plenty of hands-on activities you can use to help pupils get to grips with binary to decimal conversion.

One example is my free binary calculator.

When they are ready, you can try the slightly trickier technique of converting from decimal into binary and then look at hexadecimal numbering systems.

There are lots of online quizzes and games you can use to help them convert between different number systems which you can find out about in my previous blog post.

Or you may need some ready-to-use worksheets you can easily incorporate into your lessons with no preparation. They even come complete with answers!

Finally, you may want to explore how binary numbers are used to represent text using ASCII and Unicode and then sound and bitmap images.

My complete 6-lesson data representation scheme of work includes attractive PowerPoint presentations, teacher guide, answers and all worksheets and files. Perfect for a non-specialist teacher. Only available through my website.