A truth table says exactly what a function does. Canonical forms turn it into a formula mechanically, with no cleverness needed.
Minterms and the sum of products
A minterm is an AND of every variable, each either plain or complemented, so that it is 1 on exactly one row of the table. Number the rows in binary: for variables A, B, C, row 5 is A = 1, B = 0, C = 1, and its minterm m5 = AB'C (a 0 in the row means the variable is complemented).
Any function is the OR of the minterms of the rows where it is 1. This is the sum of products (SOP) form, written with Σ:
The majority function of three inputs (1 when at least two inputs are 1) is 1 on rows 3, 5, 6 and 7:
F = Σm(3, 5, 6, 7) = A'BC + AB'C + ABC' + ABC
Maxterms and the product of sums
A maxterm is an OR of every variable that is 0 on exactly one row: for row 5 it is M5 = A' + B + C' (now a 1 in the row means complemented). Any function is the AND of the maxterms of the rows where it is 0: the product of sums (POS), written with Π:
F = ΠM(0, 1, 2, 4)
The SOP lists the 1s and the POS lists the 0s, so together they use every row number exactly once.
names = ["A", "B", "C"]
table = [0, 0, 0, 1, 0, 1, 1, 1] # the majority function, rows 0 to 7
def term(row, sop):
bits = format(row, "03b")
if sop: # minterm: a 0 bit means complemented
return "".join(n if b == "1" else n + "'" for n, b in zip(names, bits))
return "(" + " + ".join(n + "'" if b == "1" else n for n, b in zip(names, bits)) + ")"
ones = [r for r in range(8) if table[r] == 1]
zeros = [r for r in range(8) if table[r] == 0]
print("F = Σm" + str(tuple(ones)))
print("SOP:", " + ".join(term(r, True) for r in ones))
print("F = ΠM" + str(tuple(zeros)))
print("POS:", "".join(term(r, False) for r in zeros))Why canonical forms matter
They always exist and are easy to build: a decoder plus an OR gate implements any SOP (see the Multiplexers and decoders lesson). But they are rarely the smallest circuit: the majority function needs only AB + AC + BC. The next lesson's Karnaugh maps find that smaller form.
Common mistakes
- In a minterm a 0 means the variable is complemented; in a maxterm it is the 1s that are complemented.
- Putting the same row in both Σm and ΠM: a row is either a 1 or a 0 of the function.
- Numbering rows in the wrong variable order: A is the leftmost (most significant) bit.
Quick check
Practice problems for this lesson
My notes
Write down what you want to remember from this lesson. Notes are saved on this device as you type, and appear on your dashboard.