x

Revision notes for Edexcel GCSE Computer Science Applying logical operators in truth tables. Open the guide for explanations and worked examples. Written against the Edexcel GCSE Computer Science (1CP2) specification, so the content matches what's examinable rather than general Computer Science background.

Applying logical operators in truth tables

What you'll learn

  • 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.

The basic idea: logic uses True and False

In Computer Science, many decisions are based on whether something is True or False.

For truth tables, we usually represent:

  • True as 1
  • False as 0

For example, a variable called DoorOpen could be:

  • 1 if the door is open
  • 0 if the door is not open
Definition

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.

Inputs, outputs and logical operators

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:

  • NOT
  • AND
  • OR
Definition

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.

Truth tables and gate symbols for NOT, AND and OR

NOT: reversing a value

NOT takes one input and reverses it.

ANOT A
01
10

So:

  • NOT 0 becomes 1
  • NOT 1 becomes 0
Key Idea

NOT flips the value

NOT changes 1 to 0, and 0 to 1.

AND: both must be true

AND takes two inputs. The output is 1 only if both inputs are 1.

ABA AND B
000
010
100
111

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: at least one must be true

OR takes two inputs. The output is 1 if at least one input is 1.

ABA OR B
000
011
101
111
Common Mistake

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.

Example

Applying AND and OR

Complete the outputs for A AND B and A OR B when A = 1 and B = 0.

  1. For A AND B, check whether both inputs are 1. Here, A is 1 but B is 0, so the output is 0.

  2. For A OR B, check whether at least one input is 1. Here, A is 1, so the output is 1.

  3. Compare the two results: AND is stricter than OR because AND needs every input to be true.

ABA AND BA OR B
1001

What a truth table does

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.

Definition

Truth table

A truth table is a table that shows the output of a logic expression for every possible combination of its input values.

Listing input combinations systematically

For two inputs, the usual order is:

AB
00
01
10
11

For three inputs, count from 000 to 111:

ABC
000
001
010
011
100
101
110
111
Tip

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.

Example

Finding the number of rows

How many rows are needed for a truth table with three inputs: A, B and C?

  1. Identify the number of inputs. There are three inputs, so n = 3.

  2. Use the truth table row rule: the number of rows is 2n2^n2n.

  3. Substitute the number of inputs: 23=82^3 = 823=8, so the table needs 8 input rows.

Building a truth table for a combined expression

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.

Definition

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

Example

Completing a three-input truth table

Complete the truth table for (A AND B) OR C.

  1. Start with all input combinations for A, B and C. Because there are three inputs, there are 8 rows.

  2. Calculate A AND B for each row. This column is 1 only when both A and B are 1.

  3. 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.

ABCA AND B(A AND B) OR C
00000
00101
01000
01101
10000
10101
11011
11111

Using NOT inside a larger expression

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.

Example

Using NOT in a combined expression

Complete the output for:

A AND NOT B

  1. Create the input rows for A and B. There are two inputs, so there are 4 rows.

  2. Add an intermediate column for NOT B. This flips every value in the B column.

  3. Apply AND between A and NOT B. The final output is 1 only when A is 1 and NOT B is also 1.

ABNOT BA AND NOT B
0010
0100
1011
1100

Solving problems using truth tables

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.

Example

Deciding when access is allowed

A system allows access when:

CardValid AND PINCorrect AND NOT AccountLocked

Find the rows where access is allowed.

  1. Calculate NOT AccountLocked. This is 1 when AccountLocked is 0, because the account must not be locked.

  2. Apply the first AND condition. CardValid AND PINCorrect is 1 only when both the card is valid and the PIN is correct.

  3. Apply the final AND with NOT AccountLocked. Access is allowed only when all three required parts are 1.

CardValidPINCorrectAccountLockedNOT AccountLockedAccessAllowed
00010
00100
01010
01100
10010
10100
11011
11100

Only one row gives AccessAllowed = 1: the card is valid, the PIN is correct, and the account is not locked.

A reliable method for any GCSE truth table

When you see a truth table question, slow down and use columns.

  1. Write the input columns.
  2. List all possible input combinations.
  3. Add intermediate columns for smaller parts of the expression.
  4. Fill each intermediate column using one operator at a time.
  5. Fill the final output column.
Key Idea

Break expressions into smaller columns

Truth tables become much easier when you do one logical operator at a time. Intermediate columns reduce mistakes.

Exam technique

In the exam

  1. For three inputs, make sure you have exactly 8 rows and no repeated input combinations.

  2. Treat OR as “at least one is true”, not “only one is true”.

  3. If the expression contains several operators, add intermediate columns such as NOT C or A AND B before calculating the final output.

Self review

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)?
You've reached the end

Test yourself on this topic, or move on to the next guide.

FlashcardsSelf-test with active recall
Binary representation and number of statesUp next

How was this guide?

Applying logical operators in truth tables Revision Guide

  1. GCSE
  2. /Computer Science
  3. /Applying logical operators in truth tables