# Why do computers only use 0 and 1?

Why do computers only use 0 and 1? Won't the addition of other numbers such as 2 or 3 speed up computers? Also, 2 and 3 can be used to shorten the bit-length of integers (2 and 3 can be used to end an integer, so that the number 1 only needs one two bits.)..

Why is binary computer more preferred?

It wouldn't speed them up. Now it's easy: to make a basic logic gate like a NAND the logic inputs either pull the output to Vdd or to ground. If you would use intermediate levels you would need FETs to go to levels like Vdd/2 or Vdd/4. This would consume more power, and would require more accurately working components, which would need more time to settle to the final level. If you would stuff more values in a single data unit the required accuracy would increase, as would settling time. The binary system used now just pushes the FET hard to Vcc.

exscape mentions noise immunity, and that's what the accuracy refers to: how much may the signal deviate from nominal. In a binary system that may be almost 50 %, or more than 0.5 V in a 1.2 V processor. If you use 4 different levels they're only 300 mV apart, then noise immunity can't be better than 150 mV, possible 100 mV.

Note that there are Flash devices which use multiple levels to store more than 1 bit in a single memory cell, that's MLC (Multi-Level Cell) Flash. That doesn't increase speed, but packs more data on a single chip.

• Isn't noise immunity one of the main reasons, though? It is at least probably the main reason for digital vs analog. Sep 1 '12 at 10:08
• @exscape - updated my answer. Better now? Thanks for the feedback Sep 1 '12 at 10:12
• Why doesn't it speed them up? With more than two digits we could store data in lesser space, e.g. four in binary = 100 --requires 3 physical locations-- in ternary four = 11 --requires tow physical locations. So in ternary system the processor would have to process lesser number of registers, which would make it relatively faster. Jul 7 '15 at 10:55

Binary level storage and computation are very cheap, small and fast. This text may be oversimplifying, but I guess it gets to the point:

Reading a binary memory cell consists of just one simple comparator doing its job: high / low. Computation comes down to very simple tables of four input combinations (00, 01, 10, 11) to two bit output (0 and 1) mostly.

Now if you have to compare for several possible values, there has to a more complicated comparator setup that is either slower or way bigger than the simple one. Also, the computation tables become bigger, so the computation is also more complicated. While we might save some small area for making storage smaller, everything else, like computation & transport would become exponentially more difficult and slow.

As discussed in another answer, the whole setup also would have to be way more precisely built to keep noise immunity.

All these things combined mean: it is way more efficient to place billions of binary gates on a chip than just half a billion of quaternary ones.

Go around your house, or if you dont have any of these kinds of switches go to a hardware store, see how easy or hard it is to put and leave the switch in the middle of on an off, adding a third state, now try to see if you cant make for distinguished positions. Another example, take a coke can or beer bottle or any other object that is cylindrical and lay it on its side, then balance a marble on the top, how easy and fast and stable is that balanced marble?

using a transistor as a switch is very easy, drive it to one rail or the other, easy to sense the output. Now if you were to try to have all the transistors not be on off switches but instead calibrated to different ranges one for each state (in addition to all on and all off, two middle states as you suggest). Now the entire system has to be much more accurate, expensive, subject to error and failure, etc.

Basically this was tried, an or some early computers tried to be decimal (10 voltage levels), it failed. be it a tube transistor or silicon, it is significantly easier, cheaper, faster, more reliable to use the transistor as a switch and have only two states, lower rail and upper rail.

• I have a volume knob on my music system which goes from 1 to 10. It's very easy to choose the exact volume. I get it right first time every time I use it. So by your logic it would be best to have decimal transistors it seems. Nov 5 '17 at 10:44
• A number of knobs on stereos have two signals that are gray coded, binary, and the state changes indicate an increase or decrease in direction (rotary encoder). Others are analog with an ADC that digitizes the position into ones and zeros. A very old or very purist might not go digital and feed that voltage divider right into the analog amp. But I suspect most dont, usually you can tell. Nov 5 '17 at 14:23

Clearly it can be done. All† digital storage on this planet is 4-state. DNA encodes data as one of four base pairs per bit, arranged in bytes of 3 bits each. Each byte therefore can have 64 different states.

†Except for a infinitesimal fraction artificially created by one of the sentient life forms.

• @Dmit: Yes, but there are still four possible combinations. Take one of the two strands in isolation, and you have four choices at each site, A, G, C, or T. The fact that the other strand is the determined isn't relevant. If what you say is true, then there would only be 8 choices per "byte", when there are really 64, although not all of those codes are used, and some are redundant. Interestingly, mitochondria and chloroplasts have different codings from bytes to amino acids than our nuclear DNA does. Dec 13 '16 at 17:11
• @Dmit: Put another way, A-T is different from T-A, and C-G is different from G-C. Dec 13 '16 at 17:16
• You're right, sorry. Dec 13 '16 at 17:19

Binary number system is made up with 0 and 1, as you know. Other popular or previously used number systems were Octal, Hexadecimal and Decimal number system. Binary, Octal, Decimal and Hexadecimal has 2, 8, 10 and 16 digits respectively. For implementing logic circuits, Binary system is a bit less complex. Why? That's because we can only rely on two digits to construct the circuits. The circuit design is comparatively easier to implement. Using Binary number system in designing circuits is less time consuming, less complex, need less circuit elements and in all aspects it's more affordable than others. Octal and Hexadecimal systems were used earlier in designing computers. But they were complex. The circuitry were complex too. So Engineers started using Binary system for previously mentioned advantages.

• AFAIK, octal and hexadecimal systems weren't used by hardware. They were and are still (even octal) used by software because they conveniently pack several bits into one unit. Eg. an octal digit is exactly three bits and a hexit (hexadecimal digit) is exactly 4 bits. What would you rather say 0b11111111 or 0xff? Apr 5 '17 at 18:26

Why is a binary system used instead of decimal system

Good question. Actually, there exist computers that don't use the binary system. These computers, constructed from op-amps, are called ANALOG computers. The analog computers can add, subtract, multiply and divide, and even do some types of integration.

Why is binary computer more preferred?

Binary computers are more accurate, sometimes. Also, binary computers (like my laptop) can be millions of time more complex. I guess. Analog computers need to be operated in certain limited conditions, and give limited answers. You can make a digital computer as complex as you want.

In addition to the other answers, I worked out native digital circuits for trinary logic. I think a complete set exists that runs just as fast as the binary logic circuits (meaning we get the 1.5x performance boos); however it has a high cost. The circuits burn energy in the idle state (not just when switching) and so you have so much heat to dump it's not worth it for modern CPUs. It could barely benefit on a main bus.