In the study of computer aptitude and logic design, understanding how logical statements behave is crucial. A truth table is a simple yet powerful tool that lists all possible combinations of truth values for logical variables and shows the resulting output of a logical expression for each combination.
Truth tables help us visualize and analyze logical expressions systematically. They are widely used in competitive exams, digital circuit design, and Boolean algebra to verify the correctness of logical statements, simplify expressions, and design circuits.
Think of a truth table as a complete map that shows every possible scenario for the inputs and the corresponding output. This ensures no case is overlooked, which is essential for accuracy in logic problems.
Before constructing truth tables, we need to understand the building blocks: logical variables and their truth values.
A logical variable is a symbol (like A, B, C) that can take one of two possible values:
This binary nature (only two possible values) makes logical variables ideal for representing conditions in computer science and digital electronics.
| A | Truth Value |
|---|---|
| False | 0 |
| True | 1 |
By combining these variables with logical operators, we can form expressions whose truth values depend on the inputs. Truth tables systematically list all combinations of these input values to evaluate the expression.
Logical operators combine or modify logical variables to form expressions. The three fundamental operators are AND, OR, and NOT. Let's understand each and see how their truth tables are constructed.
The AND operator outputs true only if both inputs are true. Otherwise, it outputs false.
The OR operator outputs true if at least one input is true. It outputs false only if both inputs are false.
The NOT operator is a unary operator that inverts the truth value of a single variable: true becomes false, and false becomes true.
| AND (A · B) | OR (A + B) | NOT (¬A) | |||||||
|---|---|---|---|---|---|---|---|---|---|
| A | B | Output | A | B | Output | A | Output | ||
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | ||
| 0 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | ||
| 1 | 0 | 0 | 1 | 0 | 1 | ||||
| 1 | 1 | 1 | 1 | 1 | 1 | ||||
Note: For the NOT operator, only one input variable is needed, so the table shows A and its complement.
Beyond the basic operators, there are several derived operators important in logic design and computer science. These include NAND, NOR, XOR, and XNOR. Each has unique behavior and applications.
| A | B | NAND | NOR | XOR | XNOR |
|---|---|---|---|---|---|
| 0 | 0 | 1 | 1 | 0 | 1 |
| 0 | 1 | 1 | 0 | 1 | 0 |
| 1 | 0 | 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 0 | 0 | 1 |
These operators are essential in designing complex logic circuits and are frequently tested in competitive exams.
Let's apply what we've learned to build a truth table for a compound logical expression:
Expression: \( (A \cdot B) + \overline{C} \)
Step 1: Identify the variables involved: A, B, and C. Since there are 3 variables, the truth table will have \(2^3 = 8\) rows to cover all input combinations.
| A | B | C | A · B | ¬C | (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 |
Explanation:
This stepwise approach ensures clarity and accuracy.
Logical equivalence means two expressions always have the same truth value for all input combinations. Let's verify if the following expressions are equivalent:
Expression 1: \( (A + B) \cdot (A + C) \)
Expression 2: \( A + (B \cdot C) \)
Step 1: List all possible combinations of A, B, and C (8 rows).
| A | B | C | A + B | A + C | (A + B) · (A + C) | B · C | A + (B · C) |
|---|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
| 1 | 0 | 0 | 1 | 1 | 1 | 0 | 1 |
| 1 | 0 | 1 | 1 | 1 | 1 | 0 | 1 |
| 1 | 1 | 0 | 1 | 1 | 1 | 0 | 1 |
| 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
Step 2: Compare the columns for \( (A + B) \cdot (A + C) \) and \( A + (B \cdot C) \). Since their outputs match for all rows, the expressions are logically equivalent.
The XOR (Exclusive OR) operator is unique because it outputs true only when the inputs differ. This is useful in error detection and digital circuits.
| A | B | A ⊕ B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
Example: If A = "Is it raining?" and B = "Is it cloudy?", XOR outputs true only when exactly one of these is true, representing an exclusive condition.
Truth tables can help simplify complex Boolean expressions by identifying when outputs are true or false and finding simpler equivalent expressions.
Example: Given the expression \( F = A \cdot B + A \cdot \overline{B} \), construct its truth table and simplify.
| A | B | \(\overline{B}\) | \(A \cdot B\) | \(A \cdot \overline{B}\) | F |
|---|---|---|---|---|---|
| 0 | 0 | 1 | 0 | 0 | 0 |
| 0 | 1 | 0 | 0 | 0 | 0 |
| 1 | 0 | 1 | 0 | 1 | 1 |
| 1 | 1 | 0 | 1 | 0 | 1 |
Observation: The output F is 1 whenever A is 1, regardless of B's value. Hence, the expression simplifies to:
\( F = A \)
Truth tables are the starting point for designing logic circuits. By analyzing the output column, we can determine which logical operations and gates are needed.
Example: Given the truth table below, design the corresponding logic circuit.
| A | B | Output (F) |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
Step 1: Identify when output is 1 (rows 2 and 3).
Step 2: Write the expression for these rows:
Step 3: Combine using OR:
\( F = \overline{A} \cdot B + A \cdot \overline{B} \)
This is the XOR function, so the circuit can be implemented using an XOR gate.
Step 1: Identify variables: A, B, C. Number of rows = \(2^3 = 8\).
Step 2: List all input combinations of A, B, and C.
Step 3: Calculate \(A \cdot B\) for each row.
Step 4: Calculate \(\overline{C}\) (NOT C) for each row.
Step 5: Calculate final output by OR-ing \(A \cdot B\) and \(\overline{C}\).
Answer: The completed truth table is:
| A | B | C | A · B | ¬C | (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 |
Step 1: List all possible values of A, B, and C (8 rows).
Step 2: Compute \(A + B\) and \(A + C\) for each row.
Step 3: Calculate \( (A + B) \cdot (A + C) \) by AND-ing the previous results.
Step 4: Calculate \(B \cdot C\), then \(A + (B \cdot C)\).
Step 5: Compare the outputs of both expressions for all rows.
Answer: Since outputs match for all input combinations, the expressions are logically equivalent.
Step 1: List all input combinations of A and B (4 rows).
Step 2: For each row, output 1 if inputs differ, else 0.
Answer:
| A | B | A ⊕ B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
Step 1: List all combinations of A and B (4 rows).
Step 2: Calculate \(\overline{B}\) for each row.
Step 3: Calculate \(A \cdot B\) and \(A \cdot \overline{B}\).
Step 4: Calculate \(F = A \cdot B + A \cdot \overline{B}\).
Step 5: Observe that F is 1 whenever A is 1, so \(F = A\).
Answer: The simplified expression is \( F = A \).
| A | B | F |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
Step 1: Identify rows where output F = 1 (rows 2 and 3).
Step 2: Write expressions for these rows:
Step 3: Combine using OR:
\( F = \overline{A} \cdot B + A \cdot \overline{B} \)
Step 4: Recognize this as the XOR function.
Answer: The logic circuit is an XOR gate with inputs A and B.
When to use: When constructing truth tables for multiple variables to avoid missing cases.
When to use: While interpreting or constructing truth tables for compound expressions.
When to use: During quick evaluations or multiple-choice questions in exams.
When to use: When verifying if two expressions are equivalent.
When to use: To confirm correctness of simplifications.
Progress tracking is paywalled — subscribe to mark subtopics as understood and save your streak.
Go to practice →