Quick Summary
- Logic gates perform operations like AND, OR, NOT on binary signals (0 and 1)
- They are the fundamental components of all digital electronics
- Seven basic types: AND, OR, NOT, NAND, NOR, XOR, XNOR
- Truth tables show all possible input-output combinations
- Used in computers, calculators, mobile phones, and all digital devices
What are Logic Gates?
Logic gates are electronic circuits that make decisions based on binary inputs. Think of them as tiny decision-makers inside every computer, phone, or digital device. They receive signals that are either ON (1) or OFF (0), process them according to specific rules, and produce an output that is also ON or OFF.
Just like how LASTMA officers use traffic lights (red or green) to control Lagos traffic, logic gates use binary signals (0 or 1) to control the flow of information in computers. These gates work together in millions to perform complex tasks like browsing the internet, playing games, or making phone calls.
The term “logic” comes from Boolean algebra, named after British mathematician George Boole. Logic gates implement Boolean operations that follow strict rules of true/false reasoning.
Understanding Binary Logic Levels
Before learning about different gates, you must understand that logic gates work with two voltage levels:
- Logic 1 (High): Represents TRUE, ON, YES, or positive voltage (usually +5V or +3.3V)
- Logic 0 (Low): Represents FALSE, OFF, NO, or zero voltage (0V or ground)
These two states are enough to represent any information in digital form. Your exam score, your name, a photograph, or a music file can all be stored using just 1s and 0s processed by logic gates.
Types of Logic Gates
1. AND Gate
The AND gate produces output 1 only when ALL inputs are 1. Think of it like entering UNILAG – you need BOTH your student ID AND exam pass to enter the exam hall. Missing either means you cannot enter (output = 0).
Symbol: A flat-ended shape with curved output side
Operation: Output = A AND B
Example: A security door that requires both a correct password AND fingerprint to open.
2. OR Gate
The OR gate produces output 1 when AT LEAST ONE input is 1. It is like paying school fees – you can pay with EITHER cash OR bank transfer. Any one method works (output = 1).
Symbol: A pointed shape at both input and output ends
Operation: Output = A OR B
Example: An alarm system that sounds if either the door sensor OR window sensor detects intrusion.
3. NOT Gate (Inverter)
The NOT gate inverts the input. It has only ONE input and produces the opposite output. If input is 1, output is 0. If input is 0, output is 1. Think of it as a switch that does the opposite of what you expect.
Symbol: A triangle with a small circle (bubble) at the output
Operation: Output = NOT A
Example: A light that turns OFF when you press the switch ON.
4. NAND Gate
NAND means “NOT AND” – it is an AND gate followed by a NOT gate. The output is 0 only when ALL inputs are 1. Otherwise, output is 1. NAND is called a “universal gate” because you can build any other gate using only NAND gates.
Symbol: AND gate symbol with a bubble at the output
Operation: Output = NOT (A AND B)
Example: A safety system that stops a machine unless all guards are NOT in place.
5. NOR Gate
NOR means “NOT OR” – it is an OR gate followed by a NOT gate. The output is 1 only when ALL inputs are 0. It is also a universal gate.
Symbol: OR gate symbol with a bubble at the output
Operation: Output = NOT (A OR B)
Example: A system that activates only when there is no smoke AND no fire detected.
6. XOR Gate (Exclusive OR)
The XOR gate produces output 1 when inputs are DIFFERENT. If both inputs are the same (both 0 or both 1), output is 0. Think of it as detecting change or difference.
Symbol: OR gate with an extra curved line at the input
Operation: Output = A XOR B
Example: A light controlled by two switches in different rooms – flipping either switch changes the light state.
7. XNOR Gate (Exclusive NOR)
XNOR is the opposite of XOR. Output is 1 when inputs are the SAME. It detects equality.
Symbol: XOR gate with a bubble at the output
Operation: Output = NOT (A XOR B)
Example: A comparator that signals when two values match.
Truth Tables
A truth table shows all possible input combinations and their corresponding outputs for a logic gate. This is the most important tool for understanding and analyzing logic gates.
| Inputs | AND | OR | NAND | NOR | XOR | XNOR | |
|---|---|---|---|---|---|---|---|
| A | B | Outputs | |||||
| 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 |
| 0 | 1 | 0 | 1 | 1 | 0 | 1 | 0 |
| 1 | 0 | 0 | 1 | 1 | 0 | 1 | 0 |
| 1 | 1 | 1 | 1 | 0 | 0 | 0 | 1 |
NOT Gate Truth Table (single input):
| Input A | Output (NOT A) |
|---|---|
| 0 | 1 |
| 1 | 0 |
How Logic Gates Work Together
Individual logic gates combine to create complex circuits. For example:
Half Adder: Uses XOR and AND gates to add two binary digits and produce a sum and carry output.
Full Adder: Combines multiple gates to add three binary digits (including carry from previous addition).
Multiplexer: Uses gates to select one of many inputs and route it to a single output.
Decoder: Takes binary input and activates one of many output lines.
These building blocks create the arithmetic logic unit (ALU) in processors, which performs all calculations in your phone or computer.
Practical Applications in Nigeria
Logic gates power every digital device Nigerians use daily:
- ATM Machines: Verify PIN codes using comparison circuits built from logic gates
- Traffic Lights: Control systems in Lagos, Abuja use logic gates for timing
- Mobile Phones: Millions of logic gates process calls, texts, and data
- POS Terminals: Verify card transactions using logic circuits
- Computer Processors: Billions of transistors organized as logic gates
- Digital Watches: Timekeeping circuits use gate-based counters
- JAMB CBT Systems: Store and process exam answers using memory circuits made of gates
Boolean Expressions
Each logic gate can be written as a Boolean expression:
- AND gate: F = A ยท B or F = AB
- OR gate: F = A + B
- NOT gate: F = A’ or F = ฤ
- NAND gate: F = (A ยท B)’ or F = (AB)’
- NOR gate: F = (A + B)’
- XOR gate: F = A โ B
- XNOR gate: F = (A โ B)’
These expressions help simplify complex circuits using Boolean algebra laws.
Common Exam Mistakes
WAEC Chief Examiner Reports:
- Symbol Confusion: Drawing AND gate symbols when answering OR gate questions. Learn the distinct shapes carefully.
- Truth Table Errors: Missing input combinations (forgetting to write all 4 rows for 2-input gates). Always use 2โฟ rows where n = number of inputs.
- Output Mistakes: Writing incorrect outputs for NAND/NOR gates. Remember: NAND is opposite of AND, NOR is opposite of OR.
- XOR Confusion: Treating XOR like OR. XOR output is 1 only when inputs DIFFER, not when any input is 1.
- Bubble Meaning: Not understanding that the bubble (small circle) means NOT operation.
- Boolean Expression Errors: Using wrong symbols (writing + for AND instead of ยท).
- Incomplete Answers: Drawing gate symbols without labeling inputs and outputs clearly.
Practice Questions
Multiple Choice Questions
1. Which logic gate produces output 1 only when all inputs are 1?
a) OR gate
b) AND gate โ
c) NOT gate
d) XOR gate
2. What is the output of a NOT gate when the input is 0?
a) 0
b) 1 โ
c) 2
d) Undefined
3. Which of the following is called a universal gate?
a) AND gate
b) OR gate
c) NAND gate โ
d) XOR gate
Explanation: NAND and NOR are universal gates because any other gate can be built using only them.
4. For a 2-input XOR gate, what is the output when both inputs are 1?
a) 0 โ
b) 1
c) 2
d) Depends on circuit
Explanation: XOR outputs 1 only when inputs differ. Same inputs (11 or 00) give output 0.
Essay Questions
1. (a) Define a logic gate and state THREE types of logic gates. [5 marks]
(b) Draw the truth table for a 2-input AND gate. [4 marks]
Tip: Define clearly as electronic circuits performing logical operations. Name AND, OR, NOT. Truth table must have 4 rows showing all input combinations (00, 01, 10, 11) with correct outputs.
2. (a) Explain the difference between an OR gate and an XOR gate. [4 marks]
(b) Draw the logic symbol for each gate mentioned in (a). [4 marks]
Tip: OR gives 1 if ANY input is 1. XOR gives 1 only if inputs DIFFER. Draw symbols clearly with proper labels.
3. (a) State FOUR practical applications of logic gates in everyday life. [4 marks]
(b) Complete the truth table for a 2-input NAND gate: [4 marks]
| A | B | Output |
|---|---|---|
| 0 | 0 | ? |
| 0 | 1 | ? |
| 1 | 0 | ? |
| 1 | 1 | ? |
Tip: Applications include computers, phones, calculators, traffic lights. NAND is opposite of AND: only 11 gives 0, all others give 1.
4. (a) Explain what is meant by “universal gate” and name TWO universal gates. [4 marks]
(b) Draw the circuit diagram showing how to create a NOT gate using only NAND gates. [4 marks]
Tip: Universal gates can build any other gate. NAND and NOR are universal. To make NOT from NAND, connect both inputs together.
Memory Aids
Gate Types: “All Nice People Never Neglect Excellent Xylophones” – AND, NOT, NAND, NOR, XOR
AND Gate Rule: “All ones IN, one OUT” – All inputs must be 1 for output 1
OR Gate Rule: “One or more IN, one OUT” – Any input 1 gives output 1
NOT Gate Rule: “Opposite always” – Output is always opposite of input
XOR Rule: “Different = 1, Same = 0” – Output 1 when inputs differ
Bubble Means NOT: “Bubble trouble reverses” – Circle on symbol means invert
Truth Table Rows: “Two power N” – For N inputs, use 2แดบ rows (2 inputs = 4 rows, 3 inputs = 8 rows)
Related Topics
- Boolean Algebra – Mathematical foundation of logic gates
- Binary Number System – The language logic gates speak
- Digital Electronics – Circuits built from logic gates
- Computer Architecture – How gates create processors
- Integrated Circuits – Millions of gates on silicon chips