Classical Computing Foundations
Before diving into quantum computing, let's understand how regular (classical) computers work. You'll learn about binary, logic gates, and circuits—concepts that will help you understand quantum gates later!
About this lesson
In this lesson you will:
- Understand the binary number system and why computers use it
- Learn about classical logic gates (NOT, AND, OR)
- See how gates combine to form circuits
- Build your own simple circuits!
This lesson features:
- Interactive binary counter you can click and manipulate
- Gate playground to test NOT, AND, and OR gates
- Simple circuit builder with drag-and-drop
Prerequisites: Lesson 1 (Welcome to Quantum Computing)
Binary and Bits
Classical computers use electricity to process information. Electricity flows through tiny switches that can be either ON or OFF. This two-state system is called binary.
In binary:
- 0 = OFF (no electricity flowing)
- 1 = ON (electricity flowing)
A bit (binary digit) is a single piece of information that can be either 0 or 1. Think of a light switch—it's either off (0) or on (1), nothing in between.
Counting in Binary
Binary counts like this: 0, 1, 10, 11, 100, 101, 110, 111, 1000...
Just like we count in base-10 (decimal: 0-9, then carry to next digit), binary counts in base-2 (0-1, then carry).
Fun Fact
8 bits = 1 byte. Your computer uses bytes to represent letters, numbers, emojis—everything you see on screen!
Interactive: Binary Counter
Click individual bits to flip them between 0 and 1. Watch how the decimal value changes!
Challenge: Can you make the number 100 in binary? (Hint: Click the bits to turn them on/off)
Each bit position represents a power of 2. The rightmost bit is 2⁰=1, next is 2¹=2, then 2²=4, and so on!
Classical Logic Gates
A logic gate is like an instruction that tells bits how to change. Gates are the building blocks of all computation—both classical and quantum!
Let's explore the three most fundamental classical gates:
NOT Gate (Inverter)
The NOT gate flips a bit: 0 becomes 1, and 1 becomes 0. Simple!
AND Gate
The AND gate takes two inputs and outputs 1 only if BOTH inputs are 1. Otherwise it outputs 0.
OR Gate
The OR gate takes two inputs and outputs 1 if AT LEAST ONE input is 1. It only outputs 0 if both inputs are 0.
Interactive: Gate Playground
Experiment with each gate to see how it transforms inputs!
Truth Table
| Input | Output |
|---|---|
| 0 | 1 |
| 1 | 0 |
Truth Table
| A | B | Output |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
Truth Table
| A | B | Output |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
A truth table shows all possible input combinations and their outputs. It's like a complete instruction manual for the gate!
Building Circuits
Individual gates are useful, but the real power comes from combining gates into circuits. A circuit is a sequence of gates that processes information step-by-step.
Think of it like a recipe: each gate is one instruction, and the circuit is the complete set of steps to transform your input into the desired output.
Example: XOR Gate (Exclusive OR)
There's no single XOR gate in basic hardware, but you can build one by combining AND, OR, and NOT gates! XOR outputs 1 only if inputs are different (one 0 and one 1).
Interactive: Simple Circuit Simulator
Set the inputs and watch how the circuit processes them through multiple gates!
What's Happening:
Click the inputs to see the circuit in action!
This circuit implements XOR (Exclusive OR). Notice how combining simple gates creates more complex behavior!
Why This Matters for Quantum Computing
Quantum gates work the same way—they're instructions that transform qubits! But instead of just flipping bits, quantum gates can create superposition and entanglement. You'll learn about quantum gates starting in Lesson 4!
Test Your Understanding
Answer these questions to check your comprehension of this lesson:
Question 1: What is binary?
Question 2: What does the NOT gate do?
Question 3: When does an AND gate output 1?
Question 4: What do we call a combination of multiple gates?