A logic expression describes a whole circuit in one line, such as X = (A AND B) OR NOT C. Learn to write one from a circuit diagram, from a problem statement and from a truth table, with brackets that show exactly which gate comes first.
A logic expression names the output and describes the gates in words: X = (A AND B) OR NOT C. Each gate with two inputs is written as (input OPERATOR input) in brackets, and NOT goes in front of the input or bracket it inverts. From a circuit, label each gate output and work from left to right. From a statement, translate and, or and not. From a truth table, write an AND term for each row where X = 1 and join the terms with OR.
Fig. 1: label the output of the first gate (P), then build the expression for X from it
Section 01
From a circuit.
Pick an expression in the lab and study the circuit it draws. Then cover the expression and try to read it back from the circuit alone.
Start at the inputs: write the expression for each gate that takes only inputs, such as P = A NOR B.
Move right: the next gate uses those results, so put each one in brackets: X = (A NOR B) XOR C.
Check: the number of operators in your expression should equal the number of gates in the circuit.
Worked example Reading Fig. 1
Write the logic expression for the circuit in Fig. 1.
The first gate is a NOR gate (OR shape with a circle) with inputs A and B: P = A NOR B.
The second gate is an XOR gate (OR shape with the extra curve) with inputs P and C.
Replace P by its bracket.
Answer: X = (A NOR B) XOR C
Your turn
A and B go into an AND gate. C goes into a NOT gate. The outputs of these two gates go into a NOR gate, whose output is X. Write the expression.
X = (A AND B) NOR (NOT C)
Examiner trap
Identify the gates from their shapes, not from where they sit. An OR shape with a circle is NOR, not OR; an extra curve behind it makes it XOR.
Section 02
From a problem statement.
Work through a problem in the lab: write your expression before revealing the answer. Look for the words that group conditions together.
"and" becomes AND; "or" becomes OR; "not", or a condition that is true when an input is 0, becomes NOT.
"either ... or ..." puts the two choices in one bracket: "A and either B or C" is A AND (B OR C).
"exactly one of" is XOR; "neither ... nor ..." is NOR.
Worked example Security light
A security light L turns on (L = 1) if movement is detected (M = 1) and it is dark (D = 1), or if the manual switch is on (S = 1). Write the logic expression.
"Movement detected and dark" is one condition: M AND D.
"or if the manual switch is on" is the alternative: OR S.
Bracket the first condition so it is worked out first.
Answer: L = (M AND D) OR S
Your turn
X is 1 if exactly one of A and B is 1 and C is 0. Write the expression.
X = (A XOR B) AND NOT C
Examiner trap
Brackets change the meaning. (D AND W) OR M and D AND (W OR M) give different outputs: for D = 0, W = 0, M = 1 the first is 1 and the second is 0.
Stage 1 · Learn
Check what the sim just showed you
Four quick checks. Each correct answer earns XP and records this skill on your profile.
Quick check+10 XP
In Fig. 1, what is the expression for the output of the first gate?
Quick check+10 XP
In the lab, an OR gate with inputs A and B feeds a NOT gate whose output is X. What is the expression?
Quick check+10 XP
X is 1 if A is 1 and either B or C is 1. Which expression is correct?
Quick check+10 XP
A two-input truth table has X = 1 only in the row A = 0, B = 1. Which expression matches?
Section 03
From a truth table.
Every row where X = 1 is one way of making the output true. Write each of those rows as an AND of its inputs, with NOT on every input that is 0, then join the rows with OR.
A
B
C
X
0
0
0
0
0
0
1
0
0
1
0
0
0
1
1
0
1
0
0
0
1
0
1
1
1
1
0
0
1
1
1
1
Worked example Two rows with X = 1
Write a logic expression for the truth table above.
X = 1 in two rows: 101 and 111.
Row 101: A = 1, B = 0, C = 1 gives (A AND NOT B) AND C.
Row 111 gives (A AND B) AND C.
Join with OR: X = ((A AND NOT B) AND C) OR ((A AND B) AND C).
Spot the pattern: X = 1 exactly when A = 1 and C = 1, whatever B is, so X = A AND C gives the same table.
Answer: X = ((A AND NOT B) AND C) OR ((A AND B) AND C), or the equivalent X = A AND C
Your turn
A two-input table has X = 1, 0, 0, 1 for the rows 00, 01, 10, 11. Write an expression.
Rows 00 and 11: X = (NOT A AND NOT B) OR (A AND B), which is the same as NOT (A XOR B)
Examiner trap
Use NOT for the inputs that are 0 in a row, not for the ones that are 1. Check your expression by putting two rows back into it.
Stage 2 · Exam
Exam-style questions
Unlocks once the four checks above are done. Worth more XP, written to IGCSE Paper 1 standard.
Finish the four checks above to unlock the exam questions
Exam style+20 XP
A and B are inputs to an XOR gate. Its output and C are the inputs to an AND gate, whose output is X. What is the logic expression?
Exam style+20 XP
A two-input truth table has the output column 1, 0, 0, 0 for the rows 00, 01, 10, 11. Which expression matches?
Exam style+20 XP
Heating H is on (H = 1) if it is cold (T = 1) and either the timer is on (M = 1) or the boost button is pressed (B = 1). Which expression is correct?
Exam style+20 XP
A three-input truth table has X = 1 only in the row A = 0, B = 1, C = 1. Which expression matches?
Skill unlocked
Writing logic expressions, mastered.
This skill is now recorded on your profile. Keep the chain going.