# What language do computers speak?

### CS Blog 2/52

Computers don’t understand English. Or french, Urdu or Toki Pona for that matter. They only understand numbers. Or to be more specific about it, they only understand zeroes and ones. Or to be even more specific about it, they only really understand something being either ‘on’ or ‘off’, thereby represented by a zero or a one. But I’m getting ahead of myself.

The language that computers speak is the language of binary. “What is binary?”, I hear you say. Well, allow me to wow you with my ridiculously in-depth knowledge on the subject. Or allow me to make you go ‘eh’ with my mediocre understanding and laxidaisical explanations. Either’s fine with me.

To understand what binary is, we first need to consider what regular ol’ numbers are, in a slightly abstract way. Take for instance the number 1,498. To write that figure in letters requires me to type one thousand, four hundred and sixty-eight. That’s a total of 36 letters, four spaces, one hyphen and one comma. Whereas I could alternatively just type 1,468. Much easier, and yet it conveys the same information. Here’s where we get a little bit abstractamundo. What is the information that both the phrase one thousand, four hundred and ninety-eight and the digits 1,468 both convey? Well they convey the idea of a number. The concept of 1,468 is a concept of that number of items. What items? At the moment, we don’t have any clue. We simply know that there’s 1,468 somethings.

The reason that typing 1,468 is much easier than typing its text namesake is because that simple set of four numbers is, in actual fact, cheating. It’s cheating because all it really states is the number 1, the number 4, the number 6and the number 8. Yes they’re in order, but so what? They still only count for four items of information. But we understand this combination of figures as representing a much larger number because we have been taught the place value system.

Imagine, if you will, the number 1,468 drawn on a piece of paper. Now, imagine drawing vertical lines between each of the numbers, starting at the base of the number, and rising up past the top of it and then about an inch further. Now imagine a horizontal line that disects all of the vertical lines, above the numbers that they separate. You’ve just put 1,468 into a table. Well done you. Now, where the vertical lines poke through the horizontal line, formining rugby goal shapes, you can write some words. In the furthest space on the right hand side, above the bot of the horizontal line that hovers over the ‘8′, you’re going to write the word ‘ones’. I think you can see where I’m going here. One column to the left of the ‘ones’ you will write ‘tens’, and then ‘hundreds’ and then ‘thousands’.

Now, though we don’t actually draw tables like this over our numbers, this is exactly what we are doing in our brains when we see an arrangement of numbers like ‘1,948′. We’re doing some mental maths. Namely:

• This number contains ‘8′ lots of ‘ones’, which is equal to ‘8′.
• This number contains ‘6′ lots of ‘tens’, which is equal to ‘60′.
• This number contains ‘4′ lots of ‘hundreds’, which is equal to ‘400′.
• This number contains ‘1′ lot of ‘thousands’, which is equal to ‘1000′.
• Therefore the total number is 1000 + 400 + 60 + 8 = 1,468.

Of course, you can keep on going further to the left and rfurther to the write, on this imaginary table. Further to the left you get ‘ten thousands’, ‘hundred thousands’, ‘millions’, and so on. Further to the right you get ‘tenths’, ‘hundredths’, ‘thousandths’, and so on. Now, what’s important to understand about this system is that there is a pattern for getting from one column to the next. If you begin on the ‘ones’ column, you multiply one by 10 to get to the value of the next column, whicch is ‘tens’. Then to go further left, you multiply by 10 again. To move to the right, you divide by 10. That’s why the column to the right of the ‘ones’ column is ‘tenths’. Because 1 divided by 10 is one tenth. So we divide by 10 to move right, and multiply by 10 to move left. The common factor either way is the number 10.

And that is why this system of counting and thinking about numbers is known as ‘base 10′. Comprende? Good. Now, the fact that our widely used system of counting is known as ‘base 10′ begs the question: ‘are there other systems of counting?’ You betcha there are. You can, in fact, count in any darn base you like. So, for instance, if we wanted to count in ‘base 9′ we would simply do exactly what we did for ‘base 10′, but instead of multiplying or dividing by 10 each time, we’d multiply and divide by 9. Goodness knows why on earth you’d want to engage in such a despicable act, but that’s by the by. This is what it’d look like if we calculated what ‘1,468′ was in ‘base 9′ as opposed to good old fashioned base 10:

• There would be ‘8′ lots of ones. So that’s OK.
• There would be ‘6′ lots of nines. Eew. OK, that’s 54.
• There would be ‘4′ lots of eighty-ones (i.e. 9 x 9). Postively rank. That’s 324.
• There would be ‘1′ lot of seven hundred and twenty-nines. That is 729 again.
• Added together it would be 8 + 54 + 324 + 729 = 1,115 (in old money).

Like I said, I have no idea what kind of sick, twisted psychopath would use base 9 as a counting system but it is at least hypothetically possible.Now, this is where computers fit in. If you keep on going down, to base 8, 7, 6, 5, 4, 3 and then base 2. Here’s where we’ll stop. Now, instead of calling it ‘base 2′ like dweebs, let’s start calling it binary, so that everyone knows that we’re badasses, and that we mean serious business. Now, remember the imaginary table you drew? Good. Now, the important thing about that table is the rule that as you go to the left, you multiply by 10, and as you goto the right, you divide by 10. Let’s not think of ‘10′ anymore, but rather think of any number, which we’ll call ‘n’. Another way of thinking of a hundred is 10 x 10, or 10 to the power of 2. So the exponent increases by one, each time we move to the left, and decreases by one, each time we move to the right.

Instead of our value of n being ‘10′, in the binary system it is ‘2′. So our imaginary table would start a column called ‘ones’. That’s because 2 to the power of 0 (which is the centre of any base counting system) is 1. Move to the left and we have a column called ‘twos’. That’s because 2 to the power of 1 equals 2. Further to the left we have ‘fours’ (2 ^ 3), ‘eights’ (2 ^ 4), ‘sixteens’ (2 ^ 5) and so on.An important thing I forgot to mention is that the ‘base’ number of a counting system also acts as a limit for the number of integers you can use. So when counting in base 10, we are limited to 10 integers. Those integers are 0 through to 9. After we get to 9, we write ‘10′. But we’re not using any more integers, we’re just recycling old ones. A ‘1′ moves into the ‘tens’ column, and then a ‘0′ sneaks into the ‘ones’ column. To go to base 11, base 12 and so on, you would actually need additional number symbols to allow you to do so.

So with base 10 counting, we are limited to the integers from 0 to 9. In base 9 counting, we would only have the integers from 0–8 at our disposal. Etcetera etcetera. So by the time we get to base 2, I mean, binary, we only have two measly integers to deal with. 0 and 1. Welcome to the wonderful world of zeroes and ones.So, to go back to our initial number of 1,498. When you think about it, there’s actually an awful lot going on here. Each of those squigggles we call ‘integers’ is just a mark on a piece of paper (or a screen) that symbolises an abstract entity we know of as a number. The very order those symbols are in allows us to calculate a larger number, through our abstract counting system, known as ‘base 10′. And we are able to somehow hold in our minds the very idea of 1,468, without necessarily qualifying it with a what. Weird, and wonderful indeed.

To render this number in binary, it’s helpful to work out what the imaginary column headings would be. We’d start with 1, then go left to 2, 4, 8, 16, 32, 64, 128, 256, 512, 1048. Let’s stop there because that’s enough. Then, we’d just ask ourselves, ‘how many lots of x column are there in 1,498?’ So let’s do just that (remembering that the answer can only be 1 or 0):

• How many 1024s are there in 1,468? Answer: 1. (This is our first digit).
• Now subtract 1024 from 1,468, which gives us 420. (This is because the amount ‘1024′ has now been registered by a ‘1′ in that column. So we can discount it, and work with the rest of the number now).
• How many 512s are there in 444? Answer: 0. (This is our second digit).
• How many 256s are there in 444? Answer: 1. (Third digit).
• Now subtract 256 from 444, which gives us 188.
• How many 128s are there in 188? Answer: 1. (Fourth digit).
• Now subtract 128 from 188, which gives us 60.
• How many 64s are there in 60? Answer: 0. (5th digit).
• How many 32s are there in 60? Answer: 1. (6th digit).
• Now subtract 32 from 60, which gives us 28.
• How many 16s are there in 28? Answer: 1. (7th digit).
• Now subtract 16 from 28, which gives us 12.
• How many 8s are there in 12? Answer: 1. (8th digit).
• Now subtract 8 from 12, which gives us 4.
• How many 4s are there in 4? Answer: 1. (9th digit).
• Now subtract 4 from 4, which gives us 0.

It feels foolish to keep going, but we actually need to. We need to know where our number will end, though we know there will only be zeroes from now on.

• How many 1s are there in 0? Answer: 0. (11th and final digit).
• How many 2s are there in 0? Answer: 0. (10th digit).

Phew! That was some hard graft! If we put all those zeroes and ones together, we get this:

OK, that was a lot of effort, and you may reasonably be asking yourself why bother with all this stuff and nonsense in the first place. Well, the reason this is all of value, is because these strings of ones and zeroes are the key to computers understanding our world and vice versa. When you input something into your computer, a programme will convert your input into a string of ones and zeroes. Binary, in other words. And in this sea of simple shapes, a line or a circle, the computer is able to perform magical tasks at incredible speed.

But why? Why do we bother with binary? Why can’t computers just understand numbers in a regular base 10 fashion like the rest of us? Well, it goes back to something I mentioned in my previous blog post, namely that computers are basically speedy simpletons. They literally do not understand anything more than zeroes and ones. But actually, its even more basic than that. They don’t even undertsand zeroes and ones, technically. They are simply able to recognise when an input is ‘on’, versus when that same input is ‘off’.

Imagine that nice-but-dim cousin of yours. Jeff, I think his name is. Now, imagine that you have a system in place with Jeff, that serves him well at social functions. When you give Jeff a thumbs up, he gives a big old smile. When you give Jeff a thumbs down, he looks suitably morose and forlorn. Thrrough this ingenious code, you are able to ensure that Jeff’s outward display of emotions are appropriately tactful at both your great-aunt’s funeral, and your step-sisters wedding. If you want to make it even simpler, you can actually get rid of one of the symbols, and just say that the other is the ‘default’. So Jeff beams at all times, 24/7, until he sees the thumbs down symbol from you.What Jeff is doing, is basically what a computer does. It does one thing when the input is ‘off’ (i.e. the default position), and another thing when the input is ‘on’. Now, what separates Jeff from a computer is simply a matter of speed. Whereas Jeff can change from frowny face to smiley smile in a split second if necessary, the computer can perform millions of outputs (albeit simple ones) in a matter of milliseconds. Because a computer does so many things (i.e. performs so many outputs) in such a small amount of time, those simple outputs accrue into what appears to be quite a complex set of functions. Computers are really very simple, but they cleverly disguise their lack of complexity with their rapid speed.

To come back to binary, then, computers speak the language of binary, because it is the only language they can speak. The computer understands an input of ‘on’ as the value ‘1′ and an input of ‘off’ as the value ‘0′. When you consider that the computer is materially composed of electronic chipboards and whatnot, those values of ‘off’ and ‘on’ correlate to electrical currents, which can be switched on and off accordingly.

Perhaps I’ve been a bit harsh on computers. They are really quite remarkable. And they can certainly do things that we can’t. But at their core, they are basic creatures that perform one function extremely quickly. By understanding offs and ons as 0s and 1s, computers are granted the gift of language. And languages, even a simple ones, contain within them the potential for staggering, possibly even infinite, complexity.

A short poem, summarising this blog post:

Computers don’t speak english, they speak a language called binary,

This was a long blog post, but it’s over, finary.