Sparklabs Learning / Digital Technology
SS 2 First Term
Week 6: Logic Gates and Digital Logic
- School
- Creative Brains Academy
- Subject
- Digital Technology
- Pack
- Learner notes
- Prepared
- 7 November 2026
Week index
- 01Review and Computer Architecture
- 02Main Memory
- 03Secondary Storage
- 04Operating Systems, Licensing and Applications
- 05Number Systems and Data Representation
- 06Logic Gates and Digital Logic
- 07Computer Networks
- 08Internet and Online Safety
- 09Introduction to Databases
- 10Advanced Productivity Tools
- 11Revision
- 12Examination
Week 6 / First Term
Logic Gates and Digital Logic
Monday 12 October 2026 to Friday 16 October 2026
Lesson notes
Learning Objectives
- Explain what a logic gate is and how it uses bits.
- Draw truth tables for the AND, OR and NOT gates.
- Describe the NAND, NOR, XOR and XNOR gates.
- Explain the use of Boolean algebra and adders.
What is a Logic Gate?
A logic gate is a tiny circuit that takes one or more binary inputs, each a 0 or a 1, and produces a single binary output according to a fixed logical rule. Gates are built from transistors and are the building blocks of every digital device; the ALU, memory and control circuits are all combinations of gates. To describe a gate, engineers use a truth table, a list of every input combination with its output. A two-input gate has 4 rows, a three-input gate 8.
The AND Gate
An AND gate has two or more inputs and its output is 1 only when all inputs are 1; if any input is 0, the output is 0. Its symbol is a flat-sided capital D with inputs on the left and the output on the right. The expression is Output = A AND B, also written as A. B or AB. A strong room that opens only when the correct code is entered AND a guard presses the button is a real-world AND because both must hold. Switches wired in series light a bulb only when both are on.
The OR Gate
An OR gate outputs 1 when at least one input is 1, and 0 only when all inputs are 0. Its symbol is the AND shape with a curved inlet, and the expression is Output = A OR B, written as A + B. An emergency light that comes on when switch A OR switch B is pressed is a real-world OR because one condition is enough. Switches wired in parallel light a bulb when either is closed.
The NOT Gate
A NOT gate has a single input and inverts it; input 0 gives output 1, and input 1 gives output 0. Its symbol is a triangle followed by a small bubble. The expression is Output = NOT A, written with a bar above the A. A fire alarm that stays silent while an override switch is ON sounds only when the override is NOT on.
The NAND and NOR Gates
NAND stands for NOT AND, which is an AND gate followed by an inverter, so its output is 0 only when all inputs are 1 and 1 in every other case; the expression is NOT (A AND B). NOR stands for NOT OR, which is an OR gate followed by an inverter whose output is 1 only when all inputs are 0; the expression is NOT (A OR B). NAND is called a universal gate because every other gate can be built from NAND gates alone; an AND gate is a NAND plus a NOT, and a NOT gate joins a NAND's inputs together.
The XOR and XNOR Gates
XOR stands for exclusive OR. Its output is 1 when the inputs differ and 0 when they are the same, so 0,1 and 1,0 give 1, while 0,0 and 1,1 give 0. Its symbol is the OR shape with an extra curved inlet, and the expression is A XOR B. XOR is essential in electronics; it builds the adders in the ALU, creates parity bits and appears in encryption. XNOR is the opposite; its output is 1 when the inputs are the same and 0 when they differ, meaning NOT (A XOR B); XNOR circuits compare two values for equality.
The table below compares all seven gates.
Boolean Algebra
Boolean algebra is the mathematics of 0 and 1. AND behaves like multiplication (0 x 1 = 0, 1 x 1 = 1), OR behaves like addition except that 1 + 1 = 1, and NOT is the complement. The order of operations is NOT first, then AND, then OR, unless brackets change it; in Output = A AND (B OR NOT C), the NOT C is done first, then the bracket, then the AND.
De Morgan's Laws
De Morgan's laws convert one logical form into another. The first law says NOT (A AND B) = (NOT A) OR (NOT B); the opposite of both being true is that at least one is false. The second law says NOT (A OR B) = (NOT A) AND (NOT B); the opposite of at least one being true is that both are false. The second law is exactly how a NOR gate behaves; the first lets a designer rebuild an AND circuit from OR and NOT gates. Prove either law by comparing both sides in a truth table.
The Half Adder
Combinational logic is a circuit whose output depends only on the present inputs, with no memory. A classic example is the half adder, which adds two bits, producing 0 + 0 = 0, 1 + 0 = 1, and 1 + 1 = 10, meaning 0 with a carry of 1. Its sum comes from an XOR gate and its carry from an AND gate, both fed by the same two inputs; the sum is A XOR B and the carry is A AND B. When both inputs are 1, XOR gives 0 and AND gives 1, which is exactly the 10.
The Full Adder
A half adder cannot handle a carry from a previous column, so real arithmetic uses a full adder with three inputs, namely A, B and a carry-in (Cin). Its sum is A XOR B XOR Cin, and its carry-out is (A AND B) OR (Cin AND (A XOR B)). The table below shows the eight combinations. To add multi-digit numbers, engineers chain one full adder per column, passing each carry-out to the next carry-in, exactly how the ALU adds.
Applications of Logic Gates
Logic gates appear throughout a computer. The ALU uses them for arithmetic, where XOR and AND gates build the adders, while other combinations carry out comparisons. Control circuits in the CPU, memory and keyboard decode signals and synchronise operations. Real-world systems work the same way; an ATM dispenses cash only when the card is valid AND the PIN is correct AND the balance is enough, and a home alarm sounds when the door OR the window sensor is triggered AND the system is armed. For any scenario, write the Boolean expression, build the truth table, and break the rule into AND, OR and NOT steps.
Practical Exercises
Test yourself with these problems before the Week 10 assessment.
State the output of AND, OR and NOT for inputs A = 1, B = 0.
Write the Boolean expression for output 1 only when A is 1 and B is 0.
Write the truth table for a NAND gate.
Draw the symbol for an XOR gate and describe its output rule.
Add 1 + 1 with a half adder and state the sum and carry.
Prove that NOT (A AND B) equals (NOT A) OR (NOT B).
Explain how a full adder is built from the same gates as a half adder.
Suggest a real gadget that uses an AND logic rule and justify your answer.
Digital Logic and Binary Signals
Digital logic is the branch of electronics that processes binary information, signals that are either 0 or 1, low or high. Every modern computer is built from circuits that follow these simple two-valued rules, and the building blocks of those circuits are called logic gates.
Inside the computer, a binary 1 is represented by a small voltage being present and a binary 0 by its absence. As signals travel along the wires of the CPU, gates read the incoming voltages, carry out a logical rule, and produce a single output voltage. Combining thousands of these simple decisions produces the arithmetic, comparison and control operations of a processor.
Because the rules are so few, they can be written precisely and tested. A logic gate is defined by its truth table, a table that lists every possible combination of inputs and the output each one produces. This week's periods build from the three basic gates, AND, OR and NOT, to the derived gates NAND, NOR and XOR, and then to full combinational circuits, exactly the path engineers follow when they design a chip.
Digital circuits work with two states, 0 and 1.
Logic gates read binary inputs and produce one binary output.
Combining gates builds the arithmetic and decision circuits of the CPU.
Truth tables record the behaviour of each gate for every input combination.
This overview connects Week 8's binary number systems with the ALU work from Week 1, showing how the 0s and 1s of data are actually manipulated inside the processor.
Gate Functions and Truth Tables at a Glance
The six gates can be grouped by how they behave. AND outputs 1 only when all inputs are 1. OR outputs 1 when at least one input is 1. NOT inverts a single input. NAND is the opposite of AND, outputting 0 only when all inputs are 1. NOR is the opposite of OR, outputting 1 only when all inputs are 0. XOR outputs 1 only when the two inputs differ.
A truth table is a complete check of a gate or a circuit. For two inputs A and B there are four combinations, 00, 01, 10 and 11, so a two-input truth table has four rows. The AND column reads 0, 0, 0, 1. The OR column reads 0, 1, 1, 1. NAND is the exact opposite of AND, 1, 1, 1, 0, while NOR is the opposite of OR, 1, 0, 0, 0. XOR reads 0, 1, 1, 0 because it is 1 only when the inputs differ.
To construct any truth table, a student lists every combination of inputs, then applies the gate rule row by row. This disciplined row by row method is exactly how combinational circuits are analysed in Period 3, and it is worth practising until it becomes automatic.
AND, output 1 only when every input is 1.
OR, output 1 when at least one input is 1.
NOT, single input inverted, 0 becomes 1 and 1 becomes 0.
NAND, output 0 only when every input is 1.
NOR, output 1 only when every input is 0.
XOR, output 1 when the inputs differ.
Combining Gates to Build Simple Circuits
Few real systems use a single gate. Engineers combine gates so that the output depends on several conditions at once, and a circuit built from connected gates is called a combinational logic circuit, because its output is a pure function of its present inputs.
A simple combined circuit can be designed step by step. Consider a system that rings a bell when a button is pressed at the same time as a key is turned. The button and the key feed an AND gate, and the result joins a second AND gate with a master switch, so the bell rings only when the master switch, the button and the key are all active. Each added gate makes the decision more selective.
Analysing such a circuit means writing the Boolean expression, building the truth table row by row, and checking it against the intended behaviour. Building the truth table for a three-input circuit produces eight rows, and the output column should match, row by row, the real-life rule the circuit is meant to enforce.
Real-World Applications of Logic Circuits
Logic circuits power the decisions of everyday machines. In a school, a door lock opens only if a correct code is entered AND a valid card is presented, an AND rule. An overhead fan in a laboratory turns on if the room is hot OR the air quality check fails, an OR rule. The alarm system from Period 3, Alarm equals D OR W AND A, is a real combination of OR and AND logic.
Inside the computer, the adder circuits of the ALU are built from XOR and AND gates, while comparison circuits decide whether one number is equal to another using XNOR logic. Even the most powerful processor is, at heart, billions of these simple gates wired together into one enormous logic circuit.
Combinational circuits combine gates so that output depends on several conditions.
Boolean expressions and truth tables let engineers verify a circuit before building it.
Alarm systems, door locks and the adder of the CPU are all built from combined gates.
This is the foundation for Week 10, where learners turn logic design into working programmes and simulations of digital circuits.
| A | B | A AND B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
| A | B | A OR B |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
| A | NOT A |
|---|---|
| 0 | 1 |
| 1 | 0 |
| A | B | NAND (A AND B) | NOR (A OR B) |
|---|---|---|---|
| 0 | 0 | 1 | 1 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 0 |
| A | B | A XOR B | XNOR (A XOR B) |
|---|---|---|---|
| 0 | 0 | 0 | 1 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 |
| Gate | Rule | Symbol feature | Boolean expression | Memory phrase |
|---|---|---|---|---|
| AND | 1 only if all inputs are 1 | Flat D shape | A. B | All must be true |
| OR | 1 if at least one input is 1 | Curved inlet on the left | A + B | Any can be true |
| NOT | Inverts the single input | Triangle plus bubble | A with a bar | Flip it |
| NAND | 0 only if all inputs are 1 | AND shape plus bubble | NOT (A AND B) | Not all |
| NOR | 1 only if all inputs are 0 | OR shape plus bubble | NOT (A OR B) | None at all |
| XOR | 1 if inputs differ | Extra curved line on the left | A XOR B | Different |
| XNOR | 1 if inputs are the same | XOR shape plus bubble | NOT (A XOR B) | Same |
| A | B | Sum (XOR) | Carry (AND) |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 |
| A | B | Cin | Sum | Cout |
|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 1 | 0 |
| 0 | 1 | 0 | 1 | 0 |
| 0 | 1 | 1 | 0 | 1 |
| 1 | 0 | 0 | 1 | 0 |
| 1 | 0 | 1 | 0 | 1 |
| 1 | 1 | 0 | 0 | 1 |
| 1 | 1 | 1 | 1 | 1 |
| Term | Meaning |
|---|---|
| Logic gate | A tiny circuit that outputs 0 or 1 according to a fixed logical rule |
| Truth table | A list of every input combination with its output |
| AND gate | Outputs 1 only when all inputs are 1 |
| OR gate | Outputs 1 when at least one input is 1 |
| NOT gate | Inverts its single input |
| NAND gate | AND followed by NOT, outputs 0 only when all inputs are 1 |
| NOR gate | OR followed by NOT, outputs 1 only when all inputs are 0 |
| XOR gate | Outputs 1 when the inputs differ |
| XNOR gate | Outputs 1 when the inputs are the same |
| Boolean algebra | The mathematics of 0 and 1 used to describe logic circuits |
| De Morgan's laws | Rules that convert NOT (A AND B) and NOT (A OR B) into simpler forms |
| Half adder | A circuit that adds two bits, producing a sum and a carry |
| Full adder | A circuit that adds two bits plus a carry-in |
| ALU | Arithmetic Logic Unit, the part of the CPU that performs calculations |
| Combinational logic | A circuit whose output depends only on present inputs, with no memory |
| Transistor | The electronic switch from which gates are built |
Practical Work
- Draw the truth tables for AND, OR and NOT.
- Write the truth table for the NAND gate.
- Explain how a half adder adds two bits.
- Simplify a simple Boolean expression.
Scenario-Based Questions
- A student builds a circuit with two switches wired so a lamp turns on only when both switches are closed. Identify the logic gate that models this circuit and draw its truth table.
- An engineer needs a gate that outputs 0 only when both inputs are 1. Identify the gate, write its Boolean expression and explain why NAND gates are called universal gates.
- A student adds binary 1 + 1 using a half adder. State the sum and carry produced and explain why a full adder is needed when adding multi-bit numbers.
- Using De Morgan's first law, prove that NOT (A AND B) equals (NOT A) OR (NOT B) by constructing a truth table for both expressions and comparing the output columns.
- A security system activates an alarm when at least one of three sensors detects motion. Identify the type of logic gate used at each stage, write the Boolean expression for the output and explain why OR rather than AND is appropriate.
- A computer technician explains that the ALU inside the CPU is built from logic gates. Name two specific operations the ALU performs and identify which gates are used to implement each operation.
- A student is asked to design a circuit whose output is 1 only when inputs A and B are different. Identify the gate, write the Boolean expression and draw the truth table to verify the design.