Boolean Algebra and Karnaugh Maps: Laws, SOP, POS and K-Map MCQs

Boolean algebra is the arithmetic of the values 0 and 1, and it is how digital circuits are designed and simplified. Computer science papers for lecturer, programmer and ICS/ECAT entry tests ask for a law by name, a simplified form of an expression, or the result of a Karnaugh map given as a list of minterms. In this lesson NOT is written as A′, AND as A·B and OR as A + B. Every simplification below was checked against a full truth table by a program.

Asked in: PPSC, FPSC, NTS, ETEA, KPPSC, SSC, IBPS and ICS/ECAT computer

Basic operations and the identity laws

A Boolean variable takes only the values 0 (false) and 1 (true). NOT A, written A′, flips the value. A·B (AND) is 1 only when both are 1. A + B (OR) is 1 when at least one is 1. In an expression NOT is applied first, then AND, then OR, unless brackets say otherwise, so A + B·C means A + (B·C).

The identity and null laws say what happens with the constants: A + 0 = A and A·1 = A (identity); A + 1 = 1 and A·0 = 0 (null or dominance). The complement laws: A + A′ = 1 and A·A′ = 0. The idempotent laws: A + A = A and A·A = A. The involution law: (A′)′ = A.

Commutative, associative, distributive and absorption laws

Order and grouping do not matter: A + B = B + A and A·B = B·A (commutative); (A + B) + C = A + (B + C) and (A·B)·C = A·(B·C) (associative). AND distributes over OR as in ordinary algebra, A·(B + C) = A·B + A·C, but in Boolean algebra OR also distributes over AND: A + B·C = (A + B)·(A + C).

Absorption laws remove a term that is already covered: A + A·B = A and A·(A + B) = A. Two more results are used constantly: A + A′·B = A + B and A·(A′ + B) = A·B. The consensus theorem says A·B + A′·C + B·C = A·B + A′·C; the term B·C is redundant because whenever it is 1, one of the other two terms is already 1.

Every law has a dual, obtained by swapping + with · and 0 with 1 while leaving the variables alone. If a law is true, its dual is also true; for example the dual of A + 0 = A is A·1 = A.

De Morgan’s theorems

De Morgan’s theorems tell how to complement a whole expression: break the bar over the group and change the operator. (A + B)′ = A′·B′ and (A·B)′ = A′ + B′. They extend to any number of variables, for example (A + B + C)′ = A′·B′·C′ and (A·B·C)′ = A′ + B′ + C′.

For a bigger expression, apply the rule one level at a time and keep brackets: (A + B·C)′ = A′·(B·C)′ = A′·(B′ + C′). These theorems are why a NAND gate equals an OR gate with inverted inputs, and a NOR gate equals an AND gate with inverted inputs.

Minterms, maxterms, SOP and POS

With n variables a truth table has 2ⁿ rows. A minterm is an AND term containing every variable once, true in exactly one row; row number i is called m(i). In this lesson the first-named variable is the most significant bit, so for F(A, B, C) the row A = 1, B = 0, C = 1 is row 5 and its minterm is A·B′·C.

Sum of products (SOP) is an OR of AND terms, like A·B + C′. The canonical SOP lists every minterm where F = 1, written F = Σm(…). A maxterm is an OR term with every variable, false in exactly one row, written M(i); in it a variable appears plain where its value is 0 and primed where its value is 1. Product of sums (POS) is an AND of OR terms, and the canonical POS lists the rows where F = 0, written F = ΠM(…). The two lists together always cover every row exactly once.

Karnaugh maps for 2, 3 and 4 variables

A Karnaugh map (K-map) is the truth table drawn as a grid of 2ⁿ cells, with rows and columns labelled in Gray code order (00, 01, 11, 10) so that neighbouring cells differ in exactly one variable. A 2-variable map has 4 cells, a 3-variable map 8 and a 4-variable map 16. The map wraps around: the left edge touches the right edge and the top touches the bottom, so the four corners of a 4-variable map are neighbours.

To simplify, put a 1 in each cell listed in Σm, then circle groups of 1s that are rectangles of 1, 2, 4, 8 or 16 cells, a power of two, never 3 or 6. Make each group as large as possible and use as few groups as possible; groups may overlap. Each group becomes one product term containing only the variables that stay constant across the group. A group of 2 removes one variable, a group of 4 removes two and a group of 8 removes three.

Don’t-care conditions

Sometimes certain input combinations can never occur, or the output for them does not matter. These are don’t-care terms, written d(…) and marked X on the map. For example, a circuit that reads one BCD digit never receives the codes for 10 to 15.

A don’t-care may be treated as 1 when it helps make a group bigger, and as 0 otherwise; it never has to be covered. Using don’t-cares well often turns several small groups into one large group and gives a much shorter expression.

Solved examples

  1. Simplify F = A·B + A·B′ + A′·B.
    1. Group the first two terms: A·B + A·B′ = A·(B + B′) = A·1 = A.
    2. Now F = A + A′·B, and the rule A + A′·B = A + B gives the result.
    3. Check: F is 0 only when A = 0 and B = 0, exactly like A + B.
    Answer: F = A + B
  2. Use De Morgan’s theorems to find the complement of F = A + B·C.
    1. F′ = (A + B·C)′. Break the outer bar and change + to ·: F′ = A′·(B·C)′.
    2. Apply De Morgan again to (B·C)′, which becomes B′ + C′.
    3. So F′ = A′·(B′ + C′), which expands to A′·B′ + A′·C′.
    Answer: F′ = A′·(B′ + C′) = A′·B′ + A′·C′
  3. A function F(A, B) is 1 only when exactly one input is 1. Write it as a list of minterms and in canonical SOP form.
    1. F = 1 in rows A B = 01 (row 1) and 10 (row 2).
    2. Row 1 gives the minterm A′·B and row 2 gives A·B′.
    3. This is the XOR function.
    Answer: F = Σm(1, 2) = A′·B + A·B′
  4. Simplify F(A, B, C) = Σm(0, 2, 4, 5, 6) with a K-map.
    1. Rows 0, 2, 4, 6 all have C = 0. In a 3-variable map with A down the side and B C across the top (00, 01, 11, 10), these are the two outer columns, which join by wrap-around into a group of 4 that gives C′.
    2. Row 5 (A B C = 101) is still uncovered. Pair it with row 4 (100): A = 1 and B = 0 stay constant, giving A·B′.
    3. All five 1s are covered with two groups.
    Answer: F = C′ + A·B′
  5. Simplify F(A, B, C, D) = Σm(0, 4, 5, 7, 8, 12, 13, 15).
    1. Rows 0, 4, 8, 12 all have C = 0 and D = 0, with A and B taking every value: a group of 4 giving C′·D′.
    2. Rows 5, 7, 13, 15 all have B = 1 and D = 1: another group of 4 giving B·D.
    3. Every 1 is covered, so two terms of two literals each are enough.
    Answer: F = C′·D′ + B·D
  6. Hamza’s circuit reads a BCD digit (A B C D) and outputs 1 for the even digits 0, 2, 4, 6 and 8. Codes 10 to 15 never occur. Simplify F = Σm(0, 2, 4, 6, 8) + d(10, 11, 12, 13, 14, 15).
    1. Every even code ends in D = 0. The cells with D = 0 are 0, 2, 4, 6, 8, 10, 12 and 14.
    2. Five of them are 1s and the other three (10, 12, 14) are don’t-cares, so treat those as 1s and take all eight cells as one group.
    3. A group of 8 removes three variables, leaving only D′. Without the don’t-cares the best answer would be A′·D′ + B′·C′·D′.
    Answer: F = D′

Exam shortcuts

Common mistakes

Practice MCQs

  1. What is the value of A·A′ for any value of A?
    A) 1
    B) 0
    C) A
    D) A′
    Answer: B) 0 — By the complement law a variable ANDed with its own complement is always 0, because one of the two is 0 in every case. A + A′, not A·A′, equals 1, and the result cannot depend on A, so neither A nor A′ is right.
  2. The law A + A = A is called the:
    A) Idempotent law
    B) Absorption law
    C) Involution law
    D) Complement law
    Answer: A) Idempotent law — The idempotent law says that ORing (or ANDing) a variable with itself leaves it unchanged. The absorption law is A + A·B = A, the involution law is (A′)′ = A, and the complement law is A + A′ = 1.
  3. What is the dual of the law A + 0 = A?
    A) A·0 = 0
    B) A + 1 = 1
    C) A·1 = A
    D) A′ + 1 = A′
    Answer: C) A·1 = A — To form the dual, swap + with · and 0 with 1 but leave the variables alone, so A + 0 = A becomes A·1 = A. A·0 = 0 and A + 1 = 1 are true laws but they are duals of each other, not of this one, and complementing the variable is not part of forming a dual.
  4. Simplify A·B + A·B′.
    A) B
    B) A·B
    C) 1
    D) A
    Answer: D) A — Taking A common gives A·(B + B′) = A·1 = A. The value does not depend on B at all, so B and A·B are wrong, and the expression is 0 whenever A = 0, so it is not always 1.
  5. By De Morgan’s theorem, (A·B·C)′ equals:
    A) A′·B′·C′
    B) A′ + B′ + C′
    C) A + B + C
    D) A′·B′ + C′
    Answer: B) A′ + B′ + C′ — Complementing a product complements every variable and changes AND into OR. A′·B′·C′ forgets to change the operator, A + B + C forgets to complement the variables, and A′·B′ + C′ changes only one of the operators.
  6. Simplify A·(A′ + B).
    A) A
    B) B
    C) A·B
    D) A + B
    Answer: C) A·B — Distributing gives A·A′ + A·B = 0 + A·B = A·B. A alone would be 1 when A = 1 and B = 0, B alone would be 1 when A = 0 and B = 1, and A + B is 1 in both of those rows, but the original expression is 0 in both.
  7. Which of these cannot be the size of a group in a Karnaugh map?
    A) 6 cells
    B) 1 cell
    C) 2 cells
    D) 8 cells
    Answer: A) 6 cells — K-map groups must contain a power of two cells, 1, 2, 4, 8 or 16, so that each group corresponds to a single product term. Six is not a power of two. A single cell, a pair and a group of eight are all allowed.
  8. Simplify F(A, B) = Σm(0, 2), where A is the more significant bit.
    A) A′
    B) B
    C) A·B′
    D) B′
    Answer: D) B′ — Row 0 is A B = 00 and row 2 is A B = 10; in both B = 0 while A changes, so F = A′·B′ + A·B′ = B′. A′ would cover rows 0 and 1, B covers rows 1 and 3, and A·B′ covers only row 2.
  9. Simplify F(A, B, C) = Σm(1, 3, 5, 7).
    A) A
    B) C
    C) A′·C
    D) B·C
    Answer: B) C — Rows 1, 3, 5 and 7 are exactly the odd rows, the ones with C = 1, and those four cells form one group that leaves only C. A covers rows 4 to 7, A′·C covers only rows 1 and 3, and B·C covers only rows 3 and 7.
  10. Simplify F(A, B, C) = Σm(0, 1, 2, 3, 6, 7).
    A) A′ + B
    B) A + B′
    C) A′·B
    D) A′ + C
    Answer: A) A′ + B — Rows 0 to 3 all have A = 0, a group of four giving A′; rows 2, 3, 6 and 7 all have B = 1, a group of four giving B. So F = A′ + B, which is 0 only in rows 4 and 5. A + B′ is 0 in rows 2 and 3, A′·B misses rows 0, 1, 6 and 7, and A′ + C misses row 6.
  11. Simplify F(A, B, C, D) = Σm(0, 2, 8, 10).
    A) A′·B′
    B) B·D
    C) C′·D′
    D) B′·D′
    Answer: D) B′·D′ — Rows 0, 2, 8 and 10 are the four corners of a 4-variable map, which are neighbours by wrap-around; in all of them B = 0 and D = 0, giving B′·D′. A′·B′ covers rows 0 to 3, B·D covers rows 5, 7, 13 and 15, and C′·D′ covers rows 0, 4, 8 and 12.
  12. By the consensus theorem, A·B + A′·C + B·C simplifies to:
    A) A·B + B·C
    B) A′·C + B·C
    C) A·B + A′·C
    D) B·C
    Answer: C) A·B + A′·C — The term B·C is the consensus of A·B and A′·C: whenever B = C = 1, either A = 1 makes A·B true or A = 0 makes A′·C true, so B·C can be dropped. Keeping B·C and dropping A·B or A′·C instead loses rows such as A = 1, B = 1, C = 0 or A = 0, B = 0, C = 1, and B·C alone loses both.
  13. How many minterms does the function F(A, B, C) = A + B′·C contain?
    A) 3
    B) 5
    C) 4
    D) 6
    Answer: B) 5 — A = 1 gives four rows (4, 5, 6, 7), and B′·C adds rows with B = 0 and C = 1, which are rows 1 and 5; row 5 is already counted, so the minterms are 1, 4, 5, 6 and 7, five in all. 4 counts only the A part, 6 counts row 5 twice, and 3 is the number of literals.
  14. A function of A, B and C is given as F = ΠM(0, 1). What is its simplest form?
    A) A + B
    B) A·B
    C) A′ + B′
    D) A + B + C
    Answer: A) A + B — F is 0 only in rows 0 and 1, where A = 0 and B = 0 whatever C is, so F = (A + B + C)·(A + B + C′) = A + B. A + B + C would also be 1 in row 1, A·B is 1 only in rows 6 and 7, and A′ + B′ is 0 in rows 6 and 7 instead of rows 0 and 1.
  15. Simplify F(A, B, C, D) = Σm(1, 3, 5, 7, 9) + d(11, 13, 15).
    A) A′·D
    B) C′·D
    C) D
    D) A′ + D
    Answer: C) D — The 1s and don’t-cares together are all eight odd rows, the rows with D = 1, so treating the don’t-cares as 1s gives one group of eight and F = D. A′·D misses row 9, C′·D misses rows 3 and 7, and A′ + D wrongly makes F = 1 in rows such as 0, which must be 0.

Questions

Why is A + B·C equal to (A + B)·(A + C) in Boolean algebra when it is false in ordinary algebra?

Because Boolean variables can only be 0 or 1. Expanding the right side gives A + A·C + A·B + B·C, and absorption reduces the first three terms to A, leaving A + B·C. A truth table confirms it in all eight rows.

What is the difference between SOP and POS?

SOP is an OR of AND terms and is built from the rows where F = 1. POS is an AND of OR terms and is built from the rows where F = 0. Both describe the same function and either can be simplified with a K-map.

Why do K-maps use the order 00, 01, 11, 10?

This Gray code order makes neighbouring cells differ in only one variable, so a pair of adjacent 1s always shares all variables except one, which can then be removed.

Must every don’t-care be included in a group?

No. A don’t-care is included only if it helps form a larger group. Any don’t-care left out is simply treated as 0.