A three-computer flight controller has to agree on one answer, even if one of the computers fails. The rule is simple: trust any answer that at least two computers give. Written as logic, that rule is AB + AC + BC, and it fits into four gates. Every decision a chip makes, from a safety interlock to the control logic of a processor, starts the same way: a sentence of conditions becomes a Boolean expression, the expression gets simplified, and what is left becomes gates and transistors.

16 min read | Beginner Level

What You'll Learn

  • The basic logic gates, their truth tables, and how to turn a word problem into an expression
  • The laws of Boolean algebra, including absorption, consensus, and duality, and how to use them to simplify logic
  • Minterms, maxterms, and how to move between sum-of-products and product-of-sums forms
  • How De Morgan's theorem shapes the transistor networks inside a CMOS gate

Boolean Values and Operators

Boolean logic works with only two values: 0 (false) and 1 (true). In a digital circuit these are two voltage ranges: a voltage near ground reads as 0, and a voltage near the supply reads as 1. Every digital function, however large, is built from three basic operations:

OperationWritten asResult is 1 when
NOT (complement)A' or a bar over AA is 0
AND (product)A · B or ABA and B are both 1
OR (sum)A + BA or B or both are 1

The operators have a fixed precedence, just like multiplication before addition in ordinary arithmetic:

Precedence:  NOT  first,  then AND,  then OR

  A + B · C'    means   A + (B · (C'))
  (A + B) · C   needs the brackets to force the OR first
  (AB)'         is NOT of the product;   A'B'  is the product of two NOTs

Logic Gates and Their Truth Tables

A logic gate is a circuit that computes one Boolean operation. A truth table lists the output for every combination of inputs: n inputs give 2n rows. Besides AND, OR, and NOT, four combined gates are used everywhere:

Logic gate symbols with their Boolean expressions
The seven common logic gates. A bubble on an output means inversion; the extra curved line on XOR and XNOR marks the exclusive operation.
ABAND
AB
OR
A + B
NAND
(AB)'
NOR
(A + B)'
XOR
A ⊕ B
XNOR
(A ⊕ B)'
00001101
01011010
10011010
11110001

Two quick ways to read the table: XOR is 1 when the inputs differ, and XNOR is 1 when they are equal, which makes XNOR a 1-bit equality checker. NAND and NOR are simply AND and OR with the output inverted.

From Words to an Expression to a Circuit

Take the voting rule from the opening: output F is 1 when at least two of the three inputs A, B, C are 1. The method works for any word problem:

Step 1  Write the truth table.        (8 rows for 3 inputs)
Step 2  Mark every row where F = 1.   (rows 011, 101, 110, 111)
Step 3  Write one AND term per marked row, using A for a 1 and A' for a 0:
          011 -> A'BC     101 -> AB'C     110 -> ABC'     111 -> ABC
Step 4  OR the terms together:
          F = A'BC + AB'C + ABC' + ABC
Step 5  Simplify (shown in the simplification section):
          F = AB + AC + BC
ABCF (majority)Term
0000
0010
0100
0111A'BC
1000
1011AB'C
1101ABC'
1111ABC
Majority voter circuit F = AB + AC + BC
The simplified majority function: three 2-input AND gates detect each pair of inputs that agree on 1, and a 3-input OR combines them.

The Laws of Boolean Algebra

Boolean algebra has its own rules. Some look like ordinary algebra, and some, such as A + A = A, do not. Every law comes in a pair: swap AND with OR and 0 with 1, and you get its dual, which is also true. This is the duality principle.

LawOR formAND form (dual)
IdentityA + 0 = AA · 1 = A
Null (annulment)A + 1 = 1A · 0 = 0
IdempotentA + A = AA · A = A
ComplementA + A' = 1A · A' = 0
Involution(A')' = A
CommutativeA + B = B + AAB = BA
Associative(A + B) + C = A + (B + C)(AB)C = A(BC)
DistributiveA + BC = (A + B)(A + C)A(B + C) = AB + AC
AbsorptionA + AB = AA(A + B) = A
Redundant literalA + A'B = A + BA(A' + B) = AB
ConsensusAB + A'C + BC = AB + A'C(A + B)(A' + C)(B + C) = (A + B)(A' + C)
De Morgan(A + B)' = A'B'(AB)' = A' + B'

Any law can be proved by perfect induction: check both sides on every row of the truth table. For the redundant-literal law A + A'B = A + B:

ABA'BA + A'BA + B
00000
01111
10011
11011

In words: if A is already 1, the OR is already 1, so the A' in the second term adds nothing. The consensus law says something similar: in AB + A'C + BC, the term BC is only 1 when B = C = 1, and then either AB or A'C is already 1, depending on A. BC is redundant.

Quick Check

Q: Use De Morgan's theorem to complement (ABC)'. Which gate does the result describe?

Show Answer

(ABC)' = A' + B' + C'. It is a 3-input NAND gate: its output is 0 only when all three inputs are 1. It is not a NOR gate; a 3-input NOR would be (A + B + C)' = A'B'C'.

Simplifying Expressions Step by Step

Simplification removes terms and literals, and every literal removed is a gate input, and two transistors, that never get built. Three worked examples:

Example 1: the majority function
  F = A'BC + AB'C + ABC' + ABC
    = A'BC + AB'C + ABC' + ABC + ABC + ABC     idempotent: ABC = ABC + ABC + ABC
    = (A'+A)BC + A(B'+B)C + AB(C'+C)            group each term with one copy of ABC
    = BC + AC + AB                              complement: X' + X = 1, identity: 1 . Y = Y

Example 2: removing a consensus term
  G = AB + A'C + BC
    = AB + A'C                                  consensus: BC is covered by AB or A'C

Example 3: complementing with De Morgan
  H = (AB + C)'
    = (AB)' . C'                                De Morgan on the OR
    = (A' + B') . C'                            De Morgan on the AND

What the majority simplification saves in hardware, built as two-level NAND logic (an n-input NAND uses 2n transistors, an inverter uses 2):

FormGatesTransistors
A'BC + AB'C + ABC' + ABC3 inverters, 4 NAND3, 1 NAND46 + 24 + 8 = 38
AB + AC + BC3 NAND2, 1 NAND312 + 6 = 18

What comes out of synthesis: you never have to do this by hand in a real design. Synthesis tools apply the same laws automatically: they remove redundant terms, share common sub-expressions, and propagate constants (a signal tied to 0 makes every AND it feeds 0, by the null law, so that logic disappears). The majority function above typically comes out as a NAND2/NAND3 network or a single complex AND-OR-INVERT cell plus an inverter, whichever meets timing with less area.

Minterms, Maxterms, and Canonical Forms

A product term is an AND of literals, such as AB or A'C. A minterm is a special product term that contains every variable exactly once, such as A'BC. Each minterm is 1 on exactly one row of the truth table. A maxterm is an OR of every variable, and is 0 on exactly one row.

RowA B CMinterm (1 on this row only)Maxterm (0 on this row only)
00 0 0m0 = A'B'C'M0 = A + B + C
10 0 1m1 = A'B'CM1 = A + B + C'
20 1 0m2 = A'BC'M2 = A + B' + C
30 1 1m3 = A'BCM3 = A + B' + C'
41 0 0m4 = AB'C'M4 = A' + B + C
51 0 1m5 = AB'CM5 = A' + B + C'
61 1 0m6 = ABC'M6 = A' + B' + C
71 1 1m7 = ABCM7 = A' + B' + C'

Note the opposite conventions: in a minterm, a 0 in the row becomes a complemented variable; in a maxterm, a 1 becomes a complemented variable. Each one is built to match exactly its own row.

  • Sum of products (SOP) is an OR of product terms, such as AB + AC + BC. The canonical SOP uses only minterms, one per row where F = 1.
  • Product of sums (POS) is an AND of sum terms, such as (A + B)(A + C). The canonical POS uses only maxterms, one per row where F = 0.

Converting between the two canonical forms needs no algebra: just list the rows that are missing.

Majority function, rows where F = 1: 3, 5, 6, 7
  Canonical SOP:  F = sum of m(3, 5, 6, 7)  = A'BC + AB'C + ABC' + ABC

Rows where F = 0 are all the others: 0, 1, 2, 4
  Canonical POS:  F = product of M(0, 1, 2, 4)
                    = (A + B + C)(A + B + C')(A + B' + C)(A' + B + C)

Use whichever form needs fewer terms: a function that is 1 on most rows has a short POS, and a function that is 1 on few rows has a short SOP.

De Morgan's Theorem Inside a CMOS Gate

De Morgan's theorem is not just an algebra trick: it is how every static CMOS gate is designed. A CMOS gate has two transistor networks:

  • The pull-down network of NMOS transistors connects the output to ground. An NMOS conducts when its input is 1. Transistors in series conduct only if all are on (AND); transistors in parallel conduct if any is on (OR).
  • The pull-up network of PMOS transistors connects the output to the supply. A PMOS conducts when its input is 0, so it naturally works with complemented inputs.

For Y = (AB + C)', the pull-down must conduct when AB + C = 1: A and B in series, in parallel with C. The pull-up must conduct exactly when the output is 1, that is, when (AB + C)' = 1. De Morgan's theorem turns this into (A' + B')C', which tells you the pull-up structure directly: A and B in parallel, in series with C.

De Morgan's theorem in a CMOS AOI21 gate
Y = (AB + C)' as one CMOS gate. The NMOS pull-down implements AB + C directly; De Morgan's theorem gives the pull-up function (A' + B') · C', which is the same network with series and parallel swapped.
Rule that falls out of De Morgan's theorem:
  pull-down network:   series   <->   parallel   :pull-up network
                       parallel <->   series
  (the pull-up is the dual of the pull-down, so exactly one of them conducts)

This gate is a single AOI21 cell (AND-OR-INVERT) of 6 transistors, with one stage of delay. Building the same function from separate gates, an AND2 (6 transistors) driving a NOR2 (4 transistors), takes 10 transistors and two stages. Synthesis tools look for exactly this pattern.

Quick Check

Q: A pull-down network has two NMOS transistors in parallel (inputs A and B), and that pair is in series with a third NMOS (input C). What function does the gate compute, and what does its pull-up look like?

Show Answer

The pull-down conducts when (A + B)C = 1, so Y = ((A + B)C)'. By De Morgan, Y = A'B' + C', so the pull-up has PMOS A and B in series, and that pair in parallel with PMOS C. This gate is an OAI21 (OR-AND-INVERT).

Where Does Boolean Logic Show Up?

  • Fault-tolerant voting: Triple modular redundancy runs three copies of a circuit and passes their outputs through the majority function AB + AC + BC, so a single faulty copy is outvoted. It is used in spacecraft, avionics, and radiation-hardened chips.
  • Address decoding: In a processor system, a memory chip is selected by a product term of the high address bits. For example, a chip that occupies addresses 0x4000 to 0x5FFF is enabled by A15' . A14 . A13', a single 3-input AND of address lines.
  • Safety interlocks: A machine may run only if Start is pressed AND the guard is closed AND the emergency stop is NOT pressed: Run = Start . Guard . EStop'. In safety logic this is often implemented with redundant channels and checked with exactly these truth tables.
  • Equality and parity checks: XNOR gates compare bits for equality, and chains of XOR gates compute parity bits for error detection in memories and serial links.

Common Mistakes

Mistake #1: Misapplying De Morgan's theorem

When you break the bar, you must also change the operator: (A + B)' = A'B', not A' + B'. A quick sanity check: with A = 1, B = 0, (A + B)' is 0, while A' + B' would be 1.

Mistake #2: Using rules from ordinary algebra

In Boolean algebra A + A = A (not 2A) and A + 1 = 1. You also cannot cancel: AB = AC does not mean B = C (try A = 0). In the other direction, A + BC = (A + B)(A + C) is true in Boolean algebra even though it is false for ordinary numbers.

Mistake #3: Ignoring operator precedence

AND binds tighter than OR, so A + BC means A + (BC). If you mean (A + B)C, you must write the brackets. A misplaced bracket changes the truth table and therefore the circuit.

Mistake #4: Calling every product term a minterm

AB is a product term but, in a 3-variable function, not a minterm: a minterm must contain every variable. AB covers two minterms, ABC' and ABC. An SOP expression is a sum of product terms; only the canonical SOP is a sum of minterms.

Mistake #5: Confusing the complemented-AND form with NOR

A' + B' + C' is (ABC)', a NAND, because it is 0 only when all inputs are 1. A'B'C' is (A + B + C)', a NOR. Check the all-ones row to tell them apart.

Practice Exercise

Challenge: Design and Simplify a Boolean Function

A car's interior light (F) must turn on when the door is open (C = 1), or when the headlights are on (A = 1) and the key has just been removed (B = 1).

  1. Write the truth table and the canonical SOP as a sum of minterms.
  2. Simplify the expression using the laws of Boolean algebra, naming each law you use.
  3. Write the canonical POS and a simplified POS.
  4. How many 2-input NAND gates does the simplified function need?
Hint

F is 1 on rows 1, 3, 5, 6, and 7. Combine the four rows where C = 1 first, then use the redundant-literal law A + A'B = A + B.

Solution
1. A B C | F
   0 0 0 | 0
   0 0 1 | 1   m1
   0 1 0 | 0
   0 1 1 | 1   m3
   1 0 0 | 0
   1 0 1 | 1   m5
   1 1 0 | 1   m6
   1 1 1 | 1   m7

   F = sum of m(1, 3, 5, 6, 7) = A'B'C + A'BC + AB'C + ABC' + ABC

2. A'B'C + A'BC = A'C(B' + B) = A'C        distributive, complement, identity
   AB'C  + ABC  = AC(B' + B)  = AC         same laws
   A'C + AC     = C(A' + A)   = C          same laws
   F = C + ABC'
     = C + AB                              redundant literal: X + X'Y = X + Y, with X = C

3. Rows where F = 0: 0, 2, 4
   Canonical POS:  F = (A + B + C)(A + B' + C)(A' + B + C)
   Simplified POS: F = (A + C)(B + C)      distributive: C + AB = (C + A)(C + B)

4. F = C + AB = ((AB)' . C')'              De Morgan
     = (A NAND B) NAND (C NAND C)
   3 NAND gates: one for A NAND B, one as an inverter for C, one to combine.
  

Summary

In this tutorial, you learned:

  • Boolean logic uses two values and three basic operations; NOT binds tightest, then AND, then OR
  • Truth tables define every gate: XOR detects difference, XNOR detects equality, NAND and NOR invert AND and OR
  • A word problem becomes a truth table, then one minterm per true row, then a simplified expression
  • Every Boolean law has a dual; absorption, redundant-literal, and consensus laws remove terms, and each removed literal saves transistors
  • Canonical SOP lists the rows where F = 1 as minterms; canonical POS lists the rows where F = 0 as maxterms
  • De Morgan's theorem makes the CMOS pull-up network the series-parallel dual of the pull-down network, which is how complex gates like AOI21 are built
Did you find what you were looking for?

Quiz

No quiz questions available for this article.