As NAND and NOR gates are universal gates, there are often questions like:

Make the output \$f = (a + b')(cd + e)\$ using NAND gates.

The problem I face is that I take a long time to first convert these logic functions into AND and OR gates and then to NAND. Either the concept isn't clear or I'm just mugging it up. What are some tricks to doing these problems more quickly?


1 Answer 1


Two possible ways. You might just learn how to represent, say, OR and AND gates with NANDS, and then replace every occurrence of ORs and ANDs with this implementation. But it might lead to a non-optimal solution. The second approach would be to use Boolean algebra and convert your expression to the representation suitable for the specific gate used. In your example:

 f=(a+b')(cd+e) = (a'b)' ((cd)'e')'.

Now you need only know how to implement the NOT gate with NAND, and implement the expression as is, since the only operations are AND/NAND and NOT.

Upd: The most useful boolean algebra rule to use here is Da Morgans laws which state:
A'+B' = (AB)' (Voila! Couple of NOT's and OR are turning NAND!)
A'B' = (A+B)' (Couple of NOT's and AND are turning NOR!)

  • \$\begingroup\$ can u also please explain how to make exclusive or and some other...is there a trick?I have seen one bubble trick which i didnt understand \$\endgroup\$
    – vespo
    Feb 10, 2015 at 16:20
  • \$\begingroup\$ The trick called boolean algebra. The "Da Morgan's laws" are the most useful for this kind of transformations. See update \$\endgroup\$
    – Eugene Sh.
    Feb 10, 2015 at 16:52
  • \$\begingroup\$ Exclusive ORs (XOR/EXOR) do not form a complete system, i.e. are not "universal gates". You can't use only XORs to implement any system. \$\endgroup\$
    – Eugene Sh.
    Feb 10, 2015 at 17:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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