Free Study Material
Every digital circuit inside a computer, no matter how complex, is built from the same simple mathematical foundation: Boolean Logic, developed by mathematician George Boole.
Boolean Logic works with variables that can only ever hold one of exactly two possible states — conventionally written as:
Three basic operators combine these values:
. (dot) — like multiplication.+ (plus) — like addition.' (prime/apostrophe) — inverts a single value.The reason computers are built on Boolean logic specifically is physical, not just mathematical: a transistor is naturally either conducting electricity or not — a perfect physical match for a system with only two possible states. Every more complex digital operation ultimately reduces back to these three operators.
Note: The "+" and "." symbols in Boolean algebra look like ordinary arithmetic, but mean OR and AND respectively — not addition and multiplication, even though many of Boolean algebra's laws happen to resemble arithmetic ones.
Boolean Logic, developed by George Boole, works with two-state (1/0, True/False) variables combined using AND (.), OR (+), and NOT ('). This binary, two-state foundation is exactly why it maps naturally onto digital electronic circuits.
In our daily lives, we deal with infinite shades of grey. However, inside a computer, everything is Black or White. This mathematical world was defined by George Boole. In this system, every variable can only exist in one of two states:
| Gate Name | Operation | The "Logic" Rule |
|---|---|---|
| NOT Gate | Inverse / Complement | It flips the input. 0 becomes 1; 1 becomes 0. |
| OR Gate | Logical Addition | Output is 1 if any input is 1. |
| AND Gate | Logical Multiplication | Output is 1 only if all inputs are 1. |
These laws are used to simplify complex circuits, making them faster and cheaper to manufacture.
A Boolean Variable is a symbol (usually uppercase letters like A, B, or X) that represents a logical state. Unlike algebra where x could be any number, in Boolean logic, A can only ever be 0 or 1.
Just as standard math has +, -, and x, Boolean logic has its own operators:
| Conjunction | Represented by a Dot (.) | Commonly known as AND |
| Disjunction | Represented by a Plus (+) | Commonly known as OR |
| Negation | Represented by a Bar (¯) or Prime (') | Commonly known as NOT |
Every processor (Intel, AMD, Apple Silicon) is built using billions of microscopic switches called transistors. These transistors only understand ON and OFF. Boolean Logic is the mathematical bridge that allows us to turn those simple switches into complex things like Video Games, AI, and the Internet.
A logic gate is the physical, electronic implementation of a Boolean operator — a real circuit component that takes electrical inputs and produces an output following AND, OR, or NOT logic.
Each gate's rule, and its complete truth table — every possible combination of inputs:
AND — Output is 1 only if ALL inputs are 1.
| A | B | A AND B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
OR — Output is 1 if AT LEAST ONE input is 1.
| A | B | A OR B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
NOT — Inverts the single input.
| A | NOT A |
|---|---|
| 0 | 1 |
| 1 | 0 |
NOT is the only gate here with just one input, which is exactly why it's nicknamed the Inverter — it doesn't combine anything, it simply flips whatever single value it receives, 0 becomes 1 and 1 becomes 0.
Note: AND requires EVERY input to be 1 to output 1 — even a single 0 among the inputs forces the output to 0. OR only needs ONE input to be 1 for the output to be 1.
AND outputs 1 only when every input is 1; OR outputs 1 when at least one input is 1; NOT (the Inverter) simply flips its one input — these three gates are the physical, circuit-level implementation of Boolean algebra's three basic operators.
A Logic Gate is a physical electronic circuit that acts as a decision-maker. It takes one or more inputs and produces a single output based on a specific logical rule. By combining millions of these simple gates, a computer can execute complex tasks like rendering 3D graphics or processing AI algorithms.
| Gate Type | Standard Rule | Logic Analogy |
|---|---|---|
| NOT (Inverter) | Output is 1 only if input is 0. It reverses the state. | The "Opposite" switch. |
| OR (Inclusive) | Output is 1 if at least one input is 1. | Any "Yes" makes it "Yes". |
| AND (Conjunction) | Output is 1 only if both inputs are 1. | Requires "Yes" from everyone. |
0 → 1
1 → 0
0+0 = 0
0+1 = 1
1+0 = 1
1+1 = 1
0.0 = 0
0.1 = 0
1.0 = 0
1.1 = 1
Two more gates are built by combining a basic gate with a NOT — and they turn out to be special enough to have their own name: Universal Gates.
NAND = NOT + AND — output is 0 only when all inputs are 1 (the exact opposite of AND).
| A | B | A NAND B |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
NOR = NOT + OR — Boolean expression (A + B)', output is 1 only when all inputs are 0.
| A | B | A NOR B |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 0 |
Both are called Universal Gates because either one, by itself, can be wired together to reproduce the behaviour of AND, OR, and NOT — meaning an entire digital circuit can theoretically be built using only NAND gates, or only NOR gates, with no other gate type needed at all. The simplest proof: feed a NAND gate the same input twice, A NAND A. Looking at the table above with B replaced by A — when A=0, the result is 1; when A=1, the result is 0. That's exactly the NOT gate's behaviour, built from nothing but a NAND.
This "universal" property matters industrially, not just theoretically: manufacturing a circuit using just one type of gate component is simpler and cheaper than stocking and wiring together several different gate types — which is exactly why NAND and NOR are so heavily used in real chip design.
Note: NAND outputs 0 only when BOTH inputs are 1 (every other combination gives 1) — the mirror-opposite rule of AND, exactly as its name (NOT-AND) suggests.
NAND (NOT-AND) and NOR (NOT-OR) are each other's own gate family, and both are Universal Gates — either one alone can reconstruct AND, OR, and NOT, which is why real circuits are often built using only one gate type for simplicity and cost.
While AND, OR, and NOT are fundamental, the NAND and NOR gates are known as Universal Gates. Why? Because you can construct any other logic gate—and indeed an entire computer processor—using only NAND gates or only NOR gates. For manufacturers, this is a huge advantage as it simplifies the production of integrated circuits.
| Feature | NAND (Not-AND) | NOR (Not-OR) |
|---|---|---|
| Logic Combination | AND gate followed by a NOT gate. | OR gate followed by a NOT gate. |
| Boolean Expression | Y = (A . B)' | Y = (A + B)' |
| The Output Rule | Only 0 if all inputs are 1. | Only 1 if all inputs are 0. |
In practical electronics, using a single type of gate reduces manufacturing costs. Here is how you can use a NAND gate to act as a NOT gate:
Input A connected to both inputs of a NAND gate = A' (NOT)
You've already seen NAND derive NOT, using nothing but itself. This topic goes one step further — showing that NAND alone can also build an OR gate, with no OR gate involved at all.
To build A OR B using only NAND gates:
A using NAND: A NAND A gives NOT A (from the last topic).B the same way: B NAND B gives NOT B.(NOT A) NAND (NOT B).That final result is exactly A OR B — built from three NAND gates and nothing else.
Trace all four input combinations through the three-step construction:
| A | B | NOT A | NOT B | (NOT A) NAND (NOT B) | A OR B |
|---|---|---|---|---|---|
| 0 | 0 | 1 | 1 | 0 | 0 |
| 0 | 1 | 1 | 0 | 1 | 1 |
| 1 | 0 | 0 | 1 | 1 | 1 |
| 1 | 1 | 0 | 0 | 1 | 1 |
Take the second row as a concrete trace: A=0, B=1. Step 1: NOT A = 1. Step 2: NOT B = 0. Step 3: 1 NAND 0 — NAND is 0 only when both inputs are 1, so 1 NAND 0 = 1. The final column, A OR B for A=0, B=1, is also 1 — they match, exactly like every other row in the table.
Note: This table's final two columns are identical in every row — that's the actual proof that the three-NAND construction genuinely equals OR, not just a coincidence for one input combination.
This works for the same reason NAND alone could build NOT: inverting both inputs before a final NAND flips the "only 0 when both are 1" rule into "only 1 when at least one is 1" — which is precisely OR's own rule. Having now built both NOT and OR from nothing but NAND, and already knowing AND is just NAND followed by a NOT, every basic gate can be reconstructed from NAND alone — the concrete evidence behind calling it a Universal Gate.
(A NAND A) NAND (B NAND B) equals A OR B — inverting both inputs before a final NAND reproduces OR's behaviour exactly, using three NAND gates and no OR gate at all, extending the last topic's proof that NAND alone can rebuild every basic gate.
According to De Morgan's Law, the sum of complements is equal to the complement of the product:
A + B = (A' . B')'
This formula tells us that if we invert our inputs first, and then pass them through a NAND gate, the result will be an OR operation.
| Step | Action | Logic Result |
|---|---|---|
| 01 | Connect Input A to both inputs of the first NAND gate. | A' (NOT A) |
| 02 | Connect Input B to both inputs of the second NAND gate. | B' (NOT B) |
| 03 | Pass both A' and B' into a third NAND gate. | A + B (OR) |
If we set A=1 and B=0, let's see what happens:
This matches the OR gate rule: 1 + 0 = 1!
The last topic showed, by tracing a truth table, that inverting both inputs before a final NAND produces OR. This topic gives the formal algebraic law that actually proves why — one that connects AND, OR, and NOT directly.
De Morgan's Laws are two rules connecting AND, OR, and NOT:
(A . B)' = A' + B' — NOT(A AND B) equals (NOT A) OR (NOT B).(A + B)' = A' . B' — NOT(A OR B) equals (NOT A) AND (NOT B).In words: negating a group changes AND to OR (or OR to AND), and negates each individual term inside it.
Verify Law 1, (A . B)' = A' + B', against every input combination:
| 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 (A . B)' column and the A' + B' column are identical in every row — confirming the law holds for all four input combinations, not just some of them.
Note:(A . B)'is read "NOT of A AND B" — the NOT applies to the entire AND expression, not toAalone. This is different fromA' . B, which only invertsA.
Law 1 is exactly what the last topic's NAND-to-OR construction relied on, just written algebraically instead of traced by hand: A NAND B is (A . B)' by definition, and Law 1 says that equals A' + B' — which is precisely why inverting A and B first, then combining them, reproduces OR. The truth-table proof from the last topic and this algebraic law are two views of the exact same fact.
De Morgan's Laws: (A . B)' = A' + B' and (A + B)' = A' . B' — negating an AND/OR expression flips it to OR/AND and negates each term individually. Law 1 is the algebraic reason the last topic's NAND-based OR construction actually works.
Augustus De Morgan, a 19th-century mathematician, discovered two revolutionary laws that allow us to convert AND operations into OR operations (and vice versa) using negation. In digital electronics, these laws are used to "break the bar" in complex Boolean expressions, allowing engineers to simplify circuits and reduce hardware costs.
| The Law | Boolean Expression | English Translation |
|---|---|---|
| First Law | (A + B)' = A' . B' | The complement of a SUM is equal to the PRODUCT of the complements. |
| Second Law | (A . B)' = A' + B' | The complement of a PRODUCT is equal to the SUM of the complements. |
A working recap of this whole chapter — from the two-state values Boolean logic is built on, through to the algebraic law that ties everything together.
1/True/High/On, or 0/False/Low/Off..), OR (+), NOT (') — and the physical circuits that implement them: the AND, OR, and NOT logic gates.A NAND A) and OR ((A NAND A) NAND (B NAND B)) — the concrete, traced proof of NAND's universality.(A . B)' = A' + B' and (A + B)' = A' . B' — the algebraic rule underlying that NAND-to-OR construction.Confirm the chapter's central claim — that NAND alone reconstructs AND — using De Morgan's Law 2 this time, (A + B)' = A' . B':
A AND B can be rewritten as ((A AND B)')' , since inverting something twice returns the original value. (A AND B)' is exactly what a single NAND gate computes. So A AND B is just that NAND result, inverted once more — and inverting is itself just NAND applied to two copies of the same signal, from the very first proof in this chapter. AND, OR, and NOT can all be rebuilt from NAND alone: NOT and OR were traced directly by truth table in earlier topics, and AND follows by inverting a NAND's own output the same way.
Tip: Whenever a question asks you to build one gate using only another, start from what you already know NAND (or NOR) can already reproduce — NOT is the simplest case, and every other gate builds on top of it.
Boolean logic works with two-state values, combined by AND/OR/NOT and their physical gate implementations. NAND and NOR are Universal Gates — capable of rebuilding every basic gate alone — proven concretely for NOT and OR by truth table, and explained algebraically by De Morgan's Laws, which connect AND, OR, and NOT into one consistent system.
In the world of hardware, every logic gate costs money, space, and power. Simplification is the art of using Boolean Laws to take a messy, long expression and turn it into a shorter one that does the exact same thing. A simplified expression means a faster processor and a cheaper device.
If there is a bar over a long expression, break it first using De Morgan's Laws.
Use the Distributive Law to factor out common variables (e.g., AB + AC = A(B+C)).
Eliminate terms using laws like A + A' = 1 or A . 1 = A.