← Back to all projects

LEARN QUANTUM COMPUTING BASICS

Learn Quantum Computing: From Qubits to Quantum Circuits

Goal: To understand the fundamental principles of quantum computing—superposition, entanglement, and interference—and to learn how to build and run basic quantum algorithms using Python and the Qiskit framework.


Why Quantum Computing?

First, it’s important to understand what quantum computers are not. They are not “super-fast” classical computers that will make your web browser or video games run faster. Instead, they are a fundamentally new type of processor that operates on the principles of quantum mechanics. This allows them to solve specific types of problems that are intractable for even the most powerful classical supercomputers.

Classical Bit vs. Quantum Bit (Qubit)

  • A classical bit is a transistor, either a 0 or a 1. It’s a simple switch.
  • A qubit is a quantum system (like an electron’s spin or a photon’s polarization) that can exist in a superposition of 0⟩ and 1⟩. Think of it not as a switch, but as a dimmer knob that can be at any position, and when you “look” at it (measure it), it snaps to either 0 or 1 with a certain probability.

What are they good for?

  1. Quantum Simulation: Simulating molecules for drug discovery or designing new materials. Nature is quantum, so a quantum computer is the natural tool to simulate it.
  2. Optimization: Solving complex optimization problems in logistics, finance, and machine learning.
  3. Cryptography: Shor’s Algorithm can break most modern encryption. Conversely, quantum principles can be used to create perfectly secure communication channels.

You learn quantum computing to understand this next frontier of computation and to be ready to solve these kinds of problems.


Core Concept Analysis

The Three Pillars of Quantum Power

  1. Superposition: A qubit can be both 0⟩ and 1⟩ at the same time. Represented by a state vector α|0⟩ + β|1⟩, where α and β are complex numbers called amplitudes, and |α|² + |β|² = 1. |α|² is the probability of measuring 0, and |β|² is the probability of measuring 1. The Hadamard gate (H) is the key tool for creating superposition.
  2. Entanglement: “Spooky action at a distance.” Two or more qubits can be linked in such a way that their fates are intertwined, no matter how far apart they are. If you measure one, you instantly know the state of the other. This is a crucial resource that allows for complex correlations. The Controlled-NOT gate (CNOT) is the primary tool for creating entanglement.

  3. Interference: The amplitudes of a qubit’s state can interfere with each other, either constructively (increasing the probability of a certain outcome) or destructively (decreasing it). Quantum algorithms are designed to choreograph this interference so that the probability of the wrong answers cancels out, while the probability of the right answer is amplified.

Quantum Circuits

A quantum program is a circuit. You start with qubits in a default state ( 0⟩), apply a sequence of quantum gates to manipulate their states and create entanglement, and finally, measure them to get a classical bit string as the result.
        ┌───┐      ┌───┐
q_0: |0⟩─┤ H ├──■──┤ M ╞═══ c_0
        └───┘┌─┴─┐└───┘
q_1: |0⟩─────┤ X ├───┤ M ╞═══ c_1
             └───┘   └───┘

This circuit creates an entangled Bell state. H is a Hadamard gate, is the control of a CNOT, X is the target, and M is a measurement.


Project List

We will use Python with IBM’s Qiskit, a powerful open-source framework for quantum computing. The projects will be run on a local simulator, and you can even run them on real IBM quantum hardware for free via the cloud.


Project 1: The Quantum Coin Flip - Superposition and Measurement

  • File: LEARN_QUANTUM_COMPUTING_BASICS.md
  • Main Programming Language: Python with Qiskit
  • Alternative Programming Languages: N/A (frameworks like Cirq or Q# exist, but Qiskit is best for beginners)
  • Coolness Level: Level 3: Genuinely Clever
  • Business Potential: 1. The “Resume Gold”
  • Difficulty: Level 1: Beginner
  • Knowledge Area: Quantum Computing / Qiskit Basics
  • Software or Tool: Qiskit, Jupyter Notebook
  • Main Book: The Qiskit Textbook - Introduction

What you’ll build: A simple one-qubit quantum circuit that acts like a perfect quantum coin flip. You will put a qubit into superposition, measure it thousands of times, and plot a histogram of the results to see the 50/50 probability distribution.

Why it teaches the fundamentals: This project is the “Hello, World!” of quantum computing. It forces you to learn the basic workflow: initialize a circuit, apply a gate, measure, and execute. You’ll directly confront the probabilistic nature of quantum mechanics and see superposition in action.

Core challenges you’ll face:

  • Installing Qiskit and setting up your environment → maps to getting a working quantum development setup
  • Building a QuantumCircuit object → maps to learning the basic structure of a Qiskit program
  • Applying a Hadamard (H) gate → maps to understanding how to create superposition
  • Simulating and visualizing results → maps to using a Qiskit Sampler and plotting a histogram

Key Concepts:

  • The Qubit: Qiskit Textbook - Chapter 1.2
  • The Bloch Sphere: A way to visualize the state of a single qubit.
  • Quantum Gates: Qiskit Textbook - Chapter 1.3

Difficulty: Beginner Time estimate: Weekend Prerequisites: Basic Python.

Real world outcome: A histogram plot showing two bars of roughly equal height at ‘0’ and ‘1’, proving that your quantum circuit is producing random results, just as predicted by the theory of superposition.

Implementation Hints:

  1. Import Qiskit: from qiskit import QuantumCircuit and from qiskit.primitives import Sampler.
  2. Create a circuit: circuit = QuantumCircuit(1, 1) creates a circuit with one quantum bit and one classical bit for the measurement result.
  3. Apply the Hadamard gate: circuit.h(0) applies the H-gate to the first qubit (at index 0). This puts the qubit, which starts as 0⟩, into the state (|0⟩ + |1⟩) / sqrt(2).
  4. Measure: circuit.measure(0, 0) measures the first qubit and stores the classical result in the first classical bit.
  5. Draw the circuit: Use circuit.draw('mpl') to see a nice visual representation of your circuit.
  6. Run the simulation:
    sampler = Sampler()
    # shots is the number of times to run the circuit
    job = sampler.run(circuit, shots=1024)
    result = job.result()
    # The distribution is in quasi_dists
    dist = result.quasi_dists[0]
    
  7. Plot the results: Use from qiskit.visualization import plot_histogram and call plot_histogram(dist).

Learning milestones:

  1. You successfully run a Qiskit job → You understand the basic Qiskit workflow.
  2. You can draw and explain your one-qubit circuit → You understand the circuit model of computation.
  3. Your histogram shows a near 50/50 distribution → You have witnessed quantum probability in action.
  4. You can visualize the qubit state on the Bloch Sphere (using plot_bloch_multivector) → You have a mental model for the state of a single qubit.

Project 2: Spooky Action - Creating an Entangled Bell State

  • File: LEARN_QUANTUM_COMPUTING_BASICS.md
  • Main Programming Language: Python with Qiskit
  • Alternative Programming Languages: N/A
  • Coolness Level: Level 4: Hardcore Tech Flex
  • Business Potential: 1. The “Resume Gold”
  • Difficulty: Level 2: Intermediate
  • Knowledge Area: Quantum Computing / Entanglement
  • Software or Tool: Qiskit
  • Main Book: Qiskit Textbook - Multiple Qubits and Entangled States

What you’ll build: A two-qubit circuit that generates one of the four Bell states—a maximally entangled state. When you measure the qubits, you’ll find that their results are perfectly correlated, even though each individual qubit’s result is random.

Why it teaches entanglement: This project lets you create and prove the existence of entanglement, the most powerful and non-classical resource in quantum computing. You’ll learn how a CNOT gate, when combined with superposition, creates this “spooky action at a distance.”

Core challenges you’ll face:

  • Working with a multi-qubit circuit → maps to understanding how to address different qubits
  • Applying a CNOT (Controlled-NOT) gate → maps to learning the most important two-qubit gate
  • Interpreting multi-qubit measurement results → maps to understanding output bitstrings like ‘00’, ‘01’, ‘10’, ‘11’
  • Proving correlation → maps to observing that you only get ‘00’ and ‘11’ as results, never ‘01’ or ‘10’

Key Concepts:

  • CNOT Gate: Flips the target qubit if and only if the control qubit is 1⟩.
  • Bell State: The state (|00⟩ + |11⟩) / sqrt(2).

Difficulty: Intermediate Time estimate: Weekend Prerequisites: Project 1.

Real world outcome: A histogram plot showing results for ‘00’ and ‘11’, each with approximately 50% probability, and zero results for ‘01’ and ‘10’. This is experimental proof that your two qubits are entangled; their fates are linked.

Implementation Hints:

  1. Create a two-qubit circuit: circuit = QuantumCircuit(2, 2).
  2. Create superposition on the first qubit: circuit.h(0). The state of the system is now (|00⟩ + |10⟩) / sqrt(2).
  3. Apply the CNOT gate: circuit.cx(0, 1). The control qubit is 0, the target is 1.
    • When the control q_0 is 0⟩, nothing happens to q_1. The |00⟩ part of the state stays |00⟩.
    • When the control q_0 is 1⟩, the target q_1 is flipped (X-gate). The |10⟩ part of the state becomes |11⟩.
    • The final state is (|00⟩ + |11⟩) / sqrt(2)—a Bell state!
  4. Measure both qubits: circuit.measure([0, 1], [0, 1]).
  5. Simulate and plot: Run the circuit for ~1000 shots and use plot_histogram. You will only see bars for the ‘00’ and ‘11’ states.

Learning milestones:

  1. You can apply a two-qubit gate in Qiskit → You can create interactions between qubits.
  2. Your circuit diagram correctly shows the CNOT gate → You understand how to represent entanglement visually.
  3. Your histogram shows perfect correlation → You have created and measured an entangled state.
  4. You can explain why the CNOT gate creates entanglement after a Hadamard gate → You understand the underlying mechanism.

Project 3: Deutsch’s Algorithm - The First “Quantum Speedup”

  • File: LEARN_QUANTUM_COMPUTING_BASICS.md
  • Main Programming Language: Python with Qiskit
  • Alternative Programming Languages: N/A
  • Coolness Level: Level 4: Hardcore Tech Flex
  • Business Potential: 1. The “Resume Gold”
  • Difficulty: Level 3: Advanced
  • Knowledge Area: Quantum Algorithms
  • Software or Tool: Qiskit
  • Main Book: Qiskit Textbook - Deutsch-Jozsa Algorithm

What you’ll build: A quantum circuit that implements Deutsch’s algorithm. Given a “black box” function (an oracle) that takes one bit and returns one bit, your circuit will determine if the function is “constant” (returns 0 for all inputs or 1 for all inputs) or “balanced” (returns 0 for one input and 1 for the other) with only one call to the function.

Why it teaches quantum algorithms: This is the simplest example of a true quantum advantage. Classically, you need to call the function twice to determine if it’s constant or balanced. Quantumly, you can do it in one shot by leveraging superposition and interference. It teaches you how to think in terms of “querying in superposition.”

Core challenges you’ll face:

  • Thinking in terms of “oracles” → maps to representing a classical function as a quantum gate
  • Implementing the four possible oracles → maps to using CNOT and X gates to encode the function’s logic
  • Building the full Deutsch algorithm circuit → maps to the H-gate -> Oracle -> H-gate sandwich pattern
  • Interpreting the final measurement → maps to *understanding that measuring 0⟩ means constant, and 1⟩ means balanced*

Key Concepts:

  • Quantum Parallelism: By putting the input qubit in superposition, you are “testing” all possible inputs simultaneously.
  • Phase Kickback: A key trick where the property of a function (encoded in an oracle) is “kicked back” as a phase change onto an auxiliary qubit, which can then be measured.

Difficulty: Advanced Time estimate: 1-2 weeks Prerequisites: Project 2. A solid grasp of the CNOT gate is essential.

Real world outcome: Four different quantum circuits, one for each possible function f(x). When you run the circuits for the two “constant” functions, you will measure ‘0’ 100% of the time. When you run the circuits for the two “balanced” functions, you will measure ‘1’ 100% of the time. You have solved a problem faster than a classical computer could.

Implementation Hints:

  1. General Circuit Structure:
    • Use two qubits. q_0 is the data qubit, q_1 is the auxiliary (ancilla) qubit.
    • Start by putting q_1 into the state |-⟩ by applying X then H gates.
    • Apply H to q_0 to create the input superposition.
    • Apply the Oracle.
    • Apply H to q_0 again.
    • Measure q_0.
  2. The Oracles: The oracle is a two-qubit gate U_f that transforms |x, y⟩ to |x, y ⊕ f(x)⟩, where is XOR.
    • Constant 0 (f(x) = 0): The oracle does nothing (an Identity gate).
    • Constant 1 (f(x) = 1): The oracle flips the ancilla (an X-gate on q_1).
    • Balanced (Identity, f(x) = x): The oracle is a CNOT with q_0 as control and q_1 as target.
    • Balanced (NOT, f(x) = NOT x): The oracle is a CNOT wrapped in X-gates on the control qubit (X; CNOT; X).

Learning milestones:

  1. You can build a quantum circuit representation of a classical function → You understand the oracle concept.
  2. You can build the full Deutsch circuit sandwich → You know the structure of this query algorithm.
  3. Your circuit correctly identifies a “constant” oracle → The interference has worked as planned.
  4. Your circuit correctly identifies a “balanced” oracle → You have successfully demonstrated a quantum speedup.

Project 4: Grover’s Search - Finding a Needle in a Haystack

  • File: LEARN_QUANTUM_COMPUTING_BASICS.md
  • Main Programming Language: Python with Qiskit
  • Alternative Programming Languages: N/A
  • Coolness Level: Level 5: Pure Magic (Super Cool)
  • Business Potential: 1. The “Resume Gold”
  • Difficulty: Level 4: Expert
  • Knowledge Area: Quantum Algorithms
  • Software or Tool: Qiskit
  • Main Book: Qiskit Textbook - Grover’s Algorithm

What you’ll build: A quantum circuit that implements Grover’s search algorithm. You will search an unstructured “database” of 4 or 8 items to find one “marked” item, achieving a quadratic speedup over classical search.

Why it teaches quantum algorithms: Grover’s algorithm is one of the most famous quantum algorithms. It demonstrates the power of “amplitude amplification.” You start with an equal superposition of all possible states and iteratively increase the amplitude of the desired state while decreasing the others.

Core challenges you’ll face:

  • Building the “Oracle” → maps to creating a gate that “marks” the solution by flipping its phase
  • Building the “Grover Diffuser” or “Amplifier” → maps to a clever circuit that reflects all states about the average amplitude, amplifying the marked one
  • Running the correct number of iterations → maps to understanding that the search is probabilistic and requires ~sqrt(N) iterations
  • Searching a multi-qubit register → maps to scaling up from 2 to 3 qubits (4 to 8 items)

Key Concepts:

  • Amplitude Amplification: The core mechanism of the algorithm.
  • Reflection About the Mean: The geometric interpretation of what the diffuser operator does.

Difficulty: Expert Time estimate: 1-2 weeks Prerequisites: Project 3. You need to be comfortable with oracles and multi-qubit circuits.

Real world outcome: After running your circuit, the histogram of results will show a massive peak for the specific state you marked as the “solution” (e.g., ‘101’), with all other states having near-zero probability. You have found the needle in the haystack far faster than classical guessing.

Implementation Hints:

  1. The Oracle: For a solution state |w⟩, the oracle applies a conditional phase shift: |x⟩ -> -|x⟩ if x=w, and |x⟩ -> |x⟩ otherwise. A common way to build this is with a multi-controlled Z-gate that targets the state |w⟩.
  2. The Diffuser: This operator can be constructed as H^(⊗n) -> X^(⊗n) -> (multi-controlled Z) -> X^(⊗n) -> H^(⊗n). It reflects the states around the average.
  3. The Grover Iterate: One “step” of the algorithm consists of applying the Oracle, then applying the Diffuser.
  4. Full Algorithm:
    • Start with qubits in the |0...0⟩ state.
    • Apply Hadamard gates to all qubits to create an equal superposition.
    • Repeat ~π/4 * sqrt(N) times:
      • Apply the Oracle.
      • Apply the Diffuser.
    • Measure all qubits.

Learning milestones:

  1. You can build an oracle that correctly marks one specific state out of 8 → You can encode a search problem into a circuit.
  2. You can build the diffuser operator → You understand the amplification mechanism.
  3. After one iteration, the probability of the marked state increases significantly → You see amplitude amplification in action.
  4. For a 3-qubit search, your final histogram shows a >90% chance of measuring the correct state → You have successfully implemented a cornerstone quantum algorithm.

Project Comparison Table

Project Difficulty Time Core Concept Why it’s Important
The Quantum Coin Flip Level 1: Beginner Weekend Superposition The “Hello, World!” of QC.
Entangled Bell State Level 2: Intermediate Weekend Entanglement Creates the “spooky action” that powers algorithms.
Deutsch’s Algorithm Level 3: Advanced 1-2 weeks Quantum Parallelism The simplest, clearest quantum speedup.
Grover’s Search Level 4: Expert 1-2 weeks Amplitude Amplification A practical and famous algorithm with real speedup.

Recommendation

It is crucial to do these projects in order. Each one builds a necessary concept for the next.

  1. Start with Project 1: The Quantum Coin Flip. You must be comfortable with the basic Qiskit workflow before doing anything else.
  2. Move to Project 2: Entangled Bell State. You cannot understand any quantum algorithm without first understanding how entanglement is created and what it means.
  3. Tackle Project 3: Deutsch’s Algorithm. This will be your first “mind-bending” result and will solidify your understanding of how superposition can be used to gain an advantage.
  4. Finally, take on Project 4: Grover’s Search. This project applies all the previous concepts to implement a truly powerful and famous algorithm.

This path will provide you with a solid, practical foundation in the fundamentals of quantum computing.

Summary

Project Main Programming Language
The Quantum Coin Flip - Superposition and Measurement Python with Qiskit
Spooky Action - Creating an Entangled Bell State Python with Qiskit
Deutsch’s Algorithm - The First “Quantum Speedup” Python with Qiskit
Grover’s Search - Finding a Needle in a Haystack Python with Qiskit