By the end of this lesson you will be able to construct a logic expression from a given description or circuit diagram, using the standard Boolean operators AND, OR, NOT, NAND, NOR, XOR and XNOR.
1. Review of Basic Logic Gates
AND – output is true only if all inputs are true. Symbol: \$\cdot\$.
OR – output is true if at least one input is true. Symbol: \$+\$.
NOT – inverts the input. Symbol: \$\lnot\$.
NAND – NOT‑AND. Output is false only when all inputs are true.
NOR – NOT‑OR. Output is true only when all inputs are false.
XOR – exclusive OR. Output is true when an odd number of inputs are true.
XNOR – exclusive NOR. Output is true when an even number of inputs are true.
2. Truth Tables and Boolean Algebra
Truth tables provide a systematic way to verify the behaviour of a gate or a combination of gates. Boolean algebra allows us to simplify expressions.
Gate
Symbol
Truth Table
AND
\$A \cdot B\$
A
B
Output
0
0
0
0
1
0
1
0
0
1
1
1
OR
\$A + B\$
A
B
Output
0
0
0
0
1
1
1
0
1
1
1
1
NOT
\$\overline{A}\$
A
Output
0
1
1
0
3. Steps to Construct a Logic Expression
Identify all input variables (e.g., \$A\$, \$B\$, \$C\$).
Read the problem statement carefully and translate each condition into a Boolean clause.
Combine the clauses using the appropriate operators, respecting the order of operations (NOT, AND, OR).
Use parentheses to make the intended grouping explicit.
Validate the expression by constructing a truth table or by testing a few input combinations.
4. Example Construction
Problem: “The alarm sounds if the door is open AND the system is armed, OR if a fire is detected while the system is not armed.”
Let:
\$D\$ = “Door is open”
\$A\$ = “System is armed”
\$F\$ = “Fire is detected”
\$S\$ = “Alarm sounds” (output)
Translate the description:
“Door is open AND the system is armed” → \$D \cdot A\$
“Fire is detected while the system is not armed” → \$F \cdot \overline{A}\$
Combine with OR → \$(D \cdot A) + (F \cdot \overline{A})\$
Thus the required logic expression is:
\$S = (D \cdot A) + (F \cdot \overline{A})\$
Suggested diagram: A circuit using two AND gates, one NOT gate, and an OR gate to implement the expression above.
5. Common Pitfalls
Forgetting to apply NOT to the correct variable (e.g., writing \$F \cdot A\$ instead of \$F \cdot \overline{A}\$).
Misinterpreting “either … or … but not both” – this requires XOR, not simple OR.
Omitting parentheses, leading to ambiguous precedence.
6. Summary Checklist
Identify variables.
Convert each English condition to a Boolean clause.
Choose the correct operator (AND, OR, NOT, XOR, etc.).
Use parentheses to enforce intended grouping.
Verify with a truth table.
7. Practice Questions
Write a logic expression for: “A light turns on if either the motion sensor is triggered and it is dark, or the manual switch is on while the timer is not active.”
Given the expression \$Y = \overline{(A + B)} \cdot (C \oplus D)\$, simplify it using De Morgan’s laws and the definition of XOR.
Construct a truth table for the expression \$Z = (P \cdot \overline{Q}) + (\overline{P} \cdot Q)\$ and identify the gate that implements it.