A and B
- Boolean expression
- A and B
- Canonical sum of products
- A·B
- Minterms (rows that are 1)
- Σm(3)
- Rows that are true
- 1
- Classification
- Contingent
Checked against: Independent calculation
Truth table of a Boolean expression in up to 6 variables, with the canonical sum of products, product of sums, minterms and maxterms.
By AdminDrafted with AI writing toolsUpdated Checked examples: 8
The expression is true in 5 of 8 rows (minterms 0, 2, 4, 6, 7), so its value depends on the inputs.
| Row | A | B | C | F |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 |
| 1 | 0 | 0 | 1 | 0 |
| 2 | 0 | 1 | 0 | 1 |
| 3 | 0 | 1 | 1 | 0 |
| 4 | 1 | 0 | 0 | 1 |
| 5 | 1 | 0 | 1 | 0 |
| 6 | 1 | 1 | 0 | 1 |
| 7 | 1 | 1 | 1 | 1 |
not binds tightest, then and/nand, xor, or/nor, implies (grouped from the right), and iff last.
Each row sets A, B, C to one combination of 0s and 1s, counting in binary with A as the most significant bit; the row number is the minterm index.
One product term for each row where F = 1; a bar means the variable is 0 in that row.
One sum term for each row where F = 0; each term is 0 only in its own row.
A truth table lists the value of a Boolean expression for every combination of its inputs: 2ⁿ rows for n variables, so 8 rows for A, B and C. Each row where the expression is 1 is a minterm, and the OR of those minterms is the canonical sum of products; each row where it is 0 is a maxterm, and the AND of the maxterms is the canonical product of sums. Both describe the same function.
Digital logic and computer science students use it to check circuit designs, simplify conditions and verify logic laws. The default, (A and B) or not C, is true in 5 of 8 rows, minterms 0, 2, 4, 6 and 7, and false in rows 1, 3 and 5.
Up to 6 variables (64 rows) are accepted. Precedence runs not, and/nand, xor, or/nor, implies (grouped from the right), then iff; symbols such as !, &, | and ^ also work. An expression true in every row is a tautology, and one false in every row is a contradiction.
List every combination of the inputs by counting in binary, then evaluate the expression in each row. Two variables give 2² = 4 rows (00, 01, 10, 11), three give 8, and n variables give 2ⁿ. For A and B, only row 11 is true; for A or B, every row except 00 is true.
Evaluate from the innermost parentheses outward. For (A and B) or not C in the row A = 1, B = 1, C = 0, the bracket gives 1 and not C gives 1, so the row is 1.
Each pattern lists the output for the rows AB = 00, 01, 10 and 11, in that order:
The negation not A has the pattern 1100 over the same rows, because it simply flips A.
| Expression | Minterms | Classification |
|---|---|---|
| A and B | Σm(3) | Contingent |
| A xor B | Σm(1, 2) | Contingent |
| A implies B | Σm(0, 1, 3) | Contingent |
| A or not A | Σm(0, 1) | Tautology |
| A and not A | Σm() | Contradiction |
| (A and B) or not C | Σm(0, 2, 4, 6, 7) | Contingent |
A minterm number is the row read as a binary number, with the first variable as the most significant bit. (A and B) or not C is true in rows 0 (000), 2 (010), 4 (100) and 6 (110), where C is 0, and in row 7 (111), where A and B are both 1.
Without parentheses, not binds first, then and/nand, then xor, then or/nor, then implies, and iff last. So A or B and C means A or (B and C), true in rows 3 to 7: Σm(3, 4, 5, 6, 7). (A or B) and C is true only in rows 3, 5 and 7.
Implication groups from the right: A → B → C means A → (B → C), which is false only in row 6 (110). (A → B) → C is a different function, false in rows 0, 2 and 6.
Textbooks and programming languages do not all rank these operators the same way. Add parentheses whenever you copy a formula from another source.
A → B is false only when A is true and B is false. With a false premise it is true whatever B is, which can surprise readers used to the everyday "if … then". Discrete Mathematics: An Open Introduction explains why logic uses this convention.
Implication has the same truth table as not A or B, and as its contrapositive, not B → not A.
A tautology is true in every row, as A or not A is. A contradiction is false in every row, as A and not A is. An expression true in some rows and false in others is contingent.
To test whether two expressions are equivalent, join them with iff: the result is a tautology exactly when they agree in every row. De Morgan's law passes this test, because not (A and B) iff (not A or not B) is a tautology.
A minterm is a row where the output is 1. The canonical sum of products (SOP) ORs one AND-term per minterm, with each variable plain where its value is 1 and primed (negated) where it is 0. For A xor B, the SOP is A'·B + A·B'.
A maxterm is a row where the output is 0. The canonical product of sums (POS) ANDs one OR-term per maxterm, with each variable plain where its value is 0 and primed where it is 1. For A xor B, the POS is (A + B)·(A' + B').
Canonical forms list every row, so they are usually longer than a simplified expression: A or not A is a tautology, yet its SOP is A' + A. See canonical normal form for the naming of minterms and maxterms.
!, ~, ¬ or a trailing ' for not; & or · for and; | or + for or; ^ or ⊕ for xor; -> for implies; and <-> for iff.To apply the same logic to lists of items, use the set operations calculator, where union matches or and intersection matches and. For and, or and xor on the bits of whole numbers, use the bitwise calculator.
Checked against: Independent calculation
Checked against: Independent calculation
Checked against: Independent calculation
Checked against: Law of excluded middle
List every combination of the inputs by counting in binary: 2 variables give 4 rows, 3 give 8, and 6 give 64. Then evaluate the expression in each row, working from the innermost operation outward. For (A and B) or not C, the row A = 1, B = 1, C = 1 gives (1 and 1) or 0 = 1, while A = 0, B = 0, C = 1 gives 0 or 0 = 0.
A minterm is an AND of every variable, each plain or negated, that is 1 in exactly one row; a maxterm is an OR of every variable that is 0 in exactly one row. Row numbers index them: for A, B and C, minterm 6 is A·B·C′ and maxterm 1 is (A + B + C′). A function is the OR of its minterms and, equally, the AND of its maxterms.
A sum of products (SOP) ORs together AND terms, one for each row where the function is 1; a product of sums (POS) ANDs together OR terms, one for each row where it is 0. A xor B is A′·B + A·B′ as a sum of products and (A + B)·(A′ + B′) as a product of sums. Both are complete; the shorter one is whichever has fewer rows to cover.
An expression that is true in every row of its truth table, whatever the inputs. A or not A, the law of excluded middle, is the simplest; (A → B) or (B → A) is another. The opposite, false in every row, is a contradiction, such as A and not A, and anything true in some rows but not others is called contingent.
A → B is false only when A is true and B is false; in the other three rows it is true. Its truth table therefore has minterms 0, 1 and 3 and a single maxterm, 2, and it is equivalent to not A or B and to its contrapositive, not B → not A. A chain such as A → B → C groups from the right, as A → (B → C).
This calculator includes 8 worked examples with independently sourced answers. They run in the test suite, and you can run them here too.