DRIVE A: READY_
WELCOME!

You've found my articles! Please be kind and rewind.

C:\INSERTDISK2\ARTICLES\BINARY>

Binary Explained Simply

Why computers count in 1s and 0s, and why you probably shouldn't be scared of it.

A Binary representation

If there is one subject that seems to upset computer science students, it's binary. I have no idea why. But even the mention of it sends people running from classrooms.

The argument I hear, well not literally, (a little deaf joke) is, why does it matter? To be fair, it's a good point. No one sits down these days and writes code in binary. No one is busy writing the next generation full immersion 4k graphics in 1s and 0s even though RockStar seems to be taking that long.

So why does it matter?

It probably doesn’t, not to most people, they are happy the computer works and thats the end of it. But if you really want to be a computer science type person (technical term) then you should at least understand the basics. In the same way, a doctor should know the basics of how the body works even if they only deal with one aspect; a computer science student should understand binary.

The funny thing is, it's actually not that hard to understand. If you can count to 10, you can figure out binary.

What is binary?

Binary is a base 2 counting system.

Calm down, it’s nothing bad, just breath. You see you, me, I would imagine most of the planet count using a base 10 system. We call it Decimal (or, if you want to be very posh, denary; don’t worry, they all mean the same thing). This means there are 10 digits that can be used:

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

When you reach 9 and run out of digits, you just start again the pattern, but you need some way of recording that you have already reached 9 once before; otherwise, you will just be counting to 9 over and over again. So we need to put a mark somewhere. Thankfully, we have position columns. The first position is called units so the digits 0 to 9. The next position is for tens so in that position we put the marks for how many tens we have.

10, 11, 12, 13, 14, 15, 16, 17, 18, 19

Then, when you hit the next 9, you need to record you have hit another ten so you add another 1 to the 1 that is already there, and you get:

20, 21, 22, 23…

It's a simple system, and it works as far as you want to go. When I was at school, this was called:

Tens and Units.

When you reach 9 with the tens, you once again move to the next position column and start recording there.

100, 101, 102…

Now it's Hundreds, Tens and Units.

This can continue for as long as you like each time you reach the 9 limit on a position you simply add 1 to the next position column.

We count like this because 10 is a good number for humans. We have 10 fingers, 10 toes; it makes sense that 10 would be our go-to number. Had we evolved with 12 fingers and toes, we would no doubt have adopted a base 12 number system.

Binary Is Also Cool

Binary works in the exact same way that decimal works, the only difference is the number of digits you can use. As I said binary is a Base 2 number system so we can easily deduce that there are two digits to use.

0 and 1

So let's count in binary.

0, 1

That was quick, so what do we do when we reach 1? Well, what do we do in Decimal? We add a 1 to the next position column and start again.

0, 1, 10, 11

And so each time we hit 1, we move it along.

0, 1, 10, 11, 100, 101, 110, 111…

It's no different to Decimal, it’s just less digits to actually work with.

But I hear you cry!

“111, what number is that?”

Well, it's 111, that's the number.

The question you should perhaps be asking is

“What is the decimal equivalent of the binary number 111”

111 is a binary number

7 is a decimal number.

It might sound pedantic, but it really isn't meant to be. But people get very hung up on “what number is it though” rather than “what is it in decimal”.

I am not suggesting that the next time you are buying a drink, ask which base system they are using, although when the London coffee shops charge £11 for a coffee it might be worth checking.

When you are working with different number bases it is a good idea to let people know which system the number you are writing belongs to and for this we use Subscript.

1112

710

Notice the cute little numbers? They are the subscript which tell us what base we are talking in. It’s a useful system and when talking in multiple bases it is a really good idea to use them.

Converting Binary to Decimal

The next obvious question, of course, is how do you convert base 2 to base 10? Well, it’s actually really easy.

Let's start by putting the binary number down in a position table

1 1 1

We need to name the positions:

4 2 1
1 1 1

Now all we need to do is add up the position numbers that contain a 1 which is this case is all of them so we have 1 four, 1 two and 1 one which is:

4 + 2 + 1 = 7

I will give you a longer binary number: 10110101

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

With the longer binary number, you should be able to spot the obvious pattern with the position names. They double the previous number; that's the beauty of binary for me, it makes it so easy to remember.

So we have:

128 + 32 + 16 + 4 + 1 = 181

How easy is that!

Converting Decimal to Binary

Once you can convert from decimal, it’s a simple step to convert into binary.

76 is our decimal number:

  • Does 128 fit? No → 0
  • Does 64 fit? Yes → 1, leaving 12
  • Does 32 fit? No → 0
  • Does 16 fit? No → 0
  • Does 8 fit? Yes → 1, leaving 4
  • Does 4 fit? Yes → 1, leaving 0
  • Does 2 fit? No → 0
  • Does 1 fit? No → 0
128 64 32 16 8 4 2 1
0 1 0 0 1 1 0 0

64 + 8 + 4 = 76

It’s easy and quick. The most you have to do is a few quick addition calculations. There is, of course, a very mathematical way to do both conversions, which I will post here rather than in this article because I fear the minute someone sees actual maths they might simply zone out.

So now you should be able to understand binary; next we need to look at why computers use it.