- How the logical operators AND, OR and NOT work.
- How to build truth tables with one, two or three inputs.
- How to add intermediate columns so complex expressions become manageable.
- How to use a truth table to solve a simple problem or decision rule.
In Computer Science, many decisions are based on whether something is True or False.
For truth tables, we usually represent:
For example, a variable called DoorOpen could be:
- 1 if the door is open
- 0 if the door is not open
Boolean value
A Boolean value is a value that can only be True or False. In truth tables, these are usually shown as 1 and 0.
An input is a Boolean value that goes into a logic expression or logic gate.
An output is the Boolean result that comes out.
A logical operator is a rule that combines or changes Boolean values. For this topic, you need to apply:
Logical operator
A logical operator is a rule used to work with Boolean values. It takes one or more inputs and produces a Boolean output.
This reference diagram summarises the three operators you need for Edexcel GCSE Computer Science.

NOT takes one input and reverses it.
So:
NOT 0 becomes 1
NOT 1 becomes 0
NOT flips the value
NOT changes 1 to 0, and 0 to 1.
AND takes two inputs. The output is 1 only if both inputs are 1.
A common real-life version is: “You may enter if you have a ticket AND your ticket is valid.” Both conditions must be true.
OR takes two inputs. The output is 1 if at least one input is 1.
Thinking OR means only one
In GCSE logic, OR is inclusive. That means A OR B is also 1 when both A and B are 1.
Applying AND and OR
Complete the outputs for A AND B and A OR B when A = 1 and B = 0.
-
For A AND B, check whether both inputs are 1. Here, A is 1 but B is 0, so the output is 0.
-
For A OR B, check whether at least one input is 1. Here, A is 1, so the output is 1.
-
Compare the two results: AND is stricter than OR because AND needs every input to be true.
A truth table lists every possible combination of input values, then shows the output for each combination.
If there are nnn inputs, the number of rows is 2n2^n2n.
So:
- 1 input gives 2 rows
- 2 inputs gives 4 rows
- 3 inputs gives 8 rows
For Edexcel GCSE 1CP2, you need to handle truth tables with up to three inputs.
Truth table
A truth table is a table that shows the output of a logic expression for every possible combination of its input values.
For two inputs, the usual order is:
For three inputs, count from 000 to 111:
| A | B | C |
|---|
| 0 | 0 | 0 |
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 0 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
| 1 | 1 | 1 |
Use binary counting
For three inputs, think of A B C as a 3-bit binary count from 000 to 111. This helps you avoid missing or repeating a row.
Finding the number of rows
How many rows are needed for a truth table with three inputs: A, B and C?
-
Identify the number of inputs. There are three inputs, so n = 3.
-
Use the truth table row rule: the number of rows is 2n2^n2n.
-
Substitute the number of inputs: 23=82^3 = 823=8, so the table needs 8 input rows.
More difficult questions often combine operators, such as:
(A AND B) OR C
Do not try to do the whole expression in your head. Instead, add an intermediate column for part of the expression.
Intermediate column
An intermediate column is an extra column in a truth table used to calculate part of a logic expression before calculating the final output.
For (A AND B) OR C, a useful intermediate column is:
A AND B
Then the final output column is:
(A AND B) OR C
Completing a three-input truth table
Complete the truth table for (A AND B) OR C.
-
Start with all input combinations for A, B and C. Because there are three inputs, there are 8 rows.
-
Calculate A AND B for each row. This column is 1 only when both A and B are 1.
-
Calculate the final output (A AND B) OR C. This is 1 when either the intermediate result is 1, or C is 1, or both are 1.
| A | B | C | A AND B | (A AND B) OR C |
|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 | 1 |
| 0 | 1 | 0 | 0 | 0 |
| 0 | 1 | 1 | 0 | 1 |
| 1 | 0 | 0 | 0 | 0 |
| 1 | 0 | 1 | 0 | 1 |
| 1 | 1 | 0 | 1 | 1 |
| 1 | 1 | 1 | 1 | 1 |
NOT is often used to mean a condition is not happening.
For example:
NOT Locked
This means the output is 1 when Locked is 0.
In a larger expression, calculate the NOT part first by flipping that column.
Using NOT in a combined expression
Complete the output for:
A AND NOT B
-
Create the input rows for A and B. There are two inputs, so there are 4 rows.
-
Add an intermediate column for NOT B. This flips every value in the B column.
-
Apply AND between A and NOT B. The final output is 1 only when A is 1 and NOT B is also 1.
| A | B | NOT B | A AND NOT B |
|---|
| 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 0 |
| 1 | 0 | 1 | 1 |
| 1 | 1 | 0 | 0 |
A problem may describe a real system in words. Your job is to turn the words into a logic expression, then use a truth table.
Example conditions:
CardValid is 1 if a user has a valid card.
PINCorrect is 1 if the user entered the correct PIN.
AccountLocked is 1 if the account is locked.
A cash machine might allow access only if:
CardValid AND PINCorrect AND NOT AccountLocked
This means all the good conditions must be true, and the bad condition must be false.
Deciding when access is allowed
A system allows access when:
CardValid AND PINCorrect AND NOT AccountLocked
Find the rows where access is allowed.
-
Calculate NOT AccountLocked. This is 1 when AccountLocked is 0, because the account must not be locked.
-
Apply the first AND condition. CardValid AND PINCorrect is 1 only when both the card is valid and the PIN is correct.
-
Apply the final AND with NOT AccountLocked. Access is allowed only when all three required parts are 1.
| CardValid | PINCorrect | AccountLocked | NOT AccountLocked | AccessAllowed |
|---|
| 0 | 0 | 0 | 1 | 0 |
| 0 | 0 | 1 | 0 | 0 |
| 0 | 1 | 0 | 1 | 0 |
| 0 | 1 | 1 | 0 | 0 |
| 1 | 0 | 0 | 1 | 0 |
| 1 | 0 | 1 | 0 | 0 |
| 1 | 1 | 0 | 1 | 1 |
| 1 | 1 | 1 | 0 | 0 |
Only one row gives AccessAllowed = 1: the card is valid, the PIN is correct, and the account is not locked.
When you see a truth table question, slow down and use columns.
- Write the input columns.
- List all possible input combinations.
- Add intermediate columns for smaller parts of the expression.
- Fill each intermediate column using one operator at a time.
- Fill the final output column.
Break expressions into smaller columns
Truth tables become much easier when you do one logical operator at a time. Intermediate columns reduce mistakes.
In the exam
-
For three inputs, make sure you have exactly 8 rows and no repeated input combinations.
-
Treat OR as “at least one is true”, not “only one is true”.
-
If the expression contains several operators, add intermediate columns such as NOT C or A AND B before calculating the final output.
Check yourself
- Why does a truth table with three inputs need 8 rows?
- What is the difference between
A AND B and A OR B when both inputs are 1?
- How would you start a truth table for
A AND (B OR NOT C)?