De Morgan’s Laws are two fundamental rules in Boolean algebra that describe how the NOT operation works with AND and OR operations. They are widely used in mathematics, computer science, digital electronics, programming, and logic circuit design. These laws make it easier to simplify Boolean expressions and understand how logical conditions change when they are negated.
The two laws are simple to state, but they have an important practical role. When a complete Boolean expression is complemented, an AND operation changes to OR, while an OR operation changes to AND. At the same time, each individual variable is complemented.
Understanding De Morgan’s Laws provides a strong foundation for working with Boolean expressions, logic gates, conditional statements, and digital circuits. In this article, we will learn both laws, understand their meaning, see how they can be verified, and explore their applications with simple examples.
What Are De Morgan’s Laws?
De Morgan’s Laws are rules in Boolean algebra that explain how complementation interacts with the AND and OR operations.
There are two laws:
First De Morgan’s Law:
(A · B)′ = A′ + B′
This means that the complement of an AND operation is equal to the OR of the complements.
Second De Morgan’s Law:
(A + B)′ = A′ · B′
This means that the complement of an OR operation is equal to the AND of the complements.
Here:
A and B are Boolean variables.
· represents the AND operation.
+ represents the OR operation.
′ represents NOT or complement.
The most important idea to remember is:
AND changes to OR, and OR changes to AND when the whole expression is complemented.
At the same time, every variable inside the expression also becomes complemented.
First De Morgan’s Law
The first law states:
(A · B)′ = A′ + B′
The expression A · B means A AND B.
When the complete expression is complemented, the AND operation changes into OR, and both A and B are complemented.
So:
NOT (A AND B) = (NOT A) OR (NOT B)
Example
Suppose:
Then:
A · B = 1
Therefore:
(A · B)′ = 0
Now consider the right side:
A′ + B′
Since:
we get:
A′ + B′ = 0 + 0 = 0
Therefore:
(A · B)′ = A′ + B′
The two sides give the same result.
Meaning of the First Law
The first law can also be understood using ordinary language.
Consider the statement:
A AND B
For this statement to be false, at least one of A or B must be false.
Therefore:
NOT (A AND B)
means:
NOT A OR NOT B
This is exactly what the first De Morgan’s Law expresses.
Second De Morgan’s Law
The second law states:
(A + B)′ = A′ · B′
The expression A + B means A OR B.
When the complete expression is complemented, the OR operation changes into AND, and both variables are complemented.
So:
NOT (A OR B) = (NOT A) AND (NOT B)
Example
Suppose:
Then:
A + B = 0
Therefore:
(A + B)′ = 1
Now consider:
A′ · B′
Since:
we get:
A′ · B′ = 1 · 1 = 1
Therefore:
(A + B)′ = A′ · B′
Again, both sides produce the same result.
Meaning of the Second Law
Consider the statement:
A OR B
This statement is true when at least one of A or B is true.
For the statement to be false, both A and B must be false.
Therefore:
NOT (A OR B)
means:
NOT A AND NOT B
This is the basic idea behind the second De Morgan’s Law.
De Morgan’s Laws Truth Table
Truth tables provide a direct way to verify Boolean identities.
First Law: (A · B)′ = A′ + B′
| A | B | A · B | (A · B)′ | A′ | B′ | A′ + B′ |
|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 1 | 1 | 1 | 1 |
| 0 | 1 | 0 | 1 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 | 0 | 1 | 1 |
| 1 | 1 | 1 | 0 | 0 | 0 | 0 |
The columns (A · B)′ and A′ + B′ are identical.
Therefore:
(A · B)′ = A′ + B′
Second Law: (A + B)′ = A′ · B′
| A | B | A + B | (A + B)′ | A′ | B′ | A′ · B′ |
|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 1 | 1 | 1 | 1 |
| 0 | 1 | 1 | 0 | 1 | 0 | 0 |
| 1 | 0 | 1 | 0 | 0 | 1 | 0 |
| 1 | 1 | 1 | 0 | 0 | 0 | 0 |
Again, the columns (A + B)′ and A′ · B′ are identical.
Therefore:
(A + B)′ = A′ · B′
The Easy Rule for Remembering De Morgan’s Laws
A simple way to remember the laws is:
When a NOT is applied to a group:
Complement every variable.
Change AND to OR.
Change OR to AND.
For example:
(A · B)′
The AND becomes OR:
A′ + B′
Similarly:
(A + B)′
The OR becomes AND:
A′ · B′
This rule also works for larger Boolean expressions.
De Morgan’s Laws with Three Variables
De Morgan’s Laws are not limited to two variables.
Consider:
(A · B · C)′
Applying De Morgan’s Law gives:
A′ + B′ + C′
Therefore:
(A · B · C)′ = A′ + B′ + C′
Similarly:
(A + B + C)′ = A′ · B′ · C′
For example:
(A + B + C)′
First change OR operations to AND operations, then complement every variable:
A′ · B′ · C′
Therefore:
(A + B + C)′ = A′ · B′ · C′
De Morgan’s Laws for Complex Expressions
The laws become particularly useful when Boolean expressions contain several operations.
Consider:
(A + B · C)′
The complete expression contains an OR operation between A and B · C.
Applying De Morgan’s Law:
(A + B · C)′ = A′ · (B · C)′
Now apply De Morgan’s Law again to the second part:
(B · C)′ = B′ + C′
Therefore:
(A + B · C)′ = A′ · (B′ + C′)
This example shows why De Morgan’s Laws are useful for simplifying and transforming complex Boolean expressions.
The important point is to apply the law step by step rather than changing everything at once without considering the grouping.
De Morgan’s Laws and Logic Gates
De Morgan’s Laws have a direct connection with digital logic gates.
The basic logic gates include:
AND gate
OR gate
NOT gate
NAND gate
NOR gate
A NAND gate is an AND gate followed by NOT.
Therefore:
NAND = (A · B)′
Using the first De Morgan’s Law:
(A · B)′ = A′ + B′
This means a NAND operation can be represented as an OR operation with both inputs inverted.
Similarly, a NOR gate is:
NOR = (A + B)′
Using the second De Morgan’s Law:
(A + B)′ = A′ · B′
Therefore, a NOR operation can be represented as an AND operation with both inputs inverted.
This relationship is extremely useful when designing and simplifying digital circuits.
De Morgan’s Laws in Digital Circuit Design
Digital circuits are built using combinations of logic gates. Sometimes a circuit needs to be redesigned using a different type of gate.
De Morgan’s Laws make this possible.
For example, suppose a circuit contains an AND operation followed by a NOT gate:
(A · B)′
Using De Morgan’s Law, it can be rewritten as:
A′ + B′
This provides an alternative circuit using an OR gate and NOT gates.
Likewise:
(A + B)′
can be rewritten as:
A′ · B′
This allows a circuit using an OR gate followed by NOT to be represented using an AND gate with inverted inputs.
Such transformations can be useful when working with NAND-only or NOR-only circuit designs.
NAND and NOR Gates as Universal Gates
De Morgan’s Laws also help explain why NAND and NOR gates are called universal gates.
A universal gate can be used to construct other basic logic gates.
Because De Morgan’s Laws allow AND and OR operations to be transformed into one another with complementation, NAND and NOR gates can be used to create complete logic systems.
For example, a NAND gate can be used to create an OR function by applying appropriate inversions to its inputs.
Similarly, a NOR gate can be used to create an AND function.
This is an important concept in digital electronics and computer hardware design.
De Morgan’s Laws in Computer Programming
The same logical principles appear in programming.
Suppose a program contains the condition:
NOT (A AND B)
Using De Morgan’s Law, it can be rewritten as:
NOT A OR NOT B
For example, imagine a condition:
NOT (age ≥ 18 AND hasID)
This can be rewritten as:
age < 18 OR does not have an ID
The two expressions represent the same logical condition.
This type of transformation can make complicated conditional statements easier to understand.
Another example is:
NOT (A OR B)
which becomes:
NOT A AND NOT B
These transformations are commonly useful when working with Boolean conditions in programming languages.
Common Mistakes When Applying De Morgan’s Laws
One common mistake is changing the logical operator without complementing the variables.
For example, incorrectly changing:
(A · B)′
to:
A + B
is wrong.
The correct transformation is:
(A · B)′ = A′ + B′
Both variables must be complemented.
Another common mistake is changing AND to OR but forgetting that OR must change to AND in the opposite case.
For example:
(A + B)′
is not:
A′ + B′
The correct result is:
A′ · B′
A third mistake is ignoring parentheses. The complement applies to the complete expression inside the parentheses, so the grouping must be considered carefully.
Why Are De Morgan’s Laws Important?
De Morgan’s Laws are important because they provide a systematic method for transforming Boolean expressions.
They are useful for:
Simplifying Boolean expressions
Designing digital logic circuits
Converting between AND and OR forms
Understanding NAND and NOR gates
Writing and simplifying programming conditions
Analyzing computer hardware
Working with switching circuits
Studying discrete mathematics
Understanding logical complements
Designing efficient digital systems
They also provide a connection between mathematical logic and practical computing.
Practical Example
Suppose a security system allows access when both conditions are satisfied:
The access condition is:
A · B
The condition for rejecting access is:
(A · B)′
Using De Morgan’s Law:
(A · B)′ = A′ + B′
Therefore, access is rejected when:
the card is not valid OR the PIN is not correct
This is much easier to interpret when the Boolean expression is transformed into words.
Another Example
Suppose a system activates when either sensor A or sensor B detects an object:
A + B
The condition in which the system does not activate is:
(A + B)′
Using the second De Morgan’s Law:
(A + B)′ = A′ · B′
Therefore, the system does not activate only when:
sensor A does not detect an object AND sensor B does not detect an object
This demonstrates how De Morgan’s Laws can describe real logical systems.
Summary of De Morgan’s Laws
The two fundamental laws are:
First Law:
(A · B)′ = A′ + B′
Second Law:
(A + B)′ = A′ · B′
The key transformation is:
AND ↔ OR
while every variable is complemented.
In simple words:
NOT (A AND B) = NOT A OR NOT B
and:
NOT (A OR B) = NOT A AND NOT B
These laws can be extended to expressions containing three or more variables and can be applied repeatedly to complex Boolean expressions.
Conclusion
De Morgan’s Laws are among the most important rules in Boolean algebra because they provide a simple way to transform complemented logical expressions. The first law changes an AND operation into OR, while the second changes an OR operation into AND. In both cases, each variable is complemented.
Although the rules are mathematical identities, their applications extend far beyond Boolean algebra. They are used in digital electronics, logic-gate design, computer architecture, programming, and logical decision-making. Once the basic pattern is understood—change AND to OR, change OR to AND, and complement every variable—even complex Boolean expressions become easier to analyze and transform. A clear understanding of these laws is therefore an important foundation for anyone learning Boolean algebra, digital logic, or computer science.
FAQs
1. What are De Morgan’s Laws in Boolean algebra?
De Morgan’s Laws are two fundamental rules used to transform Boolean expressions involving AND, OR, and NOT operations. The first law states that the complement of an AND operation is equal to the OR of the complements: (A · B)′ = A′ + B′. The second law states that the complement of an OR operation is equal to the AND of the complements: (A + B)′ = A′ · B′. These laws are useful for simplifying Boolean expressions, designing logic circuits, understanding digital gates, and writing logical conditions in computer programs.
2. What is the first De Morgan’s Law?
The first De Morgan’s Law states that the complement of an AND operation is equal to the OR of the complements. It is written as (A · B)′ = A′ + B′. In simple words, NOT of A AND B is equal to NOT A OR NOT B. To apply this law, change the AND operation to OR and complement each variable. For example, (X · Y)′ becomes X′ + Y′. This law is widely used in Boolean algebra and digital electronics because it allows an AND operation followed by NOT to be represented using an OR operation with complemented inputs.
3. What is the second De Morgan’s Law?
The second De Morgan’s Law states that the complement of an OR operation is equal to the AND of the complements. It is written as (A + B)′ = A′ · B′. In simple terms, NOT of A OR B is equal to NOT A AND NOT B. To apply the law, change the OR operation into AND and complement each variable. For example, (X + Y)′ becomes X′ · Y′. This law is useful for simplifying Boolean expressions and transforming logic circuits. It is also commonly used when designing circuits with NOR gates and other digital logic components.
4. How can De Morgan’s Laws be remembered easily?
A simple way to remember De Morgan’s Laws is to remember three steps. First, complement every variable inside the expression. Second, change AND to OR. Third, change OR to AND. In short, the logical operations swap when the entire expression is complemented. Therefore, (A · B)′ becomes A′ + B′, while (A + B)′ becomes A′ · B′. A useful memory rule is: “Change the operation and complement each variable.” This method works not only for two variables but also for Boolean expressions containing three or more variables.
5. How are De Morgan’s Laws verified using a truth table?
De Morgan’s Laws can be verified by constructing truth tables for both sides of each equation. For the first law, compare (A · B)′ with A′ + B′ for every possible combination of A and B. Both expressions produce the same output for all combinations: 00, 01, 10, and 11. Similarly, for the second law, compare (A + B)′ with A′ · B′. If the corresponding output columns are identical in every row, the Boolean identity is verified. Truth tables therefore provide a systematic way to prove that De Morgan’s Laws are correct.
6. Can De Morgan’s Laws be applied to three variables?
Yes, De Morgan’s Laws can be applied to Boolean expressions containing three or more variables. For example, the complement of an AND expression can be written as (A · B · C)′ = A′ + B′ + C′. Similarly, the complement of an OR expression is (A + B + C)′ = A′ · B′ · C′. The same basic rule applies: complement every variable and change AND to OR or OR to AND. For more complicated expressions, the law can be applied step by step while carefully maintaining the correct grouping of terms.
7. What is the relationship between De Morgan’s Laws and logic gates?
De Morgan’s Laws describe important relationships between logic gates. The first law shows that a NAND operation, (A · B)′, is equivalent to an OR operation with both inputs complemented: A′ + B′. The second law shows that a NOR operation, (A + B)′, is equivalent to an AND operation with both inputs complemented: A′ · B′. These relationships allow engineers to transform one type of logic circuit into another. De Morgan’s Laws are therefore especially important in digital electronics, where Boolean expressions are translated into physical circuits using logic gates.
8. Why are De Morgan’s Laws important in digital electronics?
De Morgan’s Laws are important in digital electronics because they help designers simplify and transform logic circuits. They allow AND and OR operations to be exchanged when inputs and outputs are complemented. This is particularly useful when designing circuits using NAND or NOR gates. Since NAND and NOR gates are universal gates, De Morgan’s Laws help designers construct other logical functions from them. The laws can also reduce circuit complexity and make alternative circuit designs possible. As a result, they are an essential concept in digital logic, computer hardware, switching circuits, and electronic system design.
9. How are De Morgan’s Laws used in programming?
De Morgan’s Laws can be used to simplify or rewrite logical conditions in programming. For example, the condition NOT (A AND B) can be rewritten as NOT A OR NOT B. Similarly, NOT (A OR B) becomes NOT A AND NOT B. This is useful when creating or modifying conditional statements such as IF conditions. For example, “NOT (user is logged in AND account is active)” can be expressed as “user is not logged in OR account is not active.” Understanding these transformations helps programmers write clearer logical conditions and correctly modify complex Boolean expressions.
10. What is the main rule of De Morgan’s Laws?
The main rule of De Morgan’s Laws is that when a complete Boolean expression is complemented, the logical operation changes and every variable is complemented. An AND operation changes to OR, while an OR operation changes to AND. Therefore, (A · B)′ = A′ + B′ and (A + B)′ = A′ · B′. The easiest way to remember the rule is: “Complement the variables and switch the operation.” This simple principle can be applied to expressions with two, three, or many variables and is useful in Boolean algebra, programming, digital electronics, and logic circuit design.

















