Skip to main content

Truth Table Generator

Calculate truth table instantly with our math tool. Shows detailed work, formulas used, and multiple solution methods. Get results you can export or share.

Share this calculator

Formula

F = Sum of Minterms (SOP) = Product of Maxterms (POS)

A truth table lists all possible input combinations and their corresponding outputs. Minterms are product terms for rows where output is 1, forming the Sum of Products. Maxterms are sum terms for rows where output is 0, forming the Product of Sums. Both canonical forms completely represent the same function.

Worked Examples

Example 1: 3-Variable AND-OR Expression

Problem: Generate the truth table for F = A AND B OR C

Solution: Evaluate for all 8 input combinations (AND before OR):\n000: 0 AND 0 OR 0 = 0 OR 0 = 0\n001: 0 AND 0 OR 1 = 0 OR 1 = 1\n010: 0 AND 1 OR 0 = 0 OR 0 = 0\n011: 0 AND 1 OR 1 = 0 OR 1 = 1\n100: 1 AND 0 OR 0 = 0 OR 0 = 0\n101: 1 AND 0 OR 1 = 0 OR 1 = 1\n110: 1 AND 1 OR 0 = 1 OR 0 = 1\n111: 1 AND 1 OR 1 = 1 OR 1 = 1

Result: F = Sum(1,3,5,6,7) | 5 minterms, 3 maxterms | SOP = A'B'C + A'BC + AB'C + ABC' + ABC

Example 2: 2-Variable XOR Function

Problem: Generate the truth table for F = A XOR B and identify its properties.

Solution: XOR outputs 1 when inputs differ:\n00: 0 XOR 0 = 0\n01: 0 XOR 1 = 1\n10: 1 XOR 0 = 1\n11: 1 XOR 1 = 0\n\nMinterms: m1, m3\nMaxterms: M0, M2\nSOP: A'B + AB'\nPOS: (A+B)(A'+B')

Result: F = A XOR B | Minterms: {1,3} | Neither tautology nor contradiction | Satisfiable

Frequently Asked Questions

What is a truth table and why is it important in digital logic?

A truth table is a mathematical table that lists all possible combinations of input values for a Boolean function along with the corresponding output values. For a function with n input variables, the truth table has 2^n rows, covering every possible binary input combination. Truth tables are fundamental to digital logic because they provide a complete, unambiguous specification of a Boolean function. They serve as the starting point for circuit design, allowing engineers to verify that their implementations match the desired behavior. Truth tables are also used to prove logical equivalences, identify tautologies (always true) and contradictions (always false), and derive canonical forms like Sum of Products (SOP) and Product of Sums (POS). Every digital circuit, from simple gates to complex processors, can be fully described by its truth table, making it the most basic and universal representation of digital logic.

How do you read and construct a truth table from a Boolean expression?

To construct a truth table, first identify all input variables in the Boolean expression and determine the number of rows needed (2^n for n variables). List all binary combinations of the input variables in order from 0 to 2^n-1, with each variable getting its own column. Then add an output column and evaluate the expression for each input combination. Follow operator precedence: NOT is evaluated first, then AND, then XOR, then OR. Use parentheses to override precedence when needed. For example, for F = A AND B OR C with 3 variables, you need 8 rows. For the input combination A=1, B=0, C=1: first compute A AND B = 0, then 0 OR C = 1, so the output is 1. Reading a truth table is straightforward: find the row matching your input values and read the output. Rows where the output is 1 are called minterms, and rows where the output is 0 are called maxterms.

What are minterms and maxterms and how are they derived from truth tables?

Minterms and maxterms are canonical product and sum terms derived directly from truth table rows. A minterm is a product (AND) term where each variable appears exactly once, either in true or complemented form, corresponding to a row where the output is 1. For example, if A=1, B=0, C=1 gives output 1, the minterm is AB'C. A maxterm is a sum (OR) term corresponding to a row where the output is 0, with the complementing rule reversed: variables with value 1 are complemented, variables with value 0 are in true form. For the same example with output 0, the maxterm would be (A'+B+C'). The canonical Sum of Products (SOP) is the OR of all minterms, and the canonical Product of Sums (POS) is the AND of all maxterms. Both forms completely represent the same function. Minterm/maxterm notation uses indices: minterm m5 means the binary pattern 101, and maxterm M5 means the same pattern but with complemented variables.

How does the number of variables affect truth table size and complexity?

The number of variables has an exponential effect on truth table size: each additional variable doubles the number of rows. A 1-variable function has 2 rows, 2 variables give 4 rows, 3 give 8, 4 give 16, 5 give 32, and so on. With 10 variables, the truth table would have 1,024 rows, and with 20 variables, over one million rows. This exponential growth is why truth tables become impractical for large functions and why engineers use other representations like Boolean expressions, Karnaugh maps, or binary decision diagrams (BDDs) for functions with many variables. The number of possible Boolean functions also grows double-exponentially: for n variables, there are 2^(2^n) distinct functions. With 2 variables, there are 16 possible functions. With 3 variables, there are 256. With 4 variables, there are 65,536 possible distinct Boolean functions. This combinatorial explosion motivates the use of algebraic simplification techniques rather than exhaustive enumeration.

How are truth tables used in hardware verification and testing?

Truth tables play a central role in hardware verification, serving as the golden reference for circuit correctness. In design verification, engineers compare the truth table of their implemented circuit against the specification truth table. If all outputs match for all input combinations, the implementation is correct. For small circuits (up to about 20 inputs), exhaustive simulation checks every truth table row. For larger circuits, formal verification tools use mathematical techniques like BDD (Binary Decision Diagram) comparison to prove equivalence without explicit enumeration. In manufacturing testing, truth tables generate test vectors: specific input patterns applied to fabricated chips to detect manufacturing defects. Automatic Test Pattern Generation (ATPG) algorithms use truth table analysis to find the minimum set of test vectors that achieve high fault coverage. Built-In Self-Test (BIST) circuits generate pseudo-random truth table entries to test logic blocks within a chip during operation, ensuring ongoing reliability.

What is the relationship between truth tables and logic circuit implementation?

Truth tables provide a direct path to circuit implementation through a systematic process. First, the truth table defines the function completely. Second, minterms (rows with output 1) are identified and written as product terms, forming the canonical SOP expression. Third, this expression is minimized using Karnaugh maps or Quine-McCluskey to reduce the number of gates needed. Fourth, the minimized expression maps directly to a two-level AND-OR circuit: each product term becomes an AND gate, and the sum becomes an OR gate. In CMOS technology, this naturally converts to a NAND-NAND implementation. For programmable logic devices like PALs and PLAs, the truth table directly programs the AND-OR arrays. For FPGAs, the truth table is stored in lookup tables (LUTs), where the input combination serves as an address and the output value is stored at that address. ROMs (Read-Only Memories) can also implement truth tables directly, with each input combination addressing a memory location containing the output value.

References