I have to convert the following to NAND only

$$\bar{A}\cdot\bar{B}\cdot\bar{C} + A\cdot\bar{B}\cdot C + A\cdot B\cdot \bar{C} + A \cdot B\cdot C$$

I've looked at the following website: http://en.wikipedia.org/wiki/NAND_logic

And it helped me understand it a lot more however I just don't understand how to put it all together.

I understand for example that if:

$$\bar{A}\cdot\bar{B}$$ using De Morgan's rule I can convert it to NAND $$\bar{AB}$$

However I don't understand how I would convert the following to NAND only $$\bar{A}\cdot\bar{B} + \bar{A}\cdot\bar{B}$$

And so this is the reason I can't do the original equation at the top.

  • 2
    $\begingroup$ What you're missing here is that $\bar{A}.\bar{B}+\bar{A}.\bar{B} = \bar{A}.\bar{B}$ since $A+A=A$ for any $A$. $\endgroup$
    – Sudarsan
    Nov 24, 2013 at 0:21
  • $\begingroup$ $\bar{A}\cdot\bar{B}\cdot\bar{C} + A\cdot\bar{B}\cdot C + A\cdot B\cdot \bar{C} + A \cdot B\cdot C=A \oplus (\bar{B} \ \bar{C})$ $\endgroup$
    – K. Rmth
    Nov 24, 2013 at 13:03
  • $\begingroup$ @user2437672 Isn't A'B' = (A + B)' using De Morgan's rule? How did you get (AB)'? $\endgroup$
    – Leponzo
    Feb 20, 2016 at 14:04

5 Answers 5


To save time, look for simplifications. There is one in the second half: $$A\cdot B\cdot \bar{C} + A \cdot B\cdot C = A\cdot B$$ To express AND as NAND, first apply NAND and then apply NOT --more precisely, "NAND with equal arguments is NOT". Writing $\oplus$ for NAND (I don't know if there is an "official" symbol) this becomes $$A\cdot B = (A\oplus B)\oplus (A\oplus B)$$

The first half is $\overline{B}\cdot (A\cdot B+\overline{A}\cdot \overline{B})$. The only new element here is OR, but that is expressed as "NAND of inverted arguments": $$C+D = (C\oplus C)\oplus (D\oplus D)$$

The rest should be a repetition of the above two tricks.


The Rules:

Convert NOT-operator: $\bar{X} = X\oplus X$

Convert AND-operator: $X\cdot Y = (X\oplus Y)\oplus (X\oplus Y)$

Convert OR-operator: $X+Y=(X \oplus X)\oplus (Y\oplus Y)$

The Procedure (Brute Force Method):

Step 1: Convert all NOT-operators

Step 2: Convert all AND-operators (left to right)

Step 3: Convert all OR-operators (left to right)

(Brackets can change order of precedence.)


I had the same problem, but this web page cleared my confusion. Basically, any SOP can be easily converted to NAND-only and any POS can be converted to NOR-only using De Morgan's rules twice.

In your case, we have the SOP A'B'C' + AB'C + ABC' + ABC = (A'B'C' + AB'C + ABC' + ABC)'' = [(A'B'C')'(AB'C)'(ABC')'(ABC)']'. That's it! Note that each product factor is a three-input NAND while the square brackets here are used for a four-input NAND gate.

If the inputs are directly available in their inverted forms, you can stop here; otherwise, use X' = (XX)' to convert the inverter to NAND logic only.


Let us cheat a little.

By applying NAND to the duplicated argument, you simulate a NOT of that argument.

Then NOT NAND is AND. And NAND NOT (applied to both arguments) is OR.

$$\overline{a\land a}=\overline a,\ \overline{\overline{a\land b}}=a\land b,\ \overline{\overline a\land\overline v}=a\lor b.$$


$$\bar{A}\cdot\bar{B}\cdot\bar{C} + A\cdot\bar{B}\cdot C + A\cdot B\cdot \bar{C} + A \cdot B\cdot C$$

The point of this excercise is to get you to see that when a formula is written as a sum of products (disjunctive normal form) that it can be converted to nands without changing the layout of your circuit, you just replace some gates with nand gates.

First, you can introduce nots in pairs:

$$\lnot \lnot X = X$$

Second, there are 2 ways to represent nand (I'll write with the sheffer stroke, $|$) from 'and' and 'or':

$$A|B = \lnot (A \cdot B)$$ $$A|B = (\lnot A) + (\lnot B)$$

So introduce double negation to your formula as follows:

$$ (\lnot\lnot(\bar{A}\cdot\bar{B}\cdot\bar{C})) + (\lnot\lnot(A\cdot\bar{B}\cdot C )) + (\lnot\lnot(A\cdot B\cdot \bar{C})) + (\lnot\lnot(A \cdot B\cdot C))$$

Rewrite the ands:

$$ (\lnot(\bar{A} | \bar{B} | \bar{C})) + (\lnot(A | \bar{B} | C )) + (\lnot(A | B | \bar{C})) + (\lnot(A | B | C))$$

Rewrite the ors:

$$ (\bar{A} | \bar{B} | \bar{C}) | (A | \bar{B} | C ) | (A | B | \bar{C})\ | (A | B | C)$$

Schematically, it is the same as: for each wire that starts at the output of an and-gate, and ends at the input of the or-gate: add not-gates to the start and end of the wire.

An analogous procedure can be used to convert product-of-sums (conjunctive normal form) to nor-gates.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.