Welcome to the World of Logic!

In this chapter, we are going to explore Truth Tables. Don’t let the name intimidate you! Think of a truth table as a simple "logic map." It helps us see every possible outcome of a decision a computer might make. Computers are incredibly fast, but they aren't actually "smart" in the way humans are—they just follow very strict rules. Truth tables are how we visualize those rules.

By the end of these notes, you’ll be able to handle logic problems with up to three different inputs like a pro. Let’s dive in!

The Basics: Boolean Values

Before we look at the tables, we need to understand the "language" they use. In Computer Science, we use Boolean logic. This means everything is either:

  • True (often shown as the number 1)
  • False (often shown as the number 0)

There is no "maybe" in Boolean logic! It’s one or the other, just like a light switch is either ON or OFF.

The Three Logic Gates

To build a truth table, we use three main "operators" (think of these as the rules for the decision). These are NOT, AND, and OR.

1. The NOT Operator (The Oppositer)

The NOT operator is the simplest one. It simply flips whatever input you give it. If the input is True, the output is False. If the input is False, the output is True.

Analogy: Think of a "Reverse Psychology" button. Whatever you tell it, it does the opposite!

The NOT Truth Table:

Input (A) = 0 | Output = 1
Input (A) = 1 | Output = 0

2. The AND Operator (The Strict One)

The AND operator is very picky. For the output to be True, ALL inputs must be True. If even one input is False, the whole thing becomes False.

Analogy: To get a student discount at the cinema, you must have a student ID AND it must be a weekday. If you forget your ID, no discount. If it’s Saturday, no discount. You need BOTH.

Quick Review: In an AND table, you only get a 1 if every input is a 1.

3. The OR Operator (The Flexible One)

The OR operator is much more relaxed. For the output to be True, AT LEAST ONE input must be True. It doesn't matter if it's just the first one, just the second one, or both!

Analogy: To enter a club, you can show a Passport OR a Driver’s License. As long as you have at least one of them, you’re getting in!

Key Takeaway: AND needs all 1s to result in a 1. OR only needs a single 1 to result in a 1.

Building Truth Tables with Two Inputs

When we have two inputs (let’s call them A and B), there are four possible combinations of True and False. Don't worry if this seems tricky; there is a simple pattern to follow!

Step-by-step to list inputs:
1. For the first column (A), write two 0s then two 1s.
2. For the second column (B), alternate: 0, 1, 0, 1.

Example: A AND B
A | B | Output
0 | 0 | 0
0 | 1 | 0
1 | 0 | 0
1 | 1 | 1 (Only this row is True because both A and B are 1!)

Leveling Up: Three Input Truth Tables

According to your Pearson Edexcel syllabus, you need to be able to handle up to three inputs (A, B, and C). With three inputs, the number of possible combinations jumps to 8.

How do we know there are 8 rows?

There is a simple mathematical formula: \( 2^n \), where \( n \) is the number of inputs.
So, for 3 inputs, it is \( 2^3 \), which is \( 2 \times 2 \times 2 = 8 \).

The Secret Trick to Filling the Inputs:

To make sure you don't miss any combinations, follow this pattern for your columns:

  • Column A: Four 0s, then four 1s.
  • Column B: Two 0s, two 1s, two 0s, two 1s.
  • Column C: 0, 1, 0, 1, 0, 1, 0, 1.

Did you know? This pattern is actually just counting from 0 to 7 in binary! 000, 001, 010, 011, 100, 101, 110, 111.

Solving a Three-Input Problem

Let's try to solve: (A AND B) OR C

When solving a complex logic problem, always solve the part in the brackets first!

  1. Create a column for (A AND B). It will only be 1 if both A and B are 1.
  2. Create your final column. Look at your new (A AND B) column and the C column. If either of them has a 1, the output is 1 (because we are using OR).
Key Takeaway: Treat logic expressions like math equations. Solve the brackets first, then move outward!

Common Mistakes to Avoid

  • Mixing up AND and OR: Remember, AND is the "strict" one (needs all 1s). OR is the "friendly" one (only needs one 1).
  • Forgetting a row: Always check you have 8 rows for a 3-input table.
  • Flipping the NOT: Beginners often forget that NOT applies to the result of the bracket if it's written outside, like NOT (A AND B). Solve the bracket first, then flip every bit at the very end!

Quick Review Box

NOT: Flips the bit (0 becomes 1, 1 becomes 0).
AND: Output is 1 only if everyone is 1.
OR: Output is 1 if at least one person is 1.
Rows: 2 inputs = 4 rows. 3 inputs = 8 rows.

Congratulations! You've just mastered the logic that powers every computer on the planet. Keep practicing those 8-row tables, and you'll find them easier every time!