Truth Table: A complete guide to logic expressions
1. Logic gates and their basic truth tables
Logic gates are the building blocks of digital systems. Each gate performs a specific logical operation on one or more input signals and produces a single output. A truth table is the simplest way to define how a gate behaves. Below are the most common gates:
| Gate | Input A | Input B | Output (Y) | Description |
|---|---|---|---|---|
| AND | 0 | 0 | 0 | Y = A · B (output is 1 only if both inputs are 1) |
| AND | 0 | 1 | 0 | |
| AND | 1 | 0 | 0 | |
| AND | 1 | 1 | 1 | |
| OR | 0 | 0 | 0 | Y = A + B (output is 1 if at least one input is 1) |
| OR | 0 | 1 | 1 | |
| OR | 1 | 0 | 1 | |
| OR | 1 | 1 | 1 |
2. Constructing truth tables for complex expressions
When an expression involves multiple gates, we build the truth table step by step. For example, consider the Boolean expression: Y = (A AND B) OR (NOT C). This means Y = (A · B) + C'. To fill the table, list all combinations of A, B, C (8 rows), then compute intermediate values.
| A | B | C | A·B | C' (NOT C) | Y = (A·B) + C' |
|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 | 1 |
| 0 | 0 | 1 | 0 | 0 | 0 |
| 0 | 1 | 0 | 0 | 1 | 1 |
| 0 | 1 | 1 | 0 | 0 | 0 |
| 1 | 0 | 0 | 0 | 1 | 1 |
| 1 | 0 | 1 | 0 | 0 | 0 |
| 1 | 1 | 0 | 1 | 1 | 1 |
| 1 | 1 | 1 | 1 | 0 | 1 |
3. Everyday applications: How we use truth tables
Truth tables aren't just abstract math—they appear in everyday technology. For instance, consider a home alarm system. The alarm (Y) should ring if the door sensor (D) is opened AND the system is armed (A), OR if motion is detected (M) AND it is nighttime (N). The expression is Y = (D · A) + (M · N). A truth table helps engineers verify that the alarm behaves correctly for all eight combinations of (D, A, M, N). Another common example is a voting machine for three people: the output is 1 if at least two vote yes. This is called a majority circuit.
4. Important questions about truth tables
❓ Question 1: How many rows does a truth table need?
If you have n input variables, the truth table always has 2^n rows. For example, 2 inputs → 4 rows, 3 inputs → 8 rows, 4 inputs → 16 rows. This covers every possible combination of zeros and ones.
❓ Question 2: What is the difference between a truth table and a logic gate?
A logic gate is a physical or theoretical electronic component that performs a basic Boolean function (like AND, OR). A truth table is a written description that specifies exactly what output the gate (or a combination of gates) produces for each set of inputs. So the truth table is the “specification sheet” of a logic circuit.
❓ Question 3: Can we design a circuit from a truth table?
Absolutely! This is called “synthesis.” From the truth table, we can write a Boolean expression (sum-of-products form) and then draw the corresponding logic gates. For example, if the output is 1 for rows 2 and 3, we write those minterms and combine them with an OR gate. This is how digital circuits are designed.
Conclusion
Footnote
In this article, we used the following abbreviations and terms:
- AND: A basic logic gate where the output is 1 only if all inputs are 1. Boolean symbol: · or ∧.
- OR: A basic logic gate where the output is 1 if at least one input is 1. Boolean symbol: + or ∨.
- NOT: An inverter; output is the opposite of the input. Boolean symbol: ¬, ~, or an overline.
- XOR: Exclusive OR. Output is 1 when inputs are different. Expression: A ⊕ B = (A · B') + (A' · B).
- NAND: NOT AND. Output is opposite of AND. Universal gate.
