Computer Science
Grade 12
20 min
Quantum Circuits: Building Quantum Algorithms
Explore quantum circuits and how they are used to build quantum algorithms by combining quantum gates.
Tutorial Preview
1
Introduction & Learning Objectives
Learning Objectives
Define a quantum circuit and its components: qubits, gates, and measurements.
Represent qubit states using ket notation and corresponding column vectors.
Apply single-qubit gates (Hadamard, Pauli-X, Z) to transform qubit state vectors.
Construct a multi-qubit circuit using a CNOT gate to create an entangled Bell state.
Analyze the final state of a simple quantum circuit and calculate the probability of measurement outcomes.
Translate a basic quantum algorithm, like creating superposition, into a standard circuit diagram.
Ever wanted to write a program that processes a 0 and a 1 at the exact same time? 🤯 Let's learn how to build the logic for it using quantum circuits.
Quantum circuits are the blueprints for quantum algorithms, much like flowcharts...
2
Key Concepts & Vocabulary
TermDefinitionExample
Qubit (Quantum Bit)The fundamental unit of quantum information. Unlike a classical bit that is either 0 or 1, a qubit can exist in a state of |0⟩, |1⟩, or a linear combination (superposition) of both.A qubit's state can be written as α|0⟩ + β|1⟩, where α and β are complex numbers called amplitudes. For example, (1/√2)|0⟩ + (1/√2)|1⟩ represents an equal superposition of 0 and 1.
Quantum GateA fundamental operation that acts on one or more qubits to change their quantum state. It is the quantum equivalent of a classical logic gate (like AND, OR, NOT).The Hadamard (H) gate is a common single-qubit gate that takes a qubit in state |0⟩ and puts it into the superposition state (1/√2)|0⟩ + (1/√2)|1⟩.
Quantum CircuitA model for quantum computation consisting of a sequen...
3
Core Syntax & Patterns
Single-Qubit Gate Application
|ψ'⟩ = U|ψ⟩
To find the new state of a qubit, |ψ'⟩, you multiply its current state vector, |ψ⟩, by the unitary matrix, U, that represents the quantum gate. This is the core mathematical operation for state transformation.
Circuit Diagram Convention
Time flows from left to right. Each horizontal line represents a single qubit. Gates are symbols placed on these lines.
This universal convention allows anyone to read and understand the sequence of operations in a quantum algorithm. The initial state is on the far left, and the final state (or measurement) is on the far right.
CNOT (Controlled-NOT) Gate Logic
Flips the target qubit if and only if the control qubit is in the state |1⟩.
The CNOT is a two-qubit gate essential for creat...
4 more steps in this tutorial
Sign up free to access the complete tutorial with worked examples and practice.
Sign Up Free to ContinueSample Practice Questions
Challenging
A student attempts to build a circuit to copy an unknown quantum state |ψ⟩ = α|0⟩ + β|1⟩ onto a second qubit initialized to |0⟩. They use |ψ⟩ as the control for a CNOT gate and the |0⟩ qubit as the target. Why does this fail to create an identical copy, |ψ⟩|ψ⟩?
A.The CNOT gate is not reversible.
B.The operation entangles the qubits instead of copying the state, as dictated by the No-Cloning Theorem.
C.The Hadamard gate is required for any copy operation.
D.The target qubit should have been initialized to |1⟩.
Challenging
Which statement best addresses the common pitfall of confusing superposition with classical randomness?
A.Superposition is just a way of saying the qubit is randomly either 0 or 1 before measurement.
B.The state of a qubit in superposition is a deterministic, well-defined vector; randomness only manifests upon measurement.
C.qubit in superposition will always collapse to 0 if measured quickly enough.
D.Randomness and superposition are identical concepts in quantum mechanics.
Challenging
A two-qubit state is written in ket notation as |10⟩. Which tensor product correctly represents this state, addressing the common pitfall of incorrect order?
A.|0⟩ ⊗ |1⟩
B.|1⟩ ⊗ |0⟩
C.It is not possible to represent this with a tensor product.
D.0.5 * (|1⟩ ⊗ |0⟩) + 0.5 * (|0⟩ ⊗ |1⟩)
Want to practice and check your answers?
Sign up to access all questions with instant feedback, explanations, and progress tracking.
Start Practicing Free