← Years 9–10 Creating Digital Solutions

Negating compound conditions

De Morgan's law: to negate a compound condition, negate each part and swap AND for OR. Likewise NOT (A OR B) = (NOT A) AND (NOT B). A truth table can prove they match.

Understanding Negating compound conditions in Years 9–10 Creating Digital Solutions

What it does: Negate each comparison (>= becomes <, <= becomes >) and swap AND for OR. A person is not a teen if they are under 13 or over 17. Checking every combination of A and B shows both expressions give the same result. This row is one example where both come out true. Each part is negated AND the operator is swapped. If you forget to swap it, the new condition is not equivalent. Turned away is NOT (A AND B). You only need one part to fail, so it becomes (NOT A) OR (NOT B). Negating a range check gives 'outside the range'. A number is outside if it is below 1 OR above 10. No number can be both, so AND would never be true.

Common mistakes: By De Morgan's law, NOT (A AND B) equals (NOT A) OR (NOT B). Negating each part is not enough, because AND must also swap to OR. Line 3 should use OR. NOT (x OR y) equals (NOT x) AND (NOT y). Both x and y must be false, so the OR must swap to AND.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 6–132) and word search (Modules 6–132).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Which is equivalent to NOT (A AND B)?
(NOT A) OR (NOT B)(NOT A) AND (NOT B)
Matches
NOT (A AND B) = (NOT A) AND (NOT B)
↓
The AND was not swapped for OR. Negating each part is not enough on its own.
Applying
Meanings
Term
NOT (A AND B) = (NOT A) OR (NOT B)
Meaning
De Morgan's law: to negate a compound condition, negate each part and swap AND for OR. Likewise NOT (A OR B) = (NOT A) AND (NOT B). A truth table can prove they match.
Practice
if NOT (age >= 13 AND age <= 17) then
Testing
Gaps
NOT (A AND B) = (NOT A) (NOT B)
Check Answer
Spots
2B <- false
3swapped <- (NOT A) AND (NOT B)

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Void Whale' badge — Definition Drifter, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Which is equivalent to NOT (A AND B)?
A. (NOT A) OR (NOT B) ✓
B. (NOT A) AND (NOT B)
De Morgan's law: negate each part and swap AND for OR. So NOT (A AND B) becomes (NOT A) OR (NOT B).
2. Which is equivalent to NOT (A OR B)?
A. (NOT A) AND (NOT B) ✓
B. (NOT A) OR (NOT B)
Negate each part and swap OR for AND. NOT (A OR B) is only true when both A and B are false.
3. When you negate a compound condition using De Morgan's law, what happens to the AND or OR?
A. It stays the same
B. It is swapped (AND becomes OR, OR becomes AND) ✓
Each part is negated AND the operator is swapped. If you forget to swap it, the new condition is not equivalent.
4. A game lets you in if age >= 13 AND hasTicket = true. Which condition means the player is turned away?
A. age < 13 OR hasTicket = false ✓
B. age < 13 AND hasTicket = false
Turned away is NOT (A AND B). You only need one part to fail, so it becomes (NOT A) OR (NOT B).
5. Which condition is the negation of the range check x >= 1 AND x <= 10?
A. x < 1 AND x > 10
B. x < 1 OR x > 10 ✓
Negating a range check gives 'outside the range'. A number is outside if it is below 1 OR above 10. No number can be both, so AND would never be true.

Match the Pairs

NOT (A AND B) = (NOT A) OR (NOT B) → Negating an AND: flip each part and swap AND for OR
NOT (A OR B) = (NOT A) AND (NOT B) → Negating an OR: flip each part and swap OR for AND
The opposite of the range check 'age >= 13 AND age <= 17' (a teen) is 'not a teen' → age < 13 OR age > 17
A truth table proves two conditions are equivalent when their output columns match on every row → A=T, B=F: NOT (A AND B) = T and (NOT A) OR (NOT B) = T
NOT (A AND B) = (NOT A) AND (NOT B) → The AND was not swapped for OR. Negating each part is not enough on its own.
NOT (score >= 50 OR score <= 90) = score < 50 OR score > 90 → The OR was not swapped for AND when negating the condition.

Key Term

NOT (A AND B) = (NOT A) OR (NOT B)
De Morgan's law: to negate a compound condition, negate each part and swap AND for OR. Likewise NOT (A OR B) = (NOT A) AND (NOT B). A truth table can prove they match.

Fill in the Blanks

1. NOT (A AND B) = (NOT A) OR (NOT B)
Hint: Type the operator that replaces AND when you negate each part
2. NOT (A OR B) = (NOT A) AND (NOT B)
Hint: Type the operator that replaces OR when you negate each part
3. NOT (age >= 13 AND age <= 19) = age < 13 OR age > 19
Hint: Type the logical operator that joins the two negated range checks
4. NOT (score >= 50 AND score <= 100) = score < 50 OR score > 100
Hint: Type the comparison operator that is the opposite of the one used in the original check
5. A = true, B = false (NOT A) OR (NOT B) gives true
Hint: Type the Boolean result of the negated expression, matching NOT (A AND B) for these inputs

Spot the Error

Question 1
A A <- true
B B <- false
C swapped <- (NOT A) AND (NOT B)
D negated <- NOT (A AND B)
E print negated = swapped
Line C — By De Morgan's law, NOT (A AND B) equals (NOT A) OR (NOT B). Negating each part is not enough, because AND must also swap to OR. Line 3 should use OR.
Question 2
A // Neither: NOT (x OR y)
B if (NOT x) OR (NOT y) then
C print 'neither x nor y'
D end if
Line B — NOT (x OR y) equals (NOT x) AND (NOT y). Both x and y must be false, so the OR must swap to AND.
Question 3
A input n
B inside <- n >= 0 AND n <= 100
C outside <- NOT inside
D alt <- n < 0 AND n > 100
E print outside = alt
Line D — Negating the range check n >= 0 AND n <= 100 gives n < 0 OR n > 100. A number cannot be below 0 and above 100 at once, so AND would never be true. It should be OR.
Question 4
A input a
B input b
C if a > 5 AND b >= 2 then
D print 'NOT (a>5 OR b<2)'
E end if
Line C — NOT (a > 5 OR b < 2) becomes (NOT a > 5) AND (NOT b < 2), which is a <= 5 AND b >= 2. The first part was not negated. It should be a <= 5.
Question 5
A A=T, B=F: A AND B = true
B NOT (A AND B) = true
C (NOT A) OR (NOT B) = true
D Both true, so they are equal
Line A — In the truth table row where A is true and B is false, A AND B is false because both inputs must be true. The line should say A AND B = false. Then NOT (A AND B) is true, matching the other side.

Student with a class code? Join your class →