Circuit 3D

Boolean algebra and Karnaugh maps

Boolean algebra is the maths of values that are only true or false, 1 or 0, combined with AND (written ·), OR (+) and NOT (′). It describes logic circuits, and its laws simplify them: by De Morgan’s law, (AB)′ = A′ + B′, so a NAND gate is an OR gate with inverted inputs.

(AB)′ = A′ + B′

where AB means A AND B, + means OR and ′ means NOT, so a NAND gate is an OR gate with inverted inputs.

A Karnaugh map lays a truth table out as a grid, so you can simplify by circling groups of 1s.

What is Boolean algebra?

Boolean algebra is a system of logic in which every value is either true or false, 1 or 0, and the only operations are AND, OR and NOT.

George Boole set it out in 1854; Claude Shannon showed in 1937 that it describes switching circuits, and it now underpins every digital chip. Figure 1 simplifies a function with a Karnaugh map, which the sections below explain.

A \ BC 00011110 0 1 00100111

Majority, true for inputs 3, 5, 6, 7: the map shows three overlapping pairs, each dropping the one input that changes across it, so F = AB + AC + BC.

Figure 1. A three-input Karnaugh map: A down the side, BC across in Gray code, each cell one row of the truth table numbered 4A + 2B + C.

What are the basic Boolean operations?

The basic Boolean operations are AND, written AB, which is 1 only when both inputs are 1; OR, written A + B, which is 1 when either is; and NOT, written A′, which flips its input.

Each matches a logic gate, and any Boolean expression can be built from them. NAND and NOR are AND and OR followed by NOT, and each on its own can build every other gate.

What is De Morgan’s law?

De Morgan’s law says that NOT (A AND B) equals (NOT A) OR (NOT B), and NOT (A OR B) equals (NOT A) AND (NOT B).

In circuits it means a NAND gate is an OR gate with inverted inputs, and a NOR gate an AND gate with inverted inputs, so designs can swap one for the other. Figure 2 checks the first form against every row of its truth table.

AB (AB)′A′ + B′ 00 11 01 11 10 11 11 00

A = 1, B = 0: AB is 0, so (AB)′ is 1; and A′ is 0, B′ is 1, so A′ + B′ is 1. both sides are 1, and they match in every row.

Figure 2. De Morgan’s law, (AB)′ = A′ + B′, checked against the full truth table: a NAND gate is an OR gate with inverted inputs.

How do you simplify a Boolean expression?

To simplify a Boolean expression, apply its laws, such as factoring out common terms and using A + A′ = 1 and A · 1 = A, until nothing more cancels.

Many look like ordinary algebra, but some don’t: A + A = A, and A + AB = A. Figure 3 shows AB + AB′ shrinking to A, one law at a time.

F = AB + AB′= A(B + B′)= A · 1= A

Step 1, F = AB + AB′: the starting expression: A AND B, or A AND NOT B.

Figure 3. Simplifying AB + AB′ with Boolean algebra’s laws, one law at a time.

What is a Karnaugh map?

A Karnaugh map is a grid version of a truth table, laid out in Gray code so neighboring cells differ in just one input, which lets you simplify by grouping 1s by eye.

Circle the 1s in rectangles of 1, 2, 4 or 8 cells, as large as possible, wrapping round the edges if needed. Each group becomes one term, keeping only the inputs that stay the same across it. Maurice Karnaugh introduced it in 1953.

Why simplify logic circuits?

Logic circuits are simplified because a simpler expression needs fewer gates, so the circuit costs less, uses less power and switches faster.

It also makes logic easier to check and wire: the majority function, three ANDs and an OR when simplified, takes far more gates written out row by row. Software tools now simplify large designs, but maps still teach the idea.

How do you work out a Boolean expression?

To work out a Boolean expression, substitute each input’s 1 or 0 and work AND before OR, just like multiplication before addition: with A = 1 and B = 0, A + AB = 1.

Example 1: evaluate an expression

What is F = AB + C′ when A = 1, B = 0 and C = 1?

Given
F = AB + C′, with A = 1, B = 0, C = 1
Find
F
Solution
AB = 1 · 0 = 0, and C′ = 0F = 0 + 0 = 0
Answer
F = 0

Example 2: what a group leaves

In a 3-input Karnaugh map, how many inputs does a group of 4 cells keep in its term?

Given
a 3-input map, 8 cells, and a group of 4
Find
how many inputs the group’s term keeps
Solution
A group of 4 = 22 cells drops 2 inputs3 − 2 = 1
Answer
A term of 1 input

Summary

Key laws

  • (AB)′ = A′ + B′ De Morgan
  • (A + B)′ = A′B′ De Morgan
  • AB + AB′ = A combining
  • A + AB = A absorption

Key terms

Minterm
One true row of the table.
Gray code
Neighbors differ by one bit.
Group
1, 2, 4 or 8 adjacent 1s.
Don’t care
A row that can be either.

Practice problems

  1. What is A + A′?

  2. By De Morgan’s law, what is (A + B)′?

  3. Simplify AB + AB′.

  4. Why does a Karnaugh map use Gray code order?

  5. In a 3-input map, how many inputs does a group of 4 cells keep?

FAQ

What is Boolean algebra used for?

Designing and simplifying digital logic circuits, and writing conditions in code and database searches.

What does the plus sign mean in Boolean algebra?

OR, not addition: 1 + 1 = 1, since true OR true is still true.

How many cells does a Karnaugh map have?

One per row of the truth table: 4 for two inputs, 8 for three and 16 for four. Beyond five or six inputs, software takes over.

What is a don’t care in a Karnaugh map?

A row whose output doesn’t matter, often because that input combination never happens. It can be grouped as a 1 or left out, whichever makes the groups bigger.

What is the difference between SOP and POS?

Sum of products ORs together AND terms, such as AB + C; product of sums ANDs together OR terms, such as (A + B)C. Grouping 1s gives SOP, grouping 0s gives POS.

Who invented Boolean algebra?

George Boole, an English mathematician, in 1854. Claude Shannon applied it to switching circuits in 1937.

Can Karnaugh map groups overlap?

Yes. A 1 may be in several groups if that makes each group bigger, as in the majority function.