Week 6First TermMonday 12 October 2026 to Friday 16 October 2026

Logic Gates and Digital Logic

What is a Logic Gate?; The AND Gate; The OR Gate; The NOT Gate; The NAND and NOR Gates; The XOR and XNOR Gates; Boolean Algebra; De Morgan's Laws; The Half Adder; The Full Adder; Applications of Logic Gates; Practical Exercises; Digital Logic and Binary Signals; Gate Functions and Truth Tables at a Glance; Combining Gates to Build Simple Circuits; Real-World Applications of Logic Circuits

Print lesson pack
On this page19 sections
  1. 01Learning Objectives
  2. 02What is a Logic Gate?
  3. 03The AND Gate
  4. 04The OR Gate
  5. 05The NOT Gate
  6. 06The NAND and NOR Gates
  7. 07The XOR and XNOR Gates
  8. 08Boolean Algebra
  9. 09De Morgan's Laws
  10. 10The Half Adder
  11. 11The Full Adder
  12. 12Applications of Logic Gates
  13. 13Practical Exercises
  14. 14Digital Logic and Binary Signals
  15. 15Gate Functions and Truth Tables at a Glance
  16. 16Combining Gates to Build Simple Circuits
  17. 17Real-World Applications of Logic Circuits
  18. 18Practical Work
  19. 19Scenario-Based Questions

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.

ABA AND B
000
010
100
111
ABA OR B
000
011
101
111
ANOT A
01
10
ABNAND (A AND B)NOR (A OR B)
0011
0110
1010
1100
ABA XOR BXNOR (A XOR B)
0001
0110
1010
1101
GateRuleSymbol featureBoolean expressionMemory phrase
AND1 only if all inputs are 1Flat D shapeA. BAll must be true
OR1 if at least one input is 1Curved inlet on the leftA + BAny can be true
NOTInverts the single inputTriangle plus bubbleA with a barFlip it
NAND0 only if all inputs are 1AND shape plus bubbleNOT (A AND B)Not all
NOR1 only if all inputs are 0OR shape plus bubbleNOT (A OR B)None at all
XOR1 if inputs differExtra curved line on the leftA XOR BDifferent
XNOR1 if inputs are the sameXOR shape plus bubbleNOT (A XOR B)Same
ABSum (XOR)Carry (AND)
0000
0110
1010
1101
ABCinSumCout
00000
00110
01010
01101
10010
10101
11001
11111
TermMeaning
Logic gateA tiny circuit that outputs 0 or 1 according to a fixed logical rule
Truth tableA list of every input combination with its output
AND gateOutputs 1 only when all inputs are 1
OR gateOutputs 1 when at least one input is 1
NOT gateInverts its single input
NAND gateAND followed by NOT, outputs 0 only when all inputs are 1
NOR gateOR followed by NOT, outputs 1 only when all inputs are 0
XOR gateOutputs 1 when the inputs differ
XNOR gateOutputs 1 when the inputs are the same
Boolean algebraThe mathematics of 0 and 1 used to describe logic circuits
De Morgan's lawsRules that convert NOT (A AND B) and NOT (A OR B) into simpler forms
Half adderA circuit that adds two bits, producing a sum and a carry
Full adderA circuit that adds two bits plus a carry-in
ALUArithmetic Logic Unit, the part of the CPU that performs calculations
Combinational logicA circuit whose output depends only on present inputs, with no memory
TransistorThe electronic switch from which gates are built

Practical Work

  1. Draw the truth tables for AND, OR and NOT.
  2. Write the truth table for the NAND gate.
  3. Explain how a half adder adds two bits.
  4. Simplify a simple Boolean expression.

Scenario-Based Questions

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. 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.
  7. 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.