Unit 12.3A · Term 3

Boolean Logic

Boolean logic is the mathematical foundation of all digital circuits. Every decision a computer makes — from adding numbers to rendering games — is built from combinations of simple logic gates. At Grade 12 level, you need to be able to build logic circuits from a problem description, construct truth tables, and derive Boolean expressions.

Learning Objectives

  • 12.3.3.2 Build logical structures
  • 12.3.3.4 Analyze logical structures

Lesson Presentation

12.3A-boolean-logic.pdf · Slides for classroom use

Boolean Values

Boolean logic uses only two values:

True False
1 0
ON OFF
HIGH LOW
YES NO

Basic Logic Gates

1 AND Gate

Expression: X = A AND B   (also written A · B or A ∧ B)

Rule: Output is 1 only if BOTH inputs are 1.

A B X = A AND B
0 0 0
0 1 0
1 0 0
1 1 1

Real-world analogy: Two switches in series — both must be ON for the light to work.

2 OR Gate

Expression: X = A OR B   (also written A + B or A ∨ B)

Rule: Output is 1 if at least one input is 1.

A B X = A OR B
0 0 0
0 1 1
1 0 1
1 1 1

Real-world analogy: Two switches in parallel — either one can turn on the light.

3 NOT Gate (Inverter)

Expression: X = NOT A   (also written A̅ or ¬A)

Rule: Output is the opposite of the input.

A X = NOT A
0 1
1 0

Derived Gates

4 NAND Gate

Expression: X = NOT (A AND B)   (opposite of AND)

Rule: Output is 0 only if BOTH inputs are 1.

A B X = A NAND B
0 0 1
0 1 1
1 0 1
1 1 0

Why NAND is important: NAND is a universal gate — any logic circuit can be built using only NAND gates.

5 NOR Gate

Expression: X = NOT (A OR B)   (opposite of OR)

A B X = A NOR B
0 0 1
0 1 0
1 0 0
1 1 0

NOR is also a universal gate.

6 XOR Gate (Exclusive OR)

Expression: X = A XOR B   (also written A ⊕ B)

Rule: Output is 1 if inputs are different.

A B X = A XOR B
0 0 0
0 1 1
1 0 1
1 1 0

XOR = "one or the other, but not both."

Gate Summary Reference

Gate Expression Output = 1 when… Inputs
AND A · B Both A and B are 1 2+
OR A + B At least one is 1 2+
NOT A is 0 1
NAND (A · B)̅ Not both are 1 2+
NOR (A + B)̅ Both are 0 2+
XOR A ⊕ B Inputs are different 2

Building & Analyzing Circuits

Worked Example — Derive the Truth Table from an Expression

Given: X = (A AND B) OR (NOT C)

Step 1: List all input combinations (2³ = 8 rows for 3 inputs) Step 2: Calculate intermediate values Step 3: Combine to get final output X A | B | C | A AND B | NOT C | X = (A AND B) OR (NOT C) ----+-----+-----+---------+-------+------------------------- 0 | 0 | 0 | 0 | 1 | 1 0 | 0 | 1 | 0 | 0 | 0 0 | 1 | 0 | 0 | 1 | 1 0 | 1 | 1 | 0 | 0 | 0 1 | 0 | 0 | 0 | 1 | 1 1 | 0 | 1 | 0 | 0 | 0 1 | 1 | 0 | 1 | 1 | 1 1 | 1 | 1 | 1 | 0 | 1

Worked Example — Build a Circuit from a Problem

Problem: An alarm (X) should sound when: the door is open (A=1) AND the system is armed (B=1), OR the panic button is pressed (C=1).

Step 1: Identify the conditions: Condition 1: A AND B (door open AND armed) Condition 2: C (panic button) Combined: (A AND B) OR C Step 2: Write the Boolean expression: X = (A · B) + C Step 3: Build the circuit: A ──┐ ├── AND ──┐ B ──┘ ├── OR ── X C ────────────┘ Step 4: Truth table (verify): A B C | A·B | X=(A·B)+C 0 0 0 | 0 | 0 0 0 1 | 0 | 1 0 1 0 | 0 | 0 0 1 1 | 0 | 1 1 0 0 | 0 | 0 1 0 1 | 0 | 1 1 1 0 | 1 | 1 ← door open AND armed 1 1 1 | 1 | 1 ← both conditions

Pitfalls & Common Errors

Confusing OR with XOR

OR gives 1 when one or both inputs are 1. XOR gives 1 when exactly one input is 1. When both are 1: OR=1, XOR=0.

Wrong Number of Rows

For n inputs, you need 2n rows. 2 inputs = 4 rows, 3 inputs = 8 rows, 4 inputs = 16 rows. Missing rows = lost marks.

Operator Precedence

Boolean precedence: NOT first, then AND, then OR. So A + B · C̅ means A + (B · (NOT C)), not (A + B) · (NOT C).

Pro-Tips for Exams

Logic Circuit Strategy

  • Always show intermediate columns in truth tables — examiners award method marks
  • When analyzing a circuit: work from inputs to outputs, gate by gate
  • When building a circuit: start from the output and work backwards to inputs
  • Double-check your truth table by counting: an AND gate mostly produces 0s, an OR gate mostly produces 1s
  • Remember precedence: NOT → AND → OR

Graded Tasks

Remember

Draw the truth tables for AND, OR, NOT, NAND, NOR, and XOR gates.

Apply

Build a truth table for: X = (A OR B) AND (NOT C)

Apply

A vending machine dispenses a drink when: (coin is inserted AND correct button is pressed) OR the override switch is on. Write the Boolean expression and draw the truth table.

Analyze

Given the expression X = NOT(A AND B) OR C, prove using a truth table that this is NOT the same as X = NOT A AND NOT B OR C (i.e., De Morgan's law changes the expression).

Create

Design a security system with 3 inputs: motion sensor (M), door sensor (D), and armed switch (S). The alarm sounds when: the system is armed AND either the motion sensor or door sensor is triggered. Write the expression, draw the circuit, and complete the truth table.

Self-Check Quiz

1. What is the output of 1 AND 0?
Click to reveal: 0 — AND requires both inputs to be 1.
2. What is the output of 0 OR 1?
Click to reveal: 1 — OR outputs 1 if at least one input is 1.
3. What is 1 XOR 1?
Click to reveal: 0 — XOR outputs 1 only when inputs are different.
4. How many rows are in a truth table with 4 inputs?
Click to reveal: 2⁴ = 16 rows.
5. What is the Boolean precedence order?
Click to reveal: NOT (highest) → AND → OR (lowest). Brackets override precedence.