# Logic Gates in circuits

We can make all the gates using nand or nor gates. My teacher told us that nand gates are cheap too, then why do we need other gates at all?

• What makes you think that anything other than NAND gates are used during fabrication? – Derek Elkins Sep 21 '17 at 0:31
• Related question: cs.stackexchange.com/questions/63687/… – Pseudonym Sep 21 '17 at 8:07
• Long story, but the short version is that so-called "digital circuits" are really analogue circuits when you actually try to build them. Inverting gates are better-behaved than non-inverting gates when you realise them in CMOS. – Pseudonym Sep 21 '17 at 8:16
• @Pseudonym whhhat. To see why we use inverting gates, try to make any other gate from an and or or. And the circuits is circuits bit, while correct (when viewed from the right direction), is confusing. – ctrl-alt-delor Sep 22 '17 at 18:35
• @ctrl-alt-delor I'm well aware that inverting gates are functionally complete. In practice, real (combinational) circuits are built from NAND, NOR, and NOT gates, not because we can't build non-inverting CMOS gates (we totally can), but because non-inverting gates are not as well-behaved when understood as analogue circuits. – Pseudonym Sep 23 '17 at 8:44

They logically exist, you can not un-invent them. Even if no one ever made one, they would still exist in your mind.

If is easier to say “open door if I want to go through door or you want to go through door” than to say “open door if I don't want to go through door nand you don't want to go through door”

# An alternate question — Why do we build devices with just one gate? i.e. nand or nor?

We do this because it makes the electronics simpler, if all the devices are the some, as we only have to implement one type of gate. This is about simplicity of the device, not of the logic (as this could be a bit more complex). This logical complexity could push the size up, but the symmetry of all gates being the same pushes the size down. Also a lot of the logical complexity can cancel out.

# A similar question — Why do we have multiply in maths. When we can do everything with addition?

• Why do we have addition when we can just use increment: 3+4 = 3+1+1+1+1
• Why do we have multiplication when we can use addition: 3×4 = 3+3+3+3
• Why do we have exponentiation when we can use multiplication 3⁴ = 3×3×3×3

If you were to continue to look inside the computer, then you will see that it is,some what, like this:

• transistors → nand or or
• nand or nor → all logic gates
• I don't see how this answers the question. For example, the three-input gate that implements the function $((x\rightarrow y) \land z) \lor (x\land \neg y)$ "exists in my mind" but nobody ever talks about it. Whereas the gate implementing the function $x\lor y$ exists in my mind but people do talk about it. – David Richerby Sep 20 '17 at 17:40