Digital systems Computer Architecture . . .
PlainEnglish->computer_science

You are here: Computer ScienceDigital systems → Binary numbers

# Binary numbers

### The difference between digital and analog systems

Ask most people what the difference is between a digital and an analog system, they will tell you that digital is more precise and accurate than analog - whether it be digital TV which is clearer than analog TV, digital recording systems, digital scales, you name it.
That's because digital systems work in a world of black and white: your computer contains millions of tiny electronic switches and circuits - each can be either on or off. Off means around 0 volts flowing through in a particular wire, on usually means something around 5 volts - there's no middle ground. This is why digital systems are so accurate: electric circuits are never perfect, there's always going to be fluctuations and glitches in voltage here and there; but with a digital system these fluctuations don't matter so much, as the circuit concerned will always be correctly interpreted as either on or off as long as the voltage stays on the correct side of a certain critical threshold voltage.

The difference with an analog system, is that with analog, a circuit can have any voltage in a continuous range of voltages, and often the exact voltage is then measured or used in some way in order to produce the desired result. The problem here is that the slightest bit of interference in a sensitive circuit will often change the result.

### Digital systems are more complicated than analog systems

If you think about it, having a circuit limited to being on or off presents certain challenges. Imagine you are building an electronic machine to count up from zero to ten - with an analog system you could have a special 'counting circuit', and keep track of the number you were up to changing the number of volts in that circuit.
How can you do that with a digital system if a circuit can only be on or off? The answer is that you actually need four circuits to provide the required number of possible states

To illustrate the different possibilities, lets use the number 1 to represent 'on', and the number 0 to represent 'off'. Computer scientists actually do this all the time:

 In general:1 stands for 'on'0 stands for 'off'

If we have 4 circuits which can be on or off, these are the possible states:

 Represents: 0 0 0 0 0 0 0 0 1 1 0 0 1 0 2 0 0 1 1 3 0 1 0 0 4 0 1 0 1 5 0 1 1 0 6 0 1 1 1 7 1 0 0 0 8 1 0 0 1 9 1 0 1 0 10

We could keep going. By the way, four circuits actually gives us 16 different possibilities, which means we could actually count from 0 up to 15. That's because every time you add another on/off circuit to the system, you practically multiply the number of possibilities by 2; but we have 4 circuits here, and 2×2×2×2 (or 24) is equal to 16.

### Binary numbers

When we humans count normally in everyday life, we use a number system called decimal, or 'base ten'. This means that for each digit in a number, there are 10 different possible values for that digit. Let me list them: in a normal decimal number (like, say, 355), each digit in the number be either 0, 1, 2, 3, 4, 5, 6, 7, 8, or 9. You can get up to 9 for a particular digit, and then you have to carry over the next digit.

But how would you count if you could only choose between 0 and 1 for each digit? Let's say you start at 0, then 1, then what? You can't go past 1, so you have to carry over the next digit; so the next number you get is 10, then 11, then the nearest number after 11 is 100, and so on. Isn't this how you'd count if you could only choose between 1 and 0 for each digit?

This number system is called 'base two', or binary, and it's exactly how numbers are represented inside computers. Each digit in this system of counting is known as a 'binary digit', or bit for short. Take another look at the above table. See? We were counting in binary the whole time!

Binary numbers 