# DeMorgan's Theorem

## Contents |

## Introduction

A mathematician named [Augustus DeMorgan] developed a [pair of important theorems] regarding the complementation of groups in Boolean algebra. DeMorgan found that an OR gate with all inputs inverted (a Negative-OR gate) behaves the same as a NAND gate with positive inputs; and an AND gate with all inputs inverted (a Negative-AND gate) behaves the same as a NOR gate with positive inputs. DeMorgan's theorem states that inverting the output of any gate is the same as using the opposite type of gate with inverted inputs. To put this in circuit terms, DeMorgan's theorem states that the AND gate with inverted output and the OR gate with inverted inputs in the following circuit are functionally equivalent.

Throughout this course, the NOT function is represented as an apostrophe because it is easy to type, like: (AB)' for "A AND B NOT." However, it is easiest to work with DeMorgan's theorem if NOT is represented by an overbar rather than an apostrophe. Thus, you would write rather than . Remember that an overbar is a grouping symbol (like parenthesis) and it means that everything under that bar would be complemented.

## Applying DeMorgan's Theorem

Applying DeMorgan's theorem to a Boolean expression may be thought of in terms of "breaking the bar," or complementing. When applying DeMorgan's theorem to a Boolean expression:

- A complement bar is broken over a group of variables
- The operation (AND or OR) directly underneath the broken bar changes
- Pieces of the broken bar remain over the individual variables.

To illustrate:

This formula shows how a two-input NAND gate is "broken" to form an OR gate with two complemented inputs.

This formula shows how a two-input NOR gate is "broken" to form an AND gate with two complemented inputs.

## Simple Example

When multiple "layers" of bars exist in an expression, only one bar is broken at a time, and the longest, or uppermost, bar is broken first. To illustrate, consider this circuit:

By writing the output at each gate (as illustrated), it is easy to determine the Boolean expression for the circuit:

To simplify the circuit, break the bar covering the entire expression, and then simplify the resulting expression.

```
```

```
```
Expression Simplified
Original Expression
"Break" the longer bar and change to AND
Involution Property

```
```

As a result, the original circuit is reduced to a three-input AND gate with an inverter on one leg:

## Incorrect Application of DeMorgan's Theorem

More than one bar is never broken in a single step, as illustrated by making that mistake with the previous problem:

```
```

```
```
Expression Simplified
Original Expression
"Breaking" both the long and short bars at one time
Incorrect solution due to breaking too many bars at one time

```
```

Thus, as tempting as it may be to take a shortcut and break more than one bar at a time, it often leads to an incorrect result. While it is possible to properly reduce an expression by breaking the short bar first; more steps are required so it is not recommended.

## About Grouping

An important, but easily neglected, aspect of DeMorgan's theorem concerns grouping. Since a long bar functions as a grouping symbol, the variables formerly grouped by a broken bar must remain grouped or else proper precedence (order of operation) will be lost. Therefore, after simplifying a large grouping of variables, place them in parentheses in order to keep the order of operation the same.

Consider the following circuit:

As always, the first step in simplifying this circuit is to generate the Boolean expression, which is done by writing the sub-expression at the output of each gate, as illustrated.

```
```

```
```
Grouping Example
Original Expression
Breaking the longest bar but keep grouping
Involution Property
Distribute (A+BC)
Idempotence: AA=A
Complement: BB'=0
Annihilator: A0=0
Identity Element: A+0=A

```
```

The equivalent gate circuit for this much-simplified expression is as follows:

## Summary

Here are the important points to remember about DeMorgan's Theorem:

- It describes the equivalence between gates with inverted inputs and gates with inverted outputs.
- When "breaking" a complementation (or NOT) bar in a Boolean expression, the operation directly underneath the break (AND or OR) reverses and the broken bar pieces remain over the respective terms.
- It is normally easiest to approach a problem by breaking the longest (uppermost) bar before breaking any bars under it.
- Two complementation bars are never broken in one step.
- Complementation bars function as grouping symbols. Therefore, when a bar is broken, the terms underneath it must remain grouped. Parentheses may be placed around these grouped terms as a help to avoid changing precedence.

## Example Problems

The following examples use DeMorgan's Theorem to simplify a Boolean function.

```
```

```
```
Example DeMorgan Simplification
Original Function
Simplified

```
```