# Why do we use the symbols 0 and 1 for two-state logic?

We know a regular computer basically only knows two states and that we name these states 0 and 1 respectively. This seems arbitrary, we could name them "a" and "b", or even 3 and 4. Is there a reason for the convention of naming them 0 and 1 ?

• @gnat again, not a dupe: that linked question is about not-base-2 systems (e.g. fuzzy or analog data representations). This question is about naming or interpreting states in a base-2 system. – amon Jul 28 '18 at 14:14
• Does it actually matter what you call those two states? Only for effective communication with others, the computer doesn't care. – Deduplicator Jul 28 '18 at 14:25
• There are two states, but you could call them anything: a/b, 0/1, red/green, true/false, good/evil, on/off. True/false is sometimes used when talking about boolean logic, but the benefit of 0/1 is that you can treat them as digits in the binary numbering system which meany you have a simple way of representing numbers digitally. Using 3 and 4 would just be confusing for no benefit. – JacquesB Jul 28 '18 at 14:39
• In 1847, George Boole, wrote "THE MATHEMATICAL ANALYSIS OF LOGIC, BEING AN ESSAY TOWARDS A CALCULUS OF DEDUCTIVE REASONING.", in which he detailed a two state numeric system, where multiplication is taken as conjunction and addition as disjunction (and 1-x as negation, as well as the use of strings of 1/0's to represent quantities), creating the foundations of binary arithmetic: we call this boolean logic, and using it we can represent quantities, perform addition, subtraction, multiplication, all based on simple operations (and/or/not) on single binary digits. – Erik Eidt Jul 28 '18 at 15:17

It most certainly is not arbitrary. Computing is rooted in mathematics. Binary notation in mathematics is also known as base-2.

Base-10 gives us 0-9 digits. Base-8 (octal) uses 0-7, and base-16 (hexadecimal) use 0-9 and a-f to represent the extra six digits not present in decimal notation.

The thing is, no matter what base you're using, zero is always zero, and one is always one. So, once you're using base-2 notation, you're pretty much resorting to 0 and 1.

The very earliest computers were actually decimal - used purely for calculations. Then mathematics started to incorporate logic, and computing theory really think of, and thanks to things like Turing completeness, and transistor states (on or off), computer scientists realised that true/false logic and base-2 mathematics were the best way to achieve the general purpose machines we use now.

It's not really true that they are (always) named `0` and `1`. It depends on your point of view.

If you're dealing with numeric values, the computer does it in base-2, having the two digits named `0` and `1`. And as numeric values make for very important computer applications, this naming is indeed very popular.

But a single bit can also stand for a boolean value `false` or `true`, often abbreviated as `F` and `T`.

From an electrical engineering point of view, a bit is represented by one of two voltage levels, being `High` and `Low`, abbreviated as `H` and `L`. And the mapping from H/L to T/F can come in both vesions. The natural mapping is that H stands for 1 or T, and L for 0 or F. But sometimes the hardware designers choose to make L mean the active (true) state of the signal, and H the inactive (false) state: that's called "active-low".

Since machine-code is tagged here, I think it's because you can do number computation based. It's easier to see when you have more than one states to operate on, e.g. a series of 0s & 1s. If you use As & Bs, you can have AA and BB. But it's not clear what operations can you do on whatever represented by those states and you'd probably want to convert them into numbers to reason about them.

On the other hand, if you have 10 and 11, it's very intuitive to do base-2 arithmetic & logical operations on them.

Another way to see it, base-2 is used because the hardware is based on 2 states. It's not hard to imagine (you can emulate in software) to build a machine that can have 3 states that can do base-3 arithmetic on it. Once the exercise is done, you see the cost & benefit of non base-2 systems.