GCSE · Computer Science · AQA · Spec 8525

Boolean expressions

A café sign says: 'Free biscuit with a coffee OR a cake.' You buy both. Biscuit or no biscuit? Logic gives a definite answer.

Computer Science · Boolean logic

Q = (A OR B) AND NOT C — one row at a time

Three inputs, each true (T) or false (F). Plain-English reminder: NOT flips a value, AND needs both sides true, OR needs at least one side true. (Many books write 1 and 0 instead of T and F — it means the same.)

Try it yourself: for each highlighted row, work out the bracket first, then NOT C, then Q — and only then read the note.

Q= (A OR B) AND NOT Cgate
ABCA OR BNOT CQ
FFFFTF
FFTFFF
FTFTTT
FTTTFF
TFFTTT
TFTTFF
TTFTTT
TTTTFF
A=F, B=F, C=F, A OR B=F, NOT C=T → Q = F

Output

 

Step 1: A, B and C are all F. Bracket first: A OR B is F, because OR needs at least one T and there isn't one. Next, NOT C flips F to T. Last step: F AND T. AND needs both sides true, so Q = F.

1 / 8

The first three columns are the inputs. The next two are the working: the bracket gets its own column, then NOT C. Q is the answer for that row.

Step 1 of 8: A, B and C are all F. Bracket first: A OR B is F, because OR needs at least one T and there isn't one. Next, NOT C flips F to T. Last step: F AND T. AND needs both sides true, so Q = F..

The four building blocks

When does each operator give TRUE?

Each row is one combination of A and B. Tick the cell if the operator gives TRUE for that row, then check your grid.

A = F, B = F
A = F, B = T
A = T, B = F
A = T, B = T

The everyday-English trap

A is true. B is true. What is A OR B?

Both inputs are true: A = T and B = T.

Which idea is closest to what you think about A OR B when A and B are both true?
How sure are you?

How many rows?

Every extra input doubles the rows

Pick a branch at each level to walk one path, then compare it with the other paths.

Input A → Input B → Input C

2 × 2 × 2 = 8 rows of the truth table, and the tree ends 8 times.

On Start. 2 branches to choose from.

Walk any path from the start. Each complete path is one row of a three-input truth table. Read down the ends: C alternates every row, B every two rows, A every four — that's how to list rows without missing one.

Watch out: Count the inputs only. The output column (like Q) is the answer, not a choice, so it never doubles the rows.

Now you write one

From words (and a circuit) to an expression

A fairground ride R should run when the override key is on (M), or when both the safety bar is down (S) and the gate is closed (G). Write R as a Boolean expression.

  1. Name the inputs: S = safety bar down, G = gate closed, M = override key on. Each is either true or false.Naming first stops you juggling sentences and symbols together.
  2. missing step
Which line is step 2?

WHAT YOU'VE LEARNED

A quick recap of today's lesson.

How a long logic statement boils down to one true-or-false answer — row by row.

What you need to know

  • A Boolean expression, however long, works out to a single value: true or false.
  • NOT, AND, OR and XOR are the building blocks, and each one has a fixed pattern of true and false.
  • Brackets mean 'work this out first' — give the bracketed part its own column in the truth table.
  • n inputs need 2^n rows, so 2 inputs give 4 rows and 3 inputs give 8.
  • To write an expression from words or a circuit, name the inputs, spot the operators, and bracket what belongs together.

The big picture

A Boolean expression, however long, can only ever be true or false. A truth table checks it for every possible combination of inputs, working inside the brackets first, so nothing is left to guesswork.

Key points

1NOT flips a value. AND is true only when both inputs are true. OR is true when at least one input is true.
2XOR is true when exactly one input is true, which means the inputs are different. This is the 'one or the other but not both' meaning.
3In a truth table, work inside out: bracket column first, then the outer operator, one row at a time.
4Every extra input doubles the number of rows: 2 inputs, 4 rows; 3 inputs, 8 rows; 4 inputs, 16 rows.
5A circuit is read gate by gate from the inputs, and each gate's output becomes an input to the next.

Worked example

Problem

Complete the truth table for Q = NOT (A AND B).

⚠ Watch out

Trying to do a whole bracketed expression in your head in one go. Skip the bracket column and it is easy to apply the outer operator to the wrong thing. Give the bracket its own column, fill it for every row, then do the outer step.

🧠

Memory hook

OR is generous: at least one will do. XOR is picky: exactly one, never both.

✓

Check yourself

A = T, B = T, C = F. What is A XOR (B AND C)? Bracket first. Answer: the bracket is F, then T XOR F is T.

Flashcards

(12)
What values can a Boolean expression ever have?
Only true or false, however long the expression is.
What does NOT do?
It flips its input: true becomes false and false becomes true. It takes just one input.
When is A AND B true?
Only when both A and B are true.
When is A OR B true?
When at least one of A and B is true — including when both are true.
When is A XOR B true?
When exactly one input is true, which means the two inputs are different. It is false when both are true.
Why is everyday 'or' not the same as logic OR?
Everyday 'or' often means 'one or the other but not both'. That meaning is XOR. Logic OR includes both.
What do brackets tell you in a Boolean expression?
Work out the bracketed part first. In a truth table, give it its own column.
How many rows does a truth table with n inputs have?
2^n: 2 inputs give 4 rows, 3 give 8, 4 give 16.
Why does each extra input double the rows?
Each existing row appears twice, once with the new input true and once with it false.
How do you list the rows of a 3-input table without missing one?
Start with all F. The last input alternates every row, the middle every two rows, the first every four.
How do you turn a sentence into an expression?
Name each input, match 'both … and' to AND, 'either … or' to OR, 'not' to NOT, and bracket the parts that belong together.
How do you write an expression for a logic circuit?
Work from the inputs to the output, one gate at a time. Each gate's output becomes an input to the next gate.

Tap any card to flip it, or use Study as deck to go through them one at a time. In the full lesson these run as a spaced-repetition deck — you rate each card Hard, Good or Easy and the tricky ones keep coming back until they stick.

Learning with Lightbulb is opening soon

You can use this lesson now. Join the waitlist and we'll let you know when the full Lightbulb experience is ready.

Keep me posted

More AQA GCSE Computer Science topics

See the full AQA Computer Science curriculum →

How this lesson was checked. This AQA GCSE Computer Science (specification 8525)lesson was published through Lightbulb Learning's human-designed editorial process — the educational standards, accuracy rules and publication checks it must pass were authored and approved by Philip Halpin. It passed subject-specific assessment, automated educational checks and technical publication verification before going live (publication checks completed 2 October 2026). Published pages are monitored, human spot-checking is ongoing across the lesson library, and anything found wrong is corrected or withdrawn. How our lessons are made and checked. Spotted a mistake? Email hello@lightbulblearning.co and we'll review it.