Discrete Mathematics · Unit 2 · Topic 10

Boolean algebra: algebra with only 0 and 1.

Short answer

Boolean algebra uses OR \((+)\), AND \((\cdot)\) and NOT \(('\,)\) on the values 0 and 1. Its laws, such as \(x + xy = x\) and De Morgan's \((x + y)' = x'y'\), let you simplify expressions; Karnaugh maps do it by grouping 1s.

Example: \(xy + xy' + x'y = x + x'y = x + y\).

EngineeringComputer Science / ITBSc
01

Boolean algebra and its laws

Before you start: truth tables from propositional logic are the same idea with 1 for true and 0 for false.

Boolean algebra works with variables that take only the values 0 and 1, and three operations: OR written \(x + y\), AND written \(x\cdot y\) or \(xy\), and NOT (complement) written \(x'\). \(x + y = 1\) when at least one of them is 1; \(xy = 1\) only when both are 1; \(x' = 1 - x\).

LawOR formAND form
Identity\(x + 0 = x\)\(x\cdot 1 = x\)
Domination\(x + 1 = 1\)\(x\cdot 0 = 0\)
Idempotent\(x + x = x\)\(x\cdot x = x\)
Complement\(x + x' = 1\)\(x\cdot x' = 0\)
Commutative\(x + y = y + x\)\(xy = yx\)
Associative\((x + y) + z = x + (y + z)\)\((xy)z = x(yz)\)
Distributive\(x + yz = (x + y)(x + z)\)\(x(y + z) = xy + xz\)
Absorption\(x + xy = x\)\(x(x + y) = x\)
De Morgan\((x + y)' = x'y'\)\((xy)' = x' + y'\)

Also \((x')' = x\) (involution). Two laws look strange if you think of ordinary numbers: \(x + x = x\), and \(x + yz = (x + y)(x + z)\). Both are true here because the only values are 0 and 1. You can prove any of these laws by checking all the rows of a truth table.

Principle of duality

The dual of an identity is found by swapping \(+\) with \(\cdot\) and 0 with 1, leaving the variables and complements alone. If an identity is true, so is its dual.

Example: \(x + 0 = x\) has dual \(x\cdot 1 = x\). That is why the laws in the table come in pairs.

Abstractly, a Boolean algebra is a lattice that is distributive and in which every element has a complement. The divisors of 30 form one: take lcm as \(+\), gcd as \(\cdot\), 1 as the zero, 30 as the one, and \(30/d\) as the complement of \(d\). For example \(\text{lcm}(6, 5) = 30\) and \(\gcd(6, 5) = 1\).

02

Boolean functions, SOP and POS

A Boolean function of \(n\) variables gives 0 or 1 for each of the \(2^n\) input rows. Any such function can be written in two standard ways.

Canonical forms

A minterm is an AND of all the variables, each plain or complemented, that equals 1 on exactly one row. A maxterm is an OR of all the variables that equals 0 on exactly one row.

Sum of products (SOP)

OR together the minterms of the rows where \(f = 1\). Written \(f = \sum m(\ldots)\).

Product of sums (POS)

AND together the maxterms of the rows where \(f = 0\). Written \(f = \prod M(\ldots)\).

Number the rows by reading the inputs as a binary number, with \(x\) as the leftmost bit. Row 5 in three variables is \(x y z = 101\): its minterm is \(xy'z\) (complement the variables that are 0) and its maxterm is \(x' + y + z'\) (complement the variables that are 1). The SOP and POS lists use complementary row numbers.

03

Karnaugh maps

A Karnaugh map (K-map) is the truth table drawn as a grid, with rows and columns in Gray code order 00, 01, 11, 10. In that order, neighbouring cells differ in exactly one variable, and the map wraps round: the left edge is next to the right edge, and the top is next to the bottom.

  1. Fill in the map: 1 in each cell whose minterm is in the function.
  2. Group the 1s in rectangles of size 1, 2, 4, 8 or 16 (powers of 2 only). Groups may overlap and may wrap round the edges.
  3. Make each group as large as possible, and use as few groups as possible to cover every 1.
  4. Read each group as one product: keep the variables that stay constant across the group, drop the ones that change.
  5. OR the products together. That is a minimal SOP.

A group of \(2^k\) cells removes \(k\) variables. In a 3-variable map, a group of 4 leaves one variable; in a 4-variable map, a group of 4 leaves two.

Link to logic gates. AND, OR and NOT gates compute \(xy\), \(x + y\) and \(x'\), so every Boolean expression is a circuit and a shorter expression is a cheaper circuit. NAND, \((xy)'\), is universal: \(x' = (xx)'\), \(xy = \big((xy)'\big)'\) and \(x + y = (x'y')'\), so every circuit can be built from NAND gates alone. The same is true of NOR.

04

Solved examples

Example 1: Proving absorption

Easy

Prove \(x + xy = x\) using the laws.

  1. Identity: \(x + xy = x\cdot 1 + x\cdot y\).
  2. Distributive: \(= x(1 + y)\).
  3. Domination: \(1 + y = 1\), so \(= x\cdot 1 = x\).

Answer\(x + xy = x\)

Example 2: Writing a dual

Easy

Given that \(x + x'y = x + y\), write its dual and say whether it is true.

  1. Swap \(+\) and \(\cdot\): the left side \(x + x'\cdot y\) becomes \(x\cdot(x' + y)\), and the right side \(x + y\) becomes \(x\cdot y\).
  2. Duality says the dual of a true identity is true. Direct check: \(x(x' + y) = xx' + xy = 0 + xy = xy\). ✓

Answer\(x(x' + y) = xy\), which is true.

Example 3: Simplifying with laws

Medium

Simplify \(xy + xy' + x'y\).

  1. Group the first two terms: \(xy + xy' = x(y + y') = x\cdot 1 = x\).
  2. So the expression is \(x + x'y\).
  3. Distributive (OR form): \(x + x'y = (x + x')(x + y) = 1\cdot(x + y)\).

Answer\(xy + xy' + x'y = x + y\)

Example 4: Complement with De Morgan

Easy

Find the complement of \(f = x + y'z\).

  1. De Morgan on the OR: \(f' = x'\cdot(y'z)'\).
  2. De Morgan on the AND: \((y'z)' = y + z'\).

Answer\(f' = x'(y + z')\)

Example 5: Canonical SOP and POS

Medium

The majority function \(f(x, y, z)\) is 1 when at least two inputs are 1. Write it in canonical SOP and POS form.

  1. Rows with \(f = 1\): \(011, 101, 110, 111\), that is rows 3, 5, 6, 7.
  2. SOP: \(f = x'yz + xy'z + xyz' + xyz = \sum m(3, 5, 6, 7)\).
  3. Rows with \(f = 0\): 0, 1, 2, 4. Row 0 (000) has maxterm \(x + y + z\), row 1 (001) has \(x + y + z'\), and so on.
  4. POS: \(f = (x + y + z)(x + y + z')(x + y' + z)(x' + y + z) = \prod M(0, 1, 2, 4)\).

Answer\(f = \sum m(3, 5, 6, 7) = \prod M(0, 1, 2, 4)\); it simplifies to \(xy + yz + xz\).

Example 6: Three-variable K-map

Medium

Simplify \(f(x, y, z) = \sum m(0, 2, 4, 5, 6)\) using a K-map.

  1. Fill in the map (rows \(x\), columns \(yz\) in Gray order):
    x \ yz00011110
    01001
    11101
  2. The four 1s in columns 00 and 10 form a group of 4, joined by wrapping round the sides. Across it, \(x\) and \(y\) change and \(z = 0\) throughout: the group is \(z'\).
  3. The 1 at \(m_5\) (row 1, column 01) is not covered yet. Pair it with \(m_4\) next to it: \(x = 1,\ y = 0\), \(z\) changes. That group is \(xy'\).

Answer\(f = z' + xy'\)

Example 7: Four-variable K-map

Exam level

Simplify \(f(w, x, y, z) = \sum m(0, 1, 2, 5, 8, 9, 10)\).

  1. Fill in the map (rows \(wx\), columns \(yz\)):
    wx \ yz00011110
    001101
    010100
    110000
    101101
  2. The four corners \(m_0, m_2, m_8, m_{10}\) form a group by wrapping both ways: \(x = 0\) and \(z = 0\) throughout. Group: \(x'z'\).
  3. \(m_0, m_1, m_8, m_9\) form a square across the top and bottom rows: \(x = 0,\ y = 0\). Group: \(x'y'\).
  4. \(m_5\) is left. Pair it with \(m_1\) above it: \(w = 0,\ y = 0,\ z = 1\). Group: \(w'y'z\).

Answer\(f = x'z' + x'y' + w'y'z\)

Example 8: A smaller circuit

Exam level

Simplify \(f = (x + y)(x + y')(x' + z)\) and say what it means for the circuit.

  1. Distributive (OR form) on the first two brackets: \((x + y)(x + y') = x + yy' = x + 0 = x\).
  2. So \(f = x(x' + z) = xx' + xz = 0 + xz\).
  3. The original needs 3 OR gates, 1 three-input AND gate and 2 NOT gates. The simplified form needs one AND gate.

Answer\(f = xz\)

Vipul Sir's tip

Label the K-map edges in Gray code before you write a single 1: 00, 01, 11, 10. Then check every group by reading the variable values off the edges, cell by cell. Most lost marks in K-map questions come from a map drawn in ordinary binary order.

05

Common mistakes

1. Getting De Morgan half right

\((x + y)' \ne x' + y'\). Take \(x = 1,\ y = 0\): the left side is \(1' = 0\), the right side is \(0 + 1 = 1\). The correct law flips the operation too: \((x + y)' = x'y'\).

2. Drawing the K-map in binary order

Columns in the order 00, 01, 10, 11 put \(01\) next to \(10\), which differ in two variables, so groups read off that map are wrong. Use 00, 01, 11, 10.

3. Stopping with groups that are too small

For \(\sum m(0, 2, 4, 5, 6)\), the cover \(x'z' + xz' + xy'\) is correct but not minimal. The two pairs \(x'z'\) and \(xz'\) are one group of 4, \(z'\). Always look for the biggest group, including wrap-round ones.

06

Practice questions

Try each one on paper before you open the answer.

Q1Simplify \(x + x'y\).

Distributive: \((x + x')(x + y) = 1\cdot(x + y) = x + y\).

Q2Simplify \(x'y'z + x'yz + xy'z\).

\(x'y'z + x'yz = x'z(y' + y) = x'z\). Then \(x'z + xy'z = z(x' + xy') = z(x' + y')\), using \(x' + xy' = x' + y'\). Answer: \(x'z + y'z\).

Q3Write the dual of \(x(y + z) = xy + xz\).

\(x + yz = (x + y)(x + z)\), the other distributive law.

Q4Write \(x \oplus y\) (exclusive OR, 1 when exactly one input is 1) in canonical SOP and POS form.

\(f = 1\) on rows 01 and 10: SOP \(x'y + xy'\). \(f = 0\) on rows 00 and 11: POS \((x + y)(x' + y')\).

Q5Use a K-map to simplify \(f(x, y, z) = \sum m(1, 3, 4, 5, 7)\).

The 1s in columns 01 and 11 (both rows) form a group of 4 with \(z = 1\): \(z\). That leaves \(m_4\); pair it with \(m_5\): \(xy'\). So \(f = z + xy'\).

Q6Use a K-map to simplify \(f(w, x, y, z) = \sum m(0, 2, 5, 7, 8, 10, 13, 15)\).

The four corners \(m_0, m_2, m_8, m_{10}\) give \(x'z'\). The centre block \(m_5, m_7, m_{13}, m_{15}\) gives \(xz\). So \(f = x'z' + xz\).

Stuck on a question?

Bring it to a free demo class and work through it with Vipul Sir. Book on WhatsApp.

07

Frequently asked questions

What are the basic laws of Boolean algebra?

Identity, domination, idempotent, complement, commutative, associative, distributive, absorption and De Morgan's laws, each in an OR form and an AND form. Every law can be checked with a truth table.

What is the difference between SOP and POS?

SOP (sum of products) ORs together AND terms and is read off the rows where the function is 1. POS (product of sums) ANDs together OR terms and is read off the rows where the function is 0. Both describe the same function.

What is a Karnaugh map used for?

To simplify a Boolean function of 2 to 4 variables by eye. Adjacent cells differ in one variable, so grouping 1s in blocks of 2, 4 or 8 removes variables and gives a minimal sum of products.

Why are NAND and NOR called universal gates?

Because NOT, AND and OR can each be built from NAND gates alone (or from NOR gates alone), so any circuit can be made from just one type of gate.

Related lessons

← All 10 Discrete Mathematics topics
Vipul Sir
Written by Vipul Sir

Vipul Sir has taught mathematics for over 15 years to HSC, CBSE, ICSE, IGCSE/IB, Diploma, Engineering and BSc students at VVS Classes in Goregaon and Vile Parle, Mumbai. He teaches every class himself, concepts first and exam technique second.

Discrete Mathematics

Get Discrete Mathematics right, with Vipul Sir beside you.

Concept-first classes in small batches in Goregaon and Vile Parle, or online. Your first class is free.

WhatsApp↗