Quick Summary
- Truth tables display all possible input-output combinations for logic operations
- Uses binary notation: 1 (True/High) and 0 (False/Low)
- Essential for designing digital circuits and computer processors
- Shows exactly how logic gates (AND, OR, NOT, NAND, NOR, XOR) behave
- Number of rows = 2n where n is the number of inputs
Understanding Truth Tables
Truth tables are the foundation of digital electronics and computer logic. Every calculation your phone or computer makes starts with simple logic operations shown in truth tables. These tables help engineers design circuits and programmers understand how computers make decisions.
Think of a truth table like a recipe book. Just as a recipe shows you what ingredients go in and what dish comes out, a truth table shows what inputs go into a logic gate and what output comes out. The difference is that logic gates only work with two values: 1 (yes/true/on) and 0 (no/false/off).
How Truth Tables Work
Truth tables follow a simple structure. The left columns show all possible input combinations. The right column shows the output for each combination. For a single input, you have 2 possibilities (0 or 1). For two inputs, you have 4 possibilities (00, 01, 10, 11). For three inputs, you have 8 possibilities, and so on.
The formula is: Number of rows = 2n where n equals the number of inputs. This means a logic gate with 3 inputs needs a truth table with 8 rows to show every possible combination.
Truth Tables for Basic Logic Gates
| Gate Type | Description | Output is 1 when… |
|---|---|---|
| AND | Gives 1 only when ALL inputs are 1 | Both A AND B are 1 |
| OR | Gives 1 when ANY input is 1 | Either A OR B (or both) is 1 |
| NOT | Reverses the input | Input is 0 (opposite of input) |
| NAND | Opposite of AND | At least one input is 0 |
| NOR | Opposite of OR | Both inputs are 0 |
| XOR | Exclusive OR | Inputs are different |
AND Gate Truth Table Example
The AND gate is like a security system that needs two keys to open. Both inputs must be 1 for the output to be 1.
| Input A | Input B | Output (A AND B) |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
OR Gate Truth Table Example
The OR gate is like a light switch with two buttons. If either button is pressed, the light turns on.
| Input A | Input B | Output (A OR B) |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
NOT Gate Truth Table Example
The NOT gate is the simplest. It just reverses whatever comes in. 0 becomes 1, and 1 becomes 0.
| Input A | Output (NOT A) |
|---|---|
| 0 | 1 |
| 1 | 0 |
Real-World Applications
Truth tables are not just theory. They have practical uses in everyday technology:
Computer Processors: Every calculation your computer does uses millions of logic gates. Engineers use truth tables to design the circuits that power your laptop or phone.
Security Systems: Door locks that need both a card AND a PIN code use AND gate logic. The door only opens when both conditions are true.
Traffic Lights: Traffic control systems use logic gates to decide when lights should change. Truth tables help program these systems safely.
Phone Networks: When you make a call, truth tables help route your signal through the network to reach the right person.
How to Construct a Truth Table
Follow these steps to build any truth table:
- Count the inputs: Identify how many variables (A, B, C, etc.) you have
- Calculate rows needed: Use 2n formula. For 2 inputs, you need 4 rows
- List all combinations: Start with all 0s, then count up in binary (00, 01, 10, 11)
- Apply the logic rule: For each row, determine the output based on the gate type
- Fill in outputs: Complete the output column using the logic operation
Example: Building a NAND Gate Truth Table
NAND means “NOT AND.” First, work out the AND result, then reverse it.
| Input A | Input B | A AND B | Output (NAND) |
|---|---|---|---|
| 0 | 0 | 0 | 1 |
| 0 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 |
| 1 | 1 | 1 | 0 |
Common Exam Mistakes
WAEC examiners report these common errors:
1. Wrong number of rows: Students forget the 2n formula. A 3-input gate needs 8 rows, not 6 or 9.
2. Missing input combinations: Some students skip combinations like 01 or 10. You must list ALL possibilities.
3. Confusing AND with OR: Remember: AND needs ALL inputs to be 1. OR needs just ONE input to be 1.
4. Wrong NAND/NOR outputs: Students forget to reverse the result. NAND is opposite of AND. If AND gives 1, NAND gives 0.
5. Poor table format: Draw clear lines and label columns. Examiners mark down messy tables.
6. Not showing working: When asked to “construct” a truth table, show all steps. Don’t just write the final answer.
Practice Questions
Multiple Choice Questions
1. How many rows are needed in a truth table for a logic gate with 4 inputs?
a) 4 rows
b) 8 rows
c) 16 rows ✓
d) 32 rows
Explanation: Use 2n = 24 = 16 rows
2. In an AND gate truth table with inputs A and B, when is the output 1?
a) When A = 0 and B = 0
b) When A = 1 or B = 1
c) When A = 1 and B = 1 ✓
d) When A ≠ B
Explanation: AND gate only outputs 1 when ALL inputs are 1
3. What is the output of a NOT gate when the input is 0?
a) 0
b) 1 ✓
c) 2
d) Undefined
Explanation: NOT gate reverses the input
4. Which logic gate outputs 0 only when both inputs are 1?
a) AND gate
b) OR gate
c) NAND gate ✓
d) NOR gate
Explanation: NAND is opposite of AND
Essay/Theory Questions
1. Construct a complete truth table for a 2-input OR gate. (6 marks)
Answer should include:
- Proper table with labeled columns (2 marks)
- All 4 input combinations (2 marks)
- Correct outputs for each row (2 marks)
2. Explain the difference between AND and NAND gates using truth tables. (8 marks)
Tips for full marks:
- Define both gates (2 marks)
- Draw truth table for AND (3 marks)
- Draw truth table for NAND (3 marks)
- State that NAND outputs are opposite of AND
3. A burglar alarm system uses an AND gate. It only sounds when both the door sensor AND the window sensor detect intrusion. Construct the truth table for this system. Label inputs as D (door) and W (window). (8 marks)
Mark allocation:
- Proper table structure with labels (2 marks)
- Four input combinations (2 marks)
- Correct outputs (3 marks)
- Brief explanation of how it works (1 mark)
Memory Aids
Remember gate behavior with these tricks:
AND gate: “ALL must agree” – Both inputs must be 1
OR gate: “Only ONE needed” – At least one input must be 1
NOT gate: “NO means opposite” – Flips the input
NAND gate: “Not ALL needed” – Output is 0 only when both are 1
NOR gate: “None OR nothing” – Output is 1 only when both are 0
XOR gate: “eXclusively different” – Inputs must be different
Row formula: “Two to the power of N” (2n)
Related Topics
- Logic Gates – Learn how electronic circuits implement these truth tables
- Boolean Algebra – Mathematical system behind truth tables
- Basic Rules of Boolean Algebra – Simplify complex logic expressions
- Laws of Boolean Algebra – Use algebraic laws to solve logic problems