Skip Navigation

De Morgan’s Laws

Augustus De Morgan (1806 - 1871) was a British math professor at London University (now University College London) 1. Among his educational works, he formulated two logical equivalence rules that we recognize today as De Morgan’s Laws. 2 De Morgan’s Laws are equivalence relations, which mean they provide different ways of saying the same thing. We use the symbol ≡ as the equivalence operator, giving us a convenient shorthand for saying that two things mean the same thing.

Page Contents

Video Lecture


Watch at Internet Archive

Optimization of Circuits

De Morgan’s laws appear in a variety of contexts, as they have applications in a number of different areas of logic and mathematics. You have likely encountered them before in classes on logic, set theory, and discrete mathematics. In programming, we use these laws to try to simplify code.

At the architectural level, a major use of De Morgan’s laws is to save money and improve performance. Each gate in a logical circuit has two costs associated with it: the upfront cost of producing the electronic component and the ongoing operational cost from the power required to operate the gate. While the costs of a single gate inside a single circuit are negligible, remember that computers contain billions of circuits and are found in nearly every modern device. Consequently, even tiny savings here and there add up to significant amounts at scale.

A second benefit to reducing the number of gates in a circuit is to increase the speed of the resulting system. Each gate in a circuit takes a small amount of time for its output to stabilize after the inputs are received. The successive small amounts of time spent waiting for gates connected to one another to produce a stable output is called propagation delay, and minimizing the number of gates in series tends to minimize this time.

A + BA·B

De Morgan’s Laws can be presented in either order. I’m going to start with the first one, which is to say that A+B is equivalent to A·B. In English, this relation can be expressed as (NOT A) OR (NOT B) is equivalent to NOT (A AND B), or A NAND B for short. Figure 1 shows a circuit built both ways, driving two different outputs.

equivalent NAND implementations

Figure 1: Two equivalent implementations of NAND in a single circuit. The first output uses more gates and therefore has a slightly higher cost and a slightly slower stabilization time.

If we trace this circuit, we can produce a truth table like the one given in Table 1. Notice that both output columns Q0 and Q1 are the same, proving that the two implementations are equivalent.

Table 1: Proof of the equivalence of Q0 = A+B and Q1 = A·B.
A B Q0 Q1
0 0 1 1
0 1 1 1
1 0 1 1
1 1 0 0

What De Morgan is telling us here is that we can replace a circuit that contains 3 gates (2 NOTs and 1 OR) with a single NAND gate. This change would save us a little upfront cost and ongoing power, and it would also execute slightly faster.

A·BA+B

Another circuit that we can simplify with De Morgan’s Laws is A·B. As shown in Figure 2, a NOR gate is equivalent to this circuit. The English expression is that (NOT A) AND (NOT B) is equivalent to NOT (A OR B), which we can further shorten to A NOR B.

equivalent NOR implementations

Figure 2: Two equivalent implementations of NOR in a single circuit. Once again, the first output is driven by a set of gates that costs more and is slower than the single NOR gate.

We can again prove the equivalence by making a truth table as shown in Table 2. Once again, we see that the two output columns are the same, proving the implementations to be equivalent.

Table 2: Proof of the equivalence of Q0 = A·B and Q1 = A+B.
A B Q0 Q1
0 0 1 1
0 1 0 0
1 0 0 0
1 1 0 0

Once again, De Morgan allows us to replace 3 gates with 1 gate, saving some money and improving performance.

Practice Problems

Try working these problems before revealing the answers.


  1. Draw a circuit containing only one gate that implements A + B.
Show Answer

Use De Morgan’s Laws to simplify A + B to A·B. The result is a NAND gate:

NAND gate


  1. Draw a circuit containing only one gate that implements A·B.
Show Answer

Use De Morgan’s Laws to simplify A·B to A+B. The result is a NOR gate:

NOR gate

References and Further Reading


  1. Sophia Elizabeth De Morgan. Memoir of Augustus De Morgan. London: Longmans, Green, and Co. 1882. Available from the Internet Archive

  2. Augustus De Morgan. First Notions of Logic. London: Taylor and Walton. 1839. Available from Project Gutenburg

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.