Why do Computers use Binary Numbers?

Why do Computers use Binary Numbers?

If we want to perform calculations using electrical circuits, one method we could use is varying the voltage in a wire. For example say we want to create an electrical circuit to multiply a number by two, we could arrange for a dial that produces a particular voltage that represents a number. When the dial is set to 1, then it outputs 1 volt. When the dial is set to 2, then it outputs 2 volts and so on. Then we may connect this dial to a electrical device that has a multiplying effect. For example it causes twice the input voltage to appear at its output. So if we put 1 volt into the electrical multiplier, then we get 2 volts out. If we put 4 volts in then we get 8 volts out and so on. Then we might have a meter on the output that measures the output voltage. Hence to perform a multiplication, we set the dial to the number we want to multiply and read the meter to get the output voltage which represents the result of the calculation.

This style of circuit is exactly how some of the oldest computers used to work and is called an analogue computer. The problem with this technique is precision. Electrical wires tend to lose voltage with distance. So if we put 2 volts in, by the time it gets to the voltage multiplication device, it might only be 1.9v. Therefore the reading we get out has a slight inaccuracy and the meter we read the result from may show a multiplication result of 3.8 volts instead of the true answer of 4 volts.

The accuracy problem is not just limited to wires. Each of the components in the circuit can only be manufactured with a certain precision. The electrical multiplier may not exactly multiply by 2 but may actually end up multiplying by 1.99. The meter we read the answer from may not be able to precisely read 4 volts, but may read 4.01 volts instead. Hence the errors in the calculation compound with each extra device we use. Even worse, the accuracy of electrical measuring devices tends to drift over time and it may need to be recalibrated after some years, and each one we manufacture will be just very slightly different. If we want a more complex calculation, we need to put more devices in the circuit, each of which is slightly inaccurate, producing a progressively worse result the more devices we need to use to do the calculation.

Wires are subject to picking up “noise”, that is stray electrical signals around in the environment. Such signals can come from transmitters (like wi-fi), nearby electric motors or even the weather. We might pick up some spurious electrical signal which changes the voltage in the wires and makes the accuracy even worse and perhaps unpredictable. Sometimes the stray signal is there in the environment and sometimes it is gone. Other environmental factors, particularly temperature, also affect the accuracy of electronic measurements. We might get a slightly different result every time we use the calculator, which would be very confusing.

Digital computers aim to solve this accuracy problem using binary numbers. Binary numbers use only two digits, 1 and 0. This is represented electrically by saying that if there is a high voltage on the wire, it represents a 1 and if there is (close to) no voltage on the wire then this represents a zero. This means there is less scope for misinterpretation and hence calculation inaccuracies to sneak in.

Say, for example, we decide that 5 volts on the wire means the digit 1 and zero volts means the digit zero, if we send a 1 digit and the 5 volts representing the number has dropped to 4.9 volts due to electrical losses or component inaccuracies, at the receiving side we see that the voltage we received is much closer to 5 volts than it is to zero. Therefore we can conclude that it is likely to have been a 1 digit that was intended by the sender and not a 0 digit. In the digital system we can even correct the voltage received back to 5 volts again and remove the error as we are sure what was originally meant. Note that if we were using the voltage on the wire to directly represent a number, as in the analogue system, we could not perform such a correction. If we were using 5 volts to mean the number 5 and we receive 4.9 volts, how would we know if the sending device meant to send the number 4.9 or whether there were electrical losses on the wire causing us to be 0.1 volts short? We can’t know for sure and therefore we can’t do the correction.

When we send the corrected voltage onto the next device, due to some losses it might receive a lower voltage again due to some losses. However, we again know that it must have been 5 volts that was originally intended and can confidently correct the voltage back to 5 volts again. We can therefore continuously send the 1 digit in a chain as many times as we like (thousands or millions of times) and always be sure we will get the originally intended 1 digit out the other side.

The problem we have now is how do we do calculations using only the digits zero and one?