Minterms and the sum of products
A minterm is an AND of every input, each either plain or inverted, that is 1 on exactly one row of the truth table. Rows are numbered by reading the inputs as a binary number, with the first input as the most significant bit.
OR together the minterms of every row where the output is 1 and you have the canonical sum of products (SOP), often written Σm(…). For XOR of two inputs, the output is 1 on rows 1 and 2:
y = Σm(1, 2) = ~a & b | a & ~bMaxterms and the product of sums
A maxterm is an OR of every input that is 0 on exactly one row. AND together the maxterms of every row where the output is 0 and you have the canonical product of sums (POS), written ΠM(…). For the same XOR:
y = ΠM(0, 3) = (a | b) & (~a | ~b)SOP maps directly onto two levels of NAND gates and POS onto two levels of NOR gates, which is why both forms are taught.
Karnaugh maps
A Karnaugh map arranges the truth table in a grid whose rows and columns follow Gray code order (00, 01, 11, 10), so neighbouring cells differ in exactly one input. That makes the simplification visible: any rectangle of 1, 2, 4 or 8 adjacent 1-cells is a product term in which the changing inputs drop out. The map wraps around at the edges.
- Group only 1s, in rectangles whose size is a power of two.
- Make each group as large as possible.
- Use as few groups as possible, overlapping where that helps.
- Each group becomes one AND term; OR the terms together.
Maps work well up to four inputs and become hard to read beyond five or six. For more inputs, tools use the Quine–McCluskey method or heuristics such as Espresso.
What the simulator does
The SOP / POS tab lists the minterms and both canonical forms, and a simplified sum of products. The simplification finds every prime implicant (every largest group a K-map would allow), keeps the essential ones, and covers what is left with the widest remaining groups. The result is always equivalent to your expression and usually the smallest sum of products. Don't-care conditions are not supported yet.
A three-input example
The majority function of a, b and c is 1 when at least two inputs are 1: rows 3, 5, 6 and 7, so y = Σm(3, 5, 6, 7). On a K-map with a as the row and bc across the top in the order 00, 01, 11, 10, the four 1-cells form three overlapping pairs: a & b, a & c and b & c. Each pair drops the one input that changes inside it, giving y = a & b | a & c | b & c.
Simplify the majority minterms: ~a & b & c | a & ~b & c | a & b & ~c | a & b & c
Don't-care conditions
Sometimes certain input combinations can never happen, such as the codes 10 to 15 on a 4-bit input that only ever carries a decimal digit. Those rows are don't-cares, marked X on a K-map. You may treat each X as 1 or 0, whichever makes the groups larger, which often gives a much smaller circuit. The simulator does not support don't-cares yet, so enter only the rows that matter.
Choosing SOP or POS
If the function has few 1s, its SOP is short; if it has few 0s, its POS is short. A quick look at the count of rows where y = 1 in the simulator tells you which form to try first. Either form can be implemented with NAND-NAND or NOR-NOR logic respectively, which matters when a library offers only inverting gates.
Sources and further reading
Every law, table and example on this page is checked by the automated tests of the simulator’s logic engine.