Skip to main content

Boolean Logic

Boolean Algebra Fundamentals

Boolean algebra is a branch of mathematics that operates on binary values: 1 (true) and 0 (false). It provides the formal foundation for digital circuit design. Every Boolean expression evaluates to exactly one of these two values, and every Boolean function can be expressed, simplified, and implemented using a finite set of operators.

The three fundamental operators are AND, OR, and NOT. From these three, all other Boolean operators can be derived. NAND and NOR are called universal gates because either one alone is sufficient to construct any Boolean function. XOR and XNOR are useful for parity and comparison operations.

Basic Operators

AND (conjunction): The output is 1 only when all inputs are 1.

ABA AND B
000
010
100
111

Notation: ABA \cdot B, ABAB, ABA \wedge B

OR (disjunction): The output is 1 when at least one input is 1.

ABA OR B
000
011
101
111

Notation: A+BA + B, ABA \vee B

NOT (negation): The output is the complement of the input.

ANOT A
01
10

Notation: A\overline{A}, AA', ¬A\lnot A

NAND: The negation of AND. Output is 0 only when all inputs are 1.

ABA NAND B
001
011
101
110

Notation: AB\overline{A \cdot B}, (AB)(A \cdot B)'

NOR: The negation of OR. Output is 1 only when all inputs are 0.

ABA NOR B
001
010
100
110

Notation: A+B\overline{A + B}, (A+B)(A + B)'

XOR (exclusive OR): The output is 1 when inputs are different.

ABA XOR B
000
011
101
110

Notation: ABA \oplus B, ABA \veebar B

XNOR (exclusive NOR): The negation of XOR. Output is 1 when inputs are the same.

ABA XNOR B
001
010
100
111

Notation: AB\overline{A \oplus B}, ABA \odot B

Derived Expressions for XOR and XNOR

XOR and XNOR can be expressed entirely in terms of AND, OR, and NOT:

AB=AB+ABA \oplus B = A \cdot \overline{B} + \overline{A} \cdot B

AB=AB+ABA \odot B = A \cdot B + \overline{A} \cdot \overline{B}

These identities are essential when simplifying expressions that contain XOR/XNOR into standard forms suitable for implementation with basic gates or Karnaugh maps.

Worked Example: Constructing a Truth Table

Construct the truth table for F=(A+B)CF = (A + B) \cdot \overline{C}.

Solution

Build column by column, evaluating each sub-expression:

ABCA+BA + BC\overline{C}F=(A+B)CF = (A + B) \cdot \overline{C}
000010
001000
010111
011100
100111
101100
110111
111100

Minterms (where F=1F = 1): ABC\overline{A}B\overline{C}, ABCA\overline{B}\overline{C}, ABCAB\overline{C}.

SOP expression: F=ABC+ABC+ABCF = \overline{A}B\overline{C} + A\overline{B}\overline{C} + AB\overline{C}

This can be simplified: F=(B+A)CF = (B + A) \cdot \overline{C} (which is the original expression, confirming our truth table is correct). Further simplification: the three minterms share C\overline{C}, and the OR of the other terms is B+A=A+BB + A = A + B, so F=(A+B)CF = (A + B) \cdot \overline{C}.

Truth Tables for Multiple Variables

Three-Variable Truth Tables

A three-variable expression has 23=82^3 = 8 rows. The convention is to list combinations in binary counting order. For variables A, B, C:

ABCA AND B AND CA OR B OR C
00000
00101
01001
01101
10001
10101
11001
11111

Four-Variable Truth Tables

A four-variable expression has 24=162^4 = 16 rows. The standard ordering assigns the leftmost variable as the most significant bit. For variables A, B, C, D:

ABCDA AND B AND C AND DA OR B OR C OR D
000000
000101
001001
001101
010001
010101
011001
011101
100001
100101
101001
101101
110001
110101
111001
111111

Constructing Truth Tables for Arbitrary Expressions

Given an expression, construct the truth table by evaluating each sub-expression column by column.

Worked example: Construct the truth table for F=AB+ACF = A \cdot \overline{B} + \overline{A} \cdot C

ABCB\overline{B}A\overline{A}ABA \cdot \overline{B}AC\overline{A} \cdot CFF
00011000
00111011
01001000
01101011
10010101
10110101
11000000
11100000

The minterms (rows where F=1F = 1) are: ABC\overline{A}\overline{B}C, ABC\overline{A}BC, ABCA\overline{B}\overline{C}, ABCA\overline{B}C.

Boolean Identities and Laws

The following identities are the tools for algebraic simplification. Each identity can be verified by constructing truth tables for both sides and confirming they are identical.

Fundamental Identities

IdentityAND FormOR Form
IdentityA1=AA \cdot 1 = AA+0=AA + 0 = A
Null (Domination)A0=0A \cdot 0 = 0A+1=1A + 1 = 1
ComplementAA=0A \cdot \overline{A} = 0A+A=1A + \overline{A} = 1
IdempotentAA=AA \cdot A = AA+A=AA + A = A
CommutativeAB=BAA \cdot B = B \cdot AA+B=B+AA + B = B + A
Associative(AB)C=A(BC)(A \cdot B) \cdot C = A \cdot (B \cdot C)(A+B)+C=A+(B+C)(A + B) + C = A + (B + C)
DistributiveA(B+C)=AB+ACA \cdot (B + C) = A \cdot B + A \cdot CA+(BC)=(A+B)(A+C)A + (B \cdot C) = (A + B) \cdot (A + C)
AbsorptionA(A+B)=AA \cdot (A + B) = AA+(AB)=AA + (A \cdot B) = A
Double NegationA=A\overline{\overline{A}} = AA=A\overline{\overline{A}} = A

De Morgan's Laws

De Morgan's Laws are the most frequently applied identities in Boolean simplification. They allow the distribution of a NOT over an AND or OR:

AB=A+B\overline{A \cdot B} = \overline{A} + \overline{B}

A+B=AB\overline{A + B} = \overline{A} \cdot \overline{B}

For three variables, De Morgan's Laws extend as:

ABC=A+B+C\overline{A \cdot B \cdot C} = \overline{A} + \overline{B} + \overline{C}

A+B+C=ABC\overline{A + B + C} = \overline{A} \cdot \overline{B} \cdot \overline{C}

The general rule: invert each variable, and swap AND with OR (or vice versa).

Worked Example: Applying De Morgan's Laws

Simplify F=AB+ACF = \overline{A \cdot B + A \cdot C} using De Morgan's Laws.

Solution

Step 1: Apply De Morgan's to the outer NOT (treating AB+ACA \cdot B + A \cdot C as the inner expression):

F=ABACF = \overline{A \cdot B} \cdot \overline{A \cdot C}

Step 2: Apply De Morgan's to each remaining term:

F=(A+B)(A+C)F = (\overline{A} + \overline{B}) \cdot (\overline{A} + \overline{C})

Step 3: Apply the distributive law:

F=AA+AC+BA+BCF = \overline{A} \cdot \overline{A} + \overline{A} \cdot \overline{C} + \overline{B} \cdot \overline{A} + \overline{B} \cdot \overline{C}

Step 4: Simplify using idempotent law (AA=A\overline{A} \cdot \overline{A} = \overline{A}) and commutative:

F=A+AC+AB+BCF = \overline{A} + \overline{A} \cdot \overline{C} + \overline{A} \cdot \overline{B} + \overline{B} \cdot \overline{C}

Step 5: Apply absorption (A+AC=A\overline{A} + \overline{A} \cdot \overline{C} = \overline{A}):

F=A+AB+BCF = \overline{A} + \overline{A} \cdot \overline{B} + \overline{B} \cdot \overline{C}

Step 6: Apply absorption again (A+AB=A\overline{A} + \overline{A} \cdot \overline{B} = \overline{A}):

F=A+BCF = \overline{A} + \overline{B} \cdot \overline{C}

The simplified expression requires 1 NOT, 1 AND, and 1 OR gate (3 gates total), compared to the original which requires 2 AND, 1 OR, and 1 NOT (4 gates total) -- or more if not shared.

Consensus Theorem

AB+AC+BC=AB+ACA \cdot B + \overline{A} \cdot C + B \cdot C = A \cdot B + \overline{A} \cdot C

The term BCB \cdot C is redundant because it is the "consensus" of the other two terms. The variable BB appears in the first term and B\overline{B} does not; CC appears in the second term and C\overline{C} does not. The consensus term is BCB \cdot C.

The dual form is:

(A+B)(A+C)(B+C)=(A+B)(A+C)(A + B) \cdot (\overline{A} + C) \cdot (B + C) = (A + B) \cdot (\overline{A} + C)

Simplifying Boolean Expressions

Simplification reduces the number of gates and inputs required, which reduces cost, propagation delay, and power consumption. The approach is systematic: apply identities one at a time, justifying each step.

Worked Example 1

Simplify: F=AB+AB+ABF = A \cdot B + A \cdot \overline{B} + \overline{A} \cdot B

Step 1: Factor AA from the first two terms (distributive law, reverse):

F=A(B+B)+ABF = A \cdot (B + \overline{B}) + \overline{A} \cdot B

Step 2: Apply complement law: B+B=1B + \overline{B} = 1

F=A1+ABF = A \cdot 1 + \overline{A} \cdot B

Step 3: Apply identity law: A1=AA \cdot 1 = A

F=A+ABF = A + \overline{A} \cdot B

Step 4: Apply absorption: A+AB=A+BA + \overline{A} \cdot B = A + B

F=A+BF = A + B

Worked Example 2

Simplify: F=ABC+ABC+ACF = \overline{A} \cdot \overline{B} \cdot \overline{C} + \overline{A} \cdot B \cdot C + A \cdot \overline{C}

Step 1: Group terms containing A\overline{A}:

F=A(BC+BC)+ACF = \overline{A} \cdot (\overline{B} \cdot \overline{C} + B \cdot C) + A \cdot \overline{C}

Step 2: Recognize that BC+BC=BC\overline{B} \cdot \overline{C} + B \cdot C = B \odot C (XNOR):

F=A(BC)+ACF = \overline{A} \cdot (B \odot C) + A \cdot \overline{C}

This is a valid simplification but not in sum-of-products form. For circuit implementation, we can expand:

F=ABC+ABC+ACF = \overline{A} \cdot \overline{B} \cdot \overline{C} + \overline{A} \cdot B \cdot C + A \cdot \overline{C}

Using absorption, the term ACA \cdot \overline{C} absorbs both ABCA \cdot \overline{B} \cdot \overline{C} and ABCA \cdot B \cdot \overline{C}. We already have ABC\overline{A} \cdot \overline{B} \cdot \overline{C}, so ABCA \cdot \overline{B} \cdot \overline{C} is generated when we expand ACA \cdot \overline{C}:

AC=ABC+ABCA \cdot \overline{C} = A \cdot \overline{B} \cdot \overline{C} + A \cdot B \cdot \overline{C}

So the full SOP is:

F=ABC+ABC+ABC+ABCF = \overline{A} \cdot \overline{B} \cdot \overline{C} + \overline{A} \cdot B \cdot C + A \cdot \overline{B} \cdot \overline{C} + A \cdot B \cdot \overline{C}

This simplifies to F=C+ABCF = \overline{C} + \overline{A} \cdot B \cdot C, which requires only 4 gate inputs instead of the original 8.

Worked Example 3 (Using De Morgan's Laws)

Simplify: F=(A+B)(A+B)F = \overline{(A + B) \cdot (\overline{A} + \overline{B})}

Step 1: Apply De Morgan's Law to the outer NOT:

F=A+B+A+BF = \overline{A + B} + \overline{\overline{A} + \overline{B}}

Step 2: Apply De Morgan's Law to each term:

F=AB+ABF = \overline{A} \cdot \overline{B} + A \cdot B

This is ABA \odot B (XNOR). The expression is now in minimal SOP form.

Logic Gates

Gate Symbols and Expressions

GateBoolean ExpressionStandard Symbol (ANSI)IEC Symbol
ANDABA \cdot BD-shaped output&
ORA+BA + BCurved output>=1
NOTA\overline{A}Triangle with bubble1 (with o)
NANDAB\overline{A \cdot B}AND with bubble& (with o)
NORA+B\overline{A + B}OR with bubble>=1 (with o)
XORABA \oplus BOR with extra curve=1
XNORAB\overline{A \oplus B}XOR with bubble=1 (with o)

NAND as a Universal Gate

NAND alone can implement all other gates:

  • NOT: Connect both inputs of NAND to the same signal: NAND(A,A)=AA=A\mathrm{NAND}(A, A) = \overline{A \cdot A} = \overline{A}
  • AND: NAND followed by NOT: NOT(NAND(A,B))=AB\mathrm{NOT}(\mathrm{NAND}(A, B)) = A \cdot B
  • OR: Use De Morgan's: A+B=ABA + B = \overline{\overline{A} \cdot \overline{B}}. Feed A\overline{A} and B\overline{B} (each from a NAND-as-NOT) into a NAND gate.

NAND-NAND implementation of F=AB+CDF = A \cdot B + C \cdot D:

Apply De Morgan's in reverse: F=ABCDF = \overline{\overline{A \cdot B} \cdot \overline{C \cdot D}}

This requires two NAND gates for AB\overline{A \cdot B} and CD\overline{C \cdot D}, and a third NAND gate to combine them. Total: 3 NAND gates.

Worked Example: Implementing a Function with NAND Gates Only

Implement F=AB+CF = A \cdot B + C using only NAND gates.

Solution

Step 1: Convert to NAND-NAND form. We need the expression in the form XY\overline{X \cdot Y} where XX and YY are themselves NAND expressions.

The SOP form is F=AB+CF = A \cdot B + C. Apply De Morgan's in reverse:

F=ABCF = \overline{\overline{A \cdot B} \cdot \overline{C}}

Step 2: Verify: ABC=AB+C=AB+C\overline{\overline{A \cdot B} \cdot \overline{C}} = \overline{\overline{A \cdot B}} + \overline{\overline{C}} = A \cdot B + C. Correct.

Step 3: Implement:

  • NAND gate 1: inputs A,BA, B → output AB\overline{A \cdot B}
  • NAND gate 2 (as NOT): inputs AB,AB\overline{A \cdot B}, \overline{A \cdot B} → output ABA \cdot B (Wait, we do not need this -- the final NAND gate handles the OR.)

Actually, the expression ABC\overline{\overline{A \cdot B} \cdot \overline{C}} needs C\overline{C}. To get C\overline{C} from a NAND gate: NAND gate 2: inputs C,CC, C → output CC=C\overline{C \cdot C} = \overline{C}.

  • NAND gate 1: inputs A,BA, BAB\overline{A \cdot B}
  • NAND gate 2: inputs C,CC, CC\overline{C}
  • NAND gate 3: inputs AB,C\overline{A \cdot B}, \overline{C}ABC=AB+C\overline{\overline{A \cdot B} \cdot \overline{C}} = A \cdot B + C

Total: 3 NAND gates.

NOR as a Universal Gate

NOR alone can implement all other gates:

  • NOT: Connect both inputs to the same signal: NOR(A,A)=A+A=A\mathrm{NOR}(A, A) = \overline{A + A} = \overline{A}
  • OR: NOR followed by NOT: NOT(NOR(A,B))=A+B\mathrm{NOT}(\mathrm{NOR}(A, B)) = A + B
  • AND: Use De Morgan's: AB=A+BA \cdot B = \overline{\overline{A} + \overline{B}}. Feed A\overline{A} and B\overline{B} (each from a NOR-as-NOT) into a NOR gate.

Karnaugh Maps (K-Maps)

Karnaugh maps provide a visual method for minimizing Boolean expressions with up to 4 variables. They eliminate the need for trial-and-error algebraic manipulation by systematically identifying groups of adjacent 1s (or 0s).

The Adjacency Principle

Two minterms are adjacent if they differ in exactly one variable. Adjacent minterms can be combined by eliminating the variable that changes. In a K-map, adjacency wraps around the edges (the top row is adjacent to the bottom row; the leftmost column is adjacent to the rightmost column).

2-Variable K-Map

A 2-variable K-map has 22=42^2 = 4 cells. The columns represent one variable and the rows represent the other.

Worked example: Minimize F=AB+AB+ABF = \overline{A} \cdot \overline{B} + \overline{A} \cdot B + A \cdot \overline{B}

B = 0B = 1
A=011
A=110

The cells for (0,0)(0,0), (0,1)(0,1), and (1,0)(1,0) are 1.

Group the two cells in row A=0: this spans both columns, so B is eliminated. This group represents A\overline{A}.

Group the two cells in column B=0: this spans both rows, so A is eliminated. This group represents B\overline{B}.

Result: F=A+BF = \overline{A} + \overline{B}

Verify: The three minterms AB+AB+AB=A(B+B)+AB=A+AB=A+B\overline{A}\overline{B} + \overline{A}B + A\overline{B} = \overline{A}(\overline{B} + B) + A\overline{B} = \overline{A} + A\overline{B} = \overline{A} + \overline{B} by absorption. Correct.

3-Variable K-Map

A 3-variable K-map has 23=82^3 = 8 cells. The standard layout uses Gray code ordering (00, 01, 11, 10) so that adjacent columns differ by exactly one bit. Variables B and C are the column headers; A is the row header.

Worked example: Minimize F(A,B,C)=(0,1,2,5,6,7)F(A, B, C) = \sum(0, 1, 2, 5, 6, 7)

The minterms are: m0=ABCm_0 = \overline{A}\overline{B}\overline{C}, m1=ABCm_1 = \overline{A}\overline{B}C, m2=ABCm_2 = \overline{A}B\overline{C}, m5=ABCm_5 = A\overline{B}C, m6=ABCm_6 = AB\overline{C}, m7=ABCm_7 = ABC.

BC = 00BC = 01BC = 11BC = 10
A=01101
A=10111

Step 1: Identify groups.

  • Group 1: Cells (0,00)(0,00) and (0,01)(0,01) -- adjacent horizontally. These are ABC\overline{A}\overline{B}\overline{C} and ABC\overline{A}\overline{B}C. The variable that changes is C, so eliminate it: AB\overline{A}\overline{B}.
  • Group 2: Cells (1,01)(1,01), (1,11)(1,11), (1,10)(1,10) -- all three in row A=1. But (1,01)(1,01) and (1,11)(1,11) are adjacent, and (1,11)(1,11) and (1,10)(1,10) are adjacent. Group (1,11)(1,11) and (1,10)(1,10): these are ABCABC and ABCAB\overline{C}, eliminating C: ABAB.
  • Group 3: Cells (0,10)(0,10) and (1,10)(1,10) -- adjacent vertically. These are ABC\overline{A}B\overline{C} and ABCAB\overline{C}, eliminating A: BCB\overline{C}.
  • Group 4: Cells (1,01)(1,01) and (0,01)(0,01) -- adjacent vertically. These are ABCA\overline{B}C and ABC\overline{A}\overline{B}C, eliminating A: BC\overline{B}C.

Now apply the covering rule: every 1 must be covered by at least one group.

Optimal grouping:

  • ABAB: covers m6,m7m_6, m_7
  • BCB\overline{C}: covers m2,m6m_2, m_6
  • BC\overline{B}C: covers m1,m5m_1, m_5
  • AB\overline{A}\overline{B}: covers m0,m1m_0, m_1

But m0m_0 is only covered by AB\overline{A}\overline{B}, so that group is essential. m2m_2 is only covered by BCB\overline{C}, so that is essential. m5m_5 is only covered by BC\overline{B}C, so that is essential. m7m_7 is only covered by ABAB, so that is essential.

F=AB+BC+BC+ABF = \overline{A}\overline{B} + B\overline{C} + \overline{B}C + AB

4-Variable K-Map

A 4-variable K-map has 24=162^4 = 16 cells. The row headers (AB) and column headers (CD) both use Gray code ordering: 00, 01, 11, 10.

Worked example: Minimize F(A,B,C,D)=(0,1,2,5,8,9,10)F(A, B, C, D) = \sum(0, 1, 2, 5, 8, 9, 10)

CD = 00CD = 01CD = 11CD = 10
AB=001101
AB=010100
AB=110000
AB=101101

Step 1: Identify groups of 1s.

  • Group 1: The four corners form a valid group because K-maps wrap around both horizontally and vertically. Cells (00,00)(00,00), (00,10)(00,10), (10,00)(10,00), (10,10)(10,10) are the four corners. In terms of variables, these are ABCD\overline{A}\overline{B}\overline{C}\overline{D}, ABCD\overline{A}\overline{B}C\overline{D}, ABCDA\overline{B}\overline{C}\overline{D}, ABCDA\overline{B}C\overline{D}. Variables A and C change, so they are eliminated. Result: BD\overline{B}\overline{D}.
  • Group 2: Cells (00,00)(00,00) and (00,01)(00,01) are adjacent. These are ABCD\overline{A}\overline{B}\overline{C}\overline{D} and ABCD\overline{A}\overline{B}\overline{C}D. Variable D changes, so eliminate it: ABC\overline{A}\overline{B}\overline{C}.
  • Group 3: Cells (00,01)(00,01) and (01,01)(01,01) are adjacent vertically. These are ABCD\overline{A}\overline{B}\overline{C}D and ABCD\overline{A}B\overline{C}D. Variable B changes, so eliminate it: ACD\overline{A}\overline{C}D.
  • Group 4: Cells (10,00)(10,00) and (10,01)(10,01) are adjacent. These are ABCDA\overline{B}\overline{C}\overline{D} and ABCDA\overline{B}\overline{C}D. Variable D changes: ABCA\overline{B}\overline{C}.

Step 2: Determine essential prime implicants.

The four-corner group BD\overline{B}\overline{D} covers m0,m2,m8,m10m_0, m_2, m_8, m_{10}.

ACD\overline{A}\overline{C}D covers m1,m5m_1, m_5.

Check coverage: m0m_0 covered by BD\overline{B}\overline{D}, m1m_1 covered by ACD\overline{A}\overline{C}D, m2m_2 covered by BD\overline{B}\overline{D}, m5m_5 covered by ACD\overline{A}\overline{C}D, m8m_8 covered by BD\overline{B}\overline{D}, m9m_9 is NOT covered yet, m10m_{10} covered by BD\overline{B}\overline{D}.

m9=ABCDm_9 = A\overline{B}\overline{C}D. We need to cover it. Options:

  • ACD\overline{A}\overline{C}D does not cover it (requires A\overline{A}).
  • BD\overline{B}\overline{D} does not cover it (requires D\overline{D}).
  • ABCA\overline{B}\overline{C} covers m8,m9m_8, m_9.
  • ABC\overline{A}\overline{B}\overline{C} covers m0,m1m_0, m_1 but not m9m_9.

So we add ABCA\overline{B}\overline{C}.

F=BD+ACD+ABCF = \overline{B}\overline{D} + \overline{A}\overline{C}D + A\overline{B}\overline{C}

This requires three AND gates and one OR gate, for a total of 4 gates with 9 gate inputs.

Worked Example: 3-Variable K-Map with Don't Cares

Minimize F(A,B,C)=(1,3,5)+d(0,6)F(A, B, C) = \sum(1, 3, 5) + d(0, 6) where dd denotes don't care conditions.

Solution

The minterms are m1,m3,m5m_1, m_3, m_5. The don't cares are m0,m6m_0, m_6. Place these on the K-map:

BC = 00BC = 01BC = 11BC = 10
A=0X110
A=1010X

Without don't cares:

  • m1,m3m_1, m_3: group vertically → AC\overline{A}C (columns 01 and 11, row A=0)
  • m5m_5: isolated → ABCA\overline{B}C

F=AC+ABCF = \overline{A}C + A\overline{B}C (2 terms, 5 literals)

With don't cares: Set m0m_0 (X at 0,00) to 1 and m6m_6 (X at 1,10) to 1 to form larger groups.

  • Group (0,00)(0,00) and (0,01)(0,01): if X=1, this gives AB\overline{A}\overline{B}
  • Group (0,01)(0,01) and (0,11)(0,11): gives AC\overline{A}C
  • Group (1,01)(1,01) and (0,01)(0,01): gives BC\overline{B}C
  • Group (1,10)(1,10): if X=1, can pair with (1,11)(1,11)? No, (1,11)=0(1,11)=0. Can pair with (0,10)(0,10)? No, (0,10)=0(0,10)=0. So (1,10)(1,10) remains isolated as ABCAB\overline{C}... but that is a single cell.

Better approach: use m0m_0 and m1m_1 together → AB\overline{A}\overline{B} (horizontal pair). Then m1m_1 and m3m_3AC\overline{A}C (horizontal pair). m1m_1 and m5m_5BC\overline{B}C (vertical pair).

Optimal grouping:

  • BC\overline{B}C: covers m1,m5m_1, m_5 (2 cells)
  • AC\overline{A}C: covers m1,m3m_1, m_3 (2 cells, m1m_1 overlaps)

But m3m_3 is not covered by BC\overline{B}C. And m5m_5 is not covered by AC\overline{A}C. So we need both. Can we do better with don't cares?

Set m0m_0 to 1: pair m0,m1m_0, m_1AB\overline{A}\overline{B}. Set m6m_6 to 1: m6m_6 is isolated.

Try: BC\overline{B}C covers m1,m5m_1, m_5. AB\overline{A}\overline{B} covers m0,m1m_0, m_1. m3m_3 is not covered yet. We need AC\overline{A}C or BCBC for m3m_3. AC\overline{A}C also covers m1m_1.

So: F=BC+AB+ACF = \overline{B}C + \overline{A}\overline{B} + \overline{A}C

Check coverage: m0m_0 (don't care, covered by AB\overline{A}\overline{B}), m1m_1 (covered by all three), m3m_3 (covered by AC\overline{A}C), m5m_5 (covered by BC\overline{B}C), m6m_6 (don't care, not covered but that is OK).

Actually, AC\overline{A}C covers m1,m3m_1, m_3 and BC\overline{B}C covers m1,m5m_1, m_5. Together they cover all required minterms (m1,m3,m5m_1, m_3, m_5). The don't care m0m_0 could be used to replace AC\overline{A}C with AB\overline{A}\overline{B}, but that only covers m0,m1m_0, m_1, leaving m3m_3 uncovered.

Best result with don't cares: F=AC+BCF = \overline{A}C + \overline{B}C (2 terms, 3 literals). Wait, let me check: AC+BC=(A+B)C=ABC\overline{A}C + \overline{B}C = (\overline{A} + \overline{B}) \cdot C = \overline{A \cdot B} \cdot C.

Check: m1m_1 (ABC\overline{A}\overline{B}C): ABC=01=1\overline{A \cdot B} \cdot C = \overline{0} \cdot 1 = 1. Yes. m3m_3 (ABC\overline{A}BC): ABC=01=1\overline{A \cdot B} \cdot C = \overline{0} \cdot 1 = 1. Yes. m5m_5 (ABCA\overline{B}C): ABC=01=1\overline{A \cdot B} \cdot C = \overline{0} \cdot 1 = 1. Yes.

Wait, that is wrong. AB\overline{A \cdot B} when A=0,B=1A=0, B=1: 01=0=1\overline{0 \cdot 1} = \overline{0} = 1. Correct. AB\overline{A \cdot B} when A=1,B=0A=1, B=0: 10=0=1\overline{1 \cdot 0} = \overline{0} = 1. Correct.

So F=ABCF = \overline{A \cdot B} \cdot C = AC+BC\overline{A}C + \overline{B}C.

This covers m1,m3,m5m_1, m_3, m_5 with only 2 terms and 3 literals. No don't cares were even needed for this simplification -- the expression was already optimizable. But don't cares give us additional flexibility if we needed to cover m0m_0 or m6m_6.

Final answer: F=AC+BCF = \overline{A}C + \overline{B}C (implemented as 2 NOT gates, 2 AND gates, 1 OR gate = 5 gates, or using NAND-NAND: 4 NAND gates).

K-Map Grouping Rules

  1. Groups must be rectangular (or square) and contain 2k2^k cells (1, 2, 4, 8, or 16).
  2. Groups must be as large as possible. A group of 4 is better than two groups of 2.
  3. Every 1 in the map must be covered by at least one group.
  4. Groups can wrap around the edges (top-bottom, left-right).
  5. Overlapping groups are allowed and often necessary.
  6. The four corners of a 4-variable map form a valid 2×22 \times 2 group.

Product-of-Sums (POS) via K-Maps

To obtain the POS form, group the 0s instead of the 1s, then apply De Morgan's Law to the result.

Worked example: Using the same map as the 4-variable example above, group the 0s.

The 0s are at: m3,m4,m6,m7,m11,m12,m13,m14,m15m_3, m_4, m_6, m_7, m_{11}, m_{12}, m_{13}, m_{14}, m_{15}.

This produces a POS expression. However, since there are more 0s than 1s in this case, the SOP form is simpler. POS is advantageous when there are fewer 0s than 1s.

Don't Care Conditions

Don't care conditions arise when certain input combinations can never occur or when the output value for certain inputs is irrelevant. In K-maps, don't cares are marked with X and can be treated as either 0 or 1, whichever produces a simpler expression.

Worked example: A circuit has inputs A, B, C where the input combination A = 1, B = 1, C = 1 is impossible. The required outputs for the other 7 combinations are:

ABCF
0000
0011
0100
0111
1001
1011
1100
111X

The K-map is:

BC = 00BC = 01BC = 11BC = 10
A=00110
A=111X0

Without don't cares, the optimal SOP is:

  • m1,m3m_1, m_3: AC\overline{A}C (group vertically in columns 01 and 11 of row A=0)
  • m4,m5m_4, m_5: ABA\overline{B} (row A=1, columns 00 and 01)

F=AC+ABF = \overline{A}C + A\overline{B}

With don't cares, we can set the X to 1 to create a larger group:

  • Cells (0,01)(0,01), (0,11)(0,11), (1,01)(1,01), (1,11)(1,11): if X = 1, this is a 2×22 \times 2 group spanning both rows and columns 01 and 11. Variables A and B change, so eliminate them: CC.
  • Cells (1,00)(1,00) and (1,01)(1,01): ABA\overline{B}.

But wait -- (1,00)=1(1,00) = 1 and (1,01)=1(1,01) = 1. The group ABA\overline{B} covers these. The 2×22 \times 2 group covering columns 01 and 11 gives CC. Together: F=C+ABF = C + A\overline{B}.

Check: F=C+ABF = C + A\overline{B}. For A=0,B=0,C=0A=0, B=0, C=0: F=0+0=0F = 0 + 0 = 0 (correct). For A=0,B=0,C=1A=0, B=0, C=1: F=1+0=1F = 1 + 0 = 1 (correct). For A=1,B=1,C=0A=1, B=1, C=0: F=0+0=0F = 0 + 0 = 0 (correct). The don't care (A=1,B=1,C=1A=1, B=1, C=1) gives F=1+0=1F = 1 + 0 = 1, which is acceptable since the output is irrelevant for this input.

The expression C+ABC + A\overline{B} (2 terms, 3 literals) is simpler than AC+AB\overline{A}C + A\overline{B} (2 terms, 4 literals).

Converting Between Representations

Boolean Expression to Truth Table

Given any Boolean expression, evaluate it for every combination of input values. For an expression with nn variables, construct 2n2^n rows and evaluate the expression for each.

Truth Table to Boolean Expression (SOP)

  1. Identify all rows where the output is 1.
  2. For each such row, write a minterm: AND together each variable (complemented if 0, uncomplemented if 1).
  3. OR together all minterms.

Truth Table to Boolean Expression (POS)

  1. Identify all rows where the output is 0.
  2. For each such row, write a maxterm: OR together each variable (complemented if 1, uncomplemented if 0).
  3. AND together all maxterms.

Boolean Expression to Logic Circuit

Replace each operation with its corresponding gate:

  • AND operations become AND gates
  • OR operations become OR gates
  • NOT operations become NOT gates (inverter bubbles)

The structure of the expression dictates the circuit topology. An SOP expression produces a two-level circuit: AND gates feeding into an OR gate.

Logic Circuit to Boolean Expression

Trace the circuit from inputs to outputs:

  1. Label each gate output with the expression it computes.
  2. Work from left to right (inputs to outputs).
  3. The final gate output is the overall expression.

Worked example: A circuit has inputs A, B, C. An AND gate takes A and B. An OR gate takes the AND gate output and C. The final expression is (AB)+C(A \cdot B) + C.

Half Adder and Full Adder

Half Adder

A half adder adds two single-bit numbers and produces a sum and a carry. It does not accept a carry-in from a previous stage.

ABSumCarry
0000
0110
1010
1101

The sum bit follows the XOR pattern: Sum=AB\mathrm{Sum} = A \oplus B

The carry bit follows the AND pattern: Carry=AB\mathrm{Carry} = A \cdot B

Circuit implementation: One XOR gate and one AND gate.

Full Adder

A full adder adds two single-bit numbers plus a carry-in from a previous stage, producing a sum and a carry-out.

ABCinC_{in}SumCoutC_{out}
00000
00110
01010
01101
10010
10101
11001
11111

Sum derivation via K-map:

BCin=00B \cdot C_{in} = 00BCin=01B \cdot C_{in} = 01BCin=11B \cdot C_{in} = 11BCin=10B \cdot C_{in} = 10
A=00101
A=11010

The 1s appear at (0,01)(0,01), (0,10)(0,10), (1,00)(1,00), (1,11)(1,11). No two adjacent 1s share a common group in the standard sense. Each 1 is isolated (adjacent cells are 0). Therefore, no simplification is possible, and the SOP form is the sum of minterms:

Sum=ABCin+ABCin+ABCin+ABCin\mathrm{Sum} = \overline{A} \cdot \overline{B} \cdot C_{in} + \overline{A} \cdot B \cdot \overline{C_{in}} + A \cdot \overline{B} \cdot \overline{C_{in}} + A \cdot B \cdot C_{in}

Sum=ABCin\mathrm{Sum} = A \oplus B \oplus C_{in}

Carry-out derivation via K-map:

BCin=00B \cdot C_{in} = 00BCin=01B \cdot C_{in} = 01BCin=11B \cdot C_{in} = 11BCin=10B \cdot C_{in} = 10
A=00010
A=10111

Groups:

  • (1,01),(1,11),(1,10)(1,01), (1,11), (1,10): row A=1, columns 01, 11, 10. This is AB+ACinA \cdot B + A \cdot C_{in} (column 00 is excluded). The 2×22 \times 2 group spanning (1,01)(1,01) and (1,11)(1,11) gives ACinA \cdot C_{in}, and the 2×22 \times 2 group spanning (1,11)(1,11) and (1,10)(1,10) gives ABA \cdot B.
  • (0,11),(1,11)(0,11), (1,11): column 11, both rows. This is BCinB \cdot C_{in}.

Cout=AB+ACin+BCinC_{out} = A \cdot B + A \cdot C_{in} + B \cdot C_{in}

Alternative carry expression:

Cout=(AB)+Cin(AB)C_{out} = (A \cdot B) + C_{in} \cdot (A \oplus B)

This form has significance: it shows that a full adder can be constructed from two half adders. The first half adder computes ABA \oplus B (partial sum) and ABA \cdot B (partial carry). The second half adder adds the partial sum and CinC_{in} to get the final sum, and the final carry is the OR of the partial carry and the carry from the second half adder.

Worked Example: Building a Circuit from a Truth Table

A voting system has three inputs (A, B, C -- each person votes yes=1 or no=0). The output is 1 if a majority votes yes (2 or 3 yes votes). Derive the Boolean expression and count the gates needed.

Solution

Step 1: Truth table

ABCF (majority)
0000
0010
0100
0111
1000
1011
1101
1111

Step 2: K-map

BC = 00BC = 01BC = 11BC = 10
A=00010
A=10111

Step 3: Group

  • (0,11)(0,11) and (1,11)(1,11): vertical pair → BCBC
  • (1,01)(1,01) and (1,11)(1,11): horizontal pair → ACA \cdot C
  • (1,11)(1,11) and (1,10)(1,10): horizontal pair → ABA \cdot B

Essential prime implicants: BCBC, ACAC, ABAB (each covers a minterm that no other group covers: m3m_3 only by BCBC, m5m_5 only by ACAC, m6m_6 only by ABAB).

F=AB+AC+BCF = A \cdot B + A \cdot C + B \cdot C

Step 4: Gate count

  • 3 AND gates (2-input each)
  • 1 OR gate (3-input)
  • Total: 4 gates

Alternative implementation using XOR: F=AB+C(AB)F = A \cdot B + C \cdot (A \oplus B)

This uses 1 XOR gate, 2 AND gates, 1 OR gate = 4 gates (same count, but uses XOR which may be cheaper in some implementations).

Ripple Carry Adder

A ripple carry adder chains multiple full adders to add multi-bit numbers. The carry-out of each stage feeds into the carry-in of the next stage. For an nn-bit adder, nn full adders are required.

The main disadvantage is propagation delay: the carry must ripple through all stages sequentially. The worst-case delay is n×tcarryn \times t_{carry}, where tcarryt_{carry} is the carry propagation time of a single full adder.

Common Pitfalls

Forgetting to Apply De Morgan's Correctly

The most common error is distributing the NOT incorrectly. De Morgan's Laws invert each variable AND swap the operator. A typical mistake:

AB+CAB+C\overline{A \cdot B + C} \neq \overline{A} \cdot \overline{B} + \overline{C}

The correct application is:

AB+C=ABC=(A+B)C\overline{A \cdot B + C} = \overline{A \cdot B} \cdot \overline{C} = (\overline{A} + \overline{B}) \cdot \overline{C}

Incomplete K-Map Grouping

Failing to identify all possible groups, particularly wrap-around groups, leads to non-minimal expressions. Always check:

  • Top and bottom rows for horizontal adjacency
  • Left and right columns for vertical adjacency
  • The four corners as a valid 2×22 \times 2 group
  • Groups of 4 before groups of 2 (larger groups eliminate more variables)

Missing Essential Prime Implicants

An essential prime implicant is a group that covers at least one minterm not covered by any other group. If you fail to include all essential prime implicants, the expression will not correctly represent the function. Always identify essential prime implicants first, then cover any remaining uncovered minterms with the largest possible groups.

Confusing SOP and POS

Sum-of-products (SOP) is an OR of ANDs. Product-of-sums (POS) is an AND of ORs. When converting from a truth table, SOP is obtained from the 1s and POS from the 0s. Mixing these up produces an incorrect expression.

Ignoring Don't Care Conditions

Don't care conditions provide additional flexibility for simplification. Setting a don't care to 0 when it should be 1 (or vice versa) may prevent the formation of a larger group, resulting in a non-minimal expression. Always consider both options for each don't care and choose the one that maximizes group sizes.

Incorrect Gate Counting

When implementing a circuit, count the actual number of physical gates required. An XOR gate is a single gate, not two gates (even though it can be expressed as AB+ABA\overline{B} + \overline{A}B). A NAND gate is a single gate, not an AND gate followed by a NOT gate. Physical gate count determines circuit cost and delay.

Problem Set

Problem 1: Construct the truth table for F=AB+ABF = \overline{A} \cdot B + A \cdot \overline{B} and identify what logic gate this is equivalent to.

Solution
ABA\overline{A}B\overline{B}AB\overline{A} \cdot BABA \cdot \overline{B}FF
0011000
0110101
1001011
1100000

F=1F = 1 when ABA \neq B. This is the XOR gate: F=ABF = A \oplus B.

If you get this wrong, revise: Basic Operators


Problem 2: Apply De Morgan's Laws to simplify A(B+C)\overline{A \cdot (B + C)}.

Solution

Step 1: Apply De Morgan's to the outer NOT:

A(B+C)=A+B+C\overline{A \cdot (B + C)} = \overline{A} + \overline{B + C}

Step 2: Apply De Morgan's to B+C\overline{B + C}:

=A+BC= \overline{A} + \overline{B} \cdot \overline{C}

Result: A+BC\overline{A} + \overline{B} \cdot \overline{C}

Verify with A=0,B=0,C=0A=0, B=0, C=0: LHS =0(0+0)=0=1= \overline{0 \cdot (0 + 0)} = \overline{0} = 1. RHS =1+11=1= 1 + 1 \cdot 1 = 1. Match.

Verify with A=1,B=1,C=0A=1, B=1, C=0: LHS =1(1+0)=1=0= \overline{1 \cdot (1 + 0)} = \overline{1} = 0. RHS =0+01=0= 0 + 0 \cdot 1 = 0. Match.

If you get this wrong, revise: De Morgan's Laws


Problem 3: Simplify F=A+AB+ABC+ABCDF = A + A \cdot B + A \cdot B \cdot C + A \cdot B \cdot C \cdot D using Boolean algebra identities.

Solution

Step 1: Apply absorption repeatedly. A+AB=AA + A \cdot B = A (absorption):

F=A+ABC+ABCDF = A + A \cdot B \cdot C + A \cdot B \cdot C \cdot D

Step 2: Apply absorption again:

F=A+ABCDF = A + A \cdot B \cdot C \cdot D

Step 3: Apply absorption one more time:

F=AF = A

Every term contains AA as a factor, so AA absorbs all of them. The entire expression simplifies to just AA.

If you get this wrong, revise: Boolean Identities


Problem 4: Minimize F(A,B,C)=(2,3,5,6,7)F(A, B, C) = \sum(2, 3, 5, 6, 7) using a 3-variable K-map.

Solution

Place minterms on the K-map:

BC = 00BC = 01BC = 11BC = 10
A=00011
A=10111

Identify groups:

  • (0,10),(0,11),(1,10),(1,11)(0,10), (0,11), (1,10), (1,11): 2×22 \times 2 square → CC (columns 10 and 11, variable B is eliminated; both rows, variable A is eliminated)
  • (1,01),(1,11),(1,10)(1,01), (1,11), (1,10): three cells in row A=1 → not a valid group (must be power of 2). Instead: (1,01),(1,11)(1,01), (1,11)ACAC, and (1,10),(1,11)(1,10), (1,11)ABAB

But the 2×22 \times 2 group already covers m2,m3,m6,m7m_2, m_3, m_6, m_7. The only uncovered minterm is m5m_5.

m5=ABCm_5 = A\overline{B}C. Group (1,01)(1,01) with (1,11)(1,11)ACAC. Or group (1,01)(1,01) with (0,01)(0,01)BC\overline{B}C.

Best option: BC\overline{B}C covers m5m_5 and also covers m1m_1 (which is 0, so no harm).

F=C+BC=CF = C + \overline{B}C = C

Wait -- check: does F=CF = C match all minterms? m2m_2 (ABC\overline{A}B\overline{C}): C=0C = 0. But m2m_2 should be 1! So FCF \neq C.

The 2×22 \times 2 group spanning columns 10 and 11 gives CC? No. Columns 10 (BC=10) and 11 (BC=11): variable B changes. So the group gives ACA \cdot C for row A=1... wait, I need to think more carefully.

The 2×22 \times 2 square covers cells (0,10),(0,11),(1,10),(1,11)(0,10), (0,11), (1,10), (1,11). In row A=0, columns 10 and 11: ABC\overline{A}B\overline{C} and ABC\overline{A}BC → eliminates C → AB\overline{A}B. In row A=1: ABCAB\overline{C} and ABCABCABAB. Together: AB+AB=B\overline{A}B + AB = B.

So the 2×22 \times 2 group gives BB, not CC.

Remaining: m5=ABCm_5 = A\overline{B}C. Group with (0,01)(0,01): BC\overline{B}C.

F=B+BCF = B + \overline{B}C

By absorption: B+BC=B+CB + \overline{B}C = B + C.

Final answer: F=B+CF = B + C

Verify: m2m_2 (ABC\overline{A}B\overline{C}): B+C=1+0=1B + C = 1 + 0 = 1. Correct. m5m_5 (ABCA\overline{B}C): B+C=0+1=1B + C = 0 + 1 = 1. Correct. m0m_0 (ABC\overline{A}\overline{B}\overline{C}): B+C=0+0=0B + C = 0 + 0 = 0. Correct.

If you get this wrong, revise: 3-Variable K-Maps


Problem 5: Convert the following truth table to both SOP and POS form:

ABF
001
010
100
111
Solution

SOP form (from the 1s -- rows 00 and 11):

F=AB+ABF = \overline{A} \cdot \overline{B} + A \cdot B

This is XNOR: F=ABF = A \odot B.

POS form (from the 0s -- rows 01 and 10):

Maxterm for row 01 (A=0,B=1A=0, B=1): A+BA + \overline{B} Maxterm for row 10 (A=1,B=0A=1, B=0): A+B\overline{A} + B

F=(A+B)(A+B)F = (A + \overline{B}) \cdot (\overline{A} + B)

Verification: Expand the POS: (A+B)(A+B)=AA+AB+BA+BB=0+AB+AB+0=AB+AB(A + \overline{B})(\overline{A} + B) = A\overline{A} + AB + \overline{B}\overline{A} + \overline{B}B = 0 + AB + \overline{A}\overline{B} + 0 = AB + \overline{A}\overline{B}. This matches the SOP. Both are correct.

If you get this wrong, revise: Converting Between Representations


Problem 6: A 4-variable K-map has 1s at positions m0,m2,m8,m10m_0, m_2, m_8, m_{10}. All other positions are 0. What is the minimized expression?

Solution
CD = 00CD = 01CD = 11CD = 10
AB=001001
AB=010000
AB=110000
AB=101001

The four 1s are at the four corners: (00,00),(00,10),(10,00),(10,10)(00,00), (00,10), (10,00), (10,10). The four corners form a valid 2×22 \times 2 group because K-maps wrap around both edges.

The four corners have: A varies (0 and 1), C varies (0 and 1), but B=0 and D=0 in all four.

F=BDF = \overline{B} \cdot \overline{D}

This is the classic "four corners" grouping. The expression requires only 2 NOT gates and 1 AND gate = 3 gates.

If you get this wrong, revise: 4-Variable K-Maps


Problem 7: Using only NAND gates, implement the NOT function, the AND function, and the OR function. Show the gate connections.

Solution

NOT from NAND: Connect both inputs to the same signal.

NAND(A,A)=AA=A\mathrm{NAND}(A, A) = \overline{A \cdot A} = \overline{A}

1 NAND gate.

AND from NAND: NAND followed by NOT (NAND-as-NOT).

NAND(NAND(A,B))=AB=AB\mathrm{NAND}(\mathrm{NAND}(A, B)) = \overline{\overline{A \cdot B}} = A \cdot B

2 NAND gates.

OR from NAND: Use De Morgan's: A+B=ABA + B = \overline{\overline{A} \cdot \overline{B}}

  • NAND gate 1: inputs A,AA, AA\overline{A} (NOT)
  • NAND gate 2: inputs B,BB, BB\overline{B} (NOT)
  • NAND gate 3: inputs A,B\overline{A}, \overline{B}AB=A+B\overline{\overline{A} \cdot \overline{B}} = A + B

3 NAND gates.

If you get this wrong, revise: NAND as Universal Gate


Problem 8: For the majority voting circuit F=AB+AC+BCF = AB + AC + BC, determine the output when: (a) A=1, B=1, C=0 (b) A=0, B=1, C=1 (c) A=0, B=0, C=1

Solution

(a) F=11+10+10=1+0+0=1F = 1 \cdot 1 + 1 \cdot 0 + 1 \cdot 0 = 1 + 0 + 0 = 1 (majority: 2 out of 3 yes)

(b) F=01+01+11=0+0+1=1F = 0 \cdot 1 + 0 \cdot 1 + 1 \cdot 1 = 0 + 0 + 1 = 1 (majority: 2 out of 3 yes)

(c) F=00+01+01=0+0+0=0F = 0 \cdot 0 + 0 \cdot 1 + 0 \cdot 1 = 0 + 0 + 0 = 0 (minority: 1 out of 3 yes)

The output is 1 whenever at least two inputs are 1.

If you get this wrong, revise: Boolean Algebra Fundamentals


Problem 9: A student writes: A+BC=A+BC\overline{A + B \cdot C} = \overline{A} + \overline{B} \cdot \overline{C}. Is this correct? If not, find and fix the error.

Solution

This is incorrect. The student applied De Morgan's only to BCB \cdot C but not to the entire expression.

Correct application:

A+BC=ABC=A(B+C)\overline{A + B \cdot C} = \overline{A} \cdot \overline{B \cdot C} = \overline{A} \cdot (\overline{B} + \overline{C})

Verify with A=0,B=1,C=1A=0, B=1, C=1:

  • LHS: 0+11=1=0\overline{0 + 1 \cdot 1} = \overline{1} = 0
  • Student's answer: 0+11=1+0=1\overline{0} + \overline{1} \cdot \overline{1} = 1 + 0 = 1 (wrong!)
  • Correct answer: 0(1+1)=1(0+0)=0\overline{0} \cdot (\overline{1} + \overline{1}) = 1 \cdot (0 + 0) = 0 (correct!)

If you get this wrong, revise: De Morgan's Laws and Common Pitfalls


Problem 10: Explain why the consensus theorem allows the term BCB \cdot C to be removed from AB+AC+BCA \cdot B + \overline{A} \cdot C + B \cdot C. Verify by checking all 8 input combinations.

Solution

The consensus theorem states: AB+AC+BC=AB+ACAB + \overline{A}C + BC = AB + \overline{A}C.

The term BCBC is redundant because whenever BC=1BC = 1 (meaning B=1B=1 and C=1C=1), either A=1A=1 (making AB=1AB=1) or A=0A=0 (making AC=1\overline{A}C=1). So BC=1BC = 1 always coincides with at least one of the other terms being 1.

Verification:

ABCABABAC\overline{A}CBCBCAB+ACAB + \overline{A}CAB+AC+BCAB + \overline{A}C + BC
00000000
00101011
01000000
01101111
10000000
10100000
11010011
11110111

The last two columns are identical for all 8 rows, confirming that BCBC is indeed redundant.

If you get this wrong, revise: Consensus Theorem


Problem 11: Design a half subtractor. It has inputs A (minuend) and B (subtrahend), and outputs Diff (difference) and Borrow. Construct the truth table, derive Boolean expressions, and identify the gates needed.

Solution

Truth table (binary subtraction: 00=00-0=0, 10=11-0=1, 11=01-1=0, 01=10-1=1 with borrow):

ABDiffBorrow
0000
0111
1010
1100

Diff: 1 when inputs differ → XOR: Diff=AB\mathrm{Diff} = A \oplus B

Borrow: 1 only when A=0,B=1A=0, B=1Borrow=AB\mathrm{Borrow} = \overline{A} \cdot B

Gates needed:

  • 1 XOR gate (for Diff)
  • 1 NOT gate (for A\overline{A})
  • 1 AND gate (for AB\overline{A} \cdot B)
  • Total: 3 gates

If you get this wrong, revise: Half Adder


Problem 12: Given F(A,B,C)=(0,2,4,6,7)F(A, B, C) = \sum(0, 2, 4, 6, 7), use a K-map to find the minimal SOP expression.

Solution
BC = 00BC = 01BC = 11BC = 10
A=01001
A=11011

Groups:

  • (0,00),(0,10),(1,00),(1,10)(0,00), (0,10), (1,00), (1,10): four corners (wrap-around 2×22 \times 2) → C\overline{C} (A and B both vary; C=0 in all four)
  • (1,10),(1,11)(1,10), (1,11): horizontal pair → ABAB

Check coverage: m0m_0 (C\overline{C}), m2m_2 (C\overline{C}), m4m_4 (C\overline{C}), m6m_6 (C\overline{C} and ABAB), m7m_7 (ABAB). All covered.

F=C+ABF = \overline{C} + AB

Gates: 1 NOT + 1 AND + 1 OR = 3 gates (or using NAND-NAND: 3 NAND gates).

If you get this wrong, revise: 4-Variable K-Maps and K-Map Grouping Rules