Quantum Computing & Machine Learning Β· Dr. (Mrs.) Ufoma Ophori
Course Material Β· Part A
Introduction to Quantum Computing
A step-by-step, picture-first course β from the very first idea of quantum computing all the way to how it joins hands with machine learning.
Who this is for
This material is written so that anybody can follow it β a 100-level student meeting the idea for the first time, a 400-level student preparing for the practical classes, and the lecturer preparing to teach. No engineering background is needed. If you can use a phone and a laptop, you can follow this course.
How to use this material
π Read in order
The pages on the left-hand menu are arranged like a story. Each page builds on the one before it. Start from Page 1 and move down. Use the Next page button at the bottom of each page.
ποΈ Touch the pictures
Many of the pictures in this course are alive β you can click buttons, drag sliders, and toss coins. Please play with them! You will understand ten times faster by doing than by reading.
βοΈ Answer the quizzes
Every page ends with short Check Yourself questions. Click an answer and it tells you immediately if you are correct, and why. Nothing is hidden; nothing needs the internet.
π¨οΈ Print if you like
This whole material can be printed (Ctrl+P / Cmd+P). The interactive parts become still pictures, but all the text and tables print well as handouts for students.
The journey ahead
A promise
By the end of Part A you will be able to explain quantum computing to someone else in plain English β which is the real test of understanding, and exactly what a teacher needs.
Topic 1
Basic Concepts of Quantum Computing
Before any big grammar, let us build the picture in our heads with things we already know.
Start from the computer you already know
Every computer you have ever used β your phone, your laptop, the ATM β thinks using bits. A bit is the smallest piece of information, and it can only ever be one of two things:
Interactive Β· The light switch (a classical bit)
A classical bit is like a light switch. It is either OFF (0) or ON (1) β never both, never in between. Click the switch.
The bit is 0 (OFF). A classical computer is millions of these switches flipping very fast.
Now the quantum idea β in one sentence
The big idea
A quantum computer uses special switches (called qubits) that, while they are working, can be 0 and 1 at the same time β and only "settle" into one answer when you look at them.
That sounds strange, so here is the everyday picture that carries the whole course:
Interactive Β· The spinning coin (a quantum bit)
A coin lying on the table is Heads OR Tails β like a classical bit. But a coin spinning on the table is, in a real sense, both at once. It only becomes one of them when you slap your hand on it (that is a measurement). Press "Spin" first, then "Slap" β and repeat several times:
H
Lying flat: Heads (1) β not yet spun
Why should anybody care?
Because of a simple mathematics of counting. One spinning coin holds 2 possibilities at once. Two spinning coins hold 4 possibilities at once (HH, HT, TH, TT). Ten coins hold 1,024. The number doubles every time you add one coin.
Interactive Β· The doubling machine
Drag the slider to add qubits and watch how many possibilities the machine can hold at the same time.
3 qubits β 8possibilities at once
At 50 qubits, the machine is holding over a quadrillion possibilities at once β that is a 1 followed by 15 zeros, more than a million times a thousand million. No ordinary computer can line up that many options simultaneously β it would have to check them one after the other. This is the source of quantum computing's power: for certain problems, it explores a huge space of answers in parallel, then uses clever tricks to make the right answer the one you see when you "slap the coin".
Honest truth (important for teaching)
A quantum computer is not simply "a faster computer". It will not open Microsoft Word faster. It is a different kind of computer that is dramatically better at a specific family of problems β searching, simulating molecules, optimisation, and some mathematics behind cryptography. For everything else, your laptop remains champion.
The three words to carry forward
Qubit
The quantum version of a bit. The spinning coin. Covered fully on Page 5.
Superposition
Being in a blend of 0 and 1 at once β the spin itself. Page 6.
Measurement
Slapping the coin. The act of looking, which forces one definite answer out.
β Pause & Think Β· Class discussion
"Who is better β the computer, or the human being?"
When Dr. Ophori β the lecturer of this very course β asked a class this question, every single hand said "the computer β it is faster!" Her reply: "How can you say it is better, when YOU are the one that developed it? You wrote the algorithm. If you remove the human, the computer cannot process anything again. You are the author β it is only the pen." Before we build these powerful quantum machines together, settle this question in your own heart. Turn to the person beside you and argue it out for two minutes.
Alan Turing (1950) opened his famous paper with the question "Can machines think?" β and then argued the question itself was too vague to answer directly. Seventy years later, we still debate it.
Garry Kasparov, world chess champion, lost to IBM's Deep Blue in 1997 β then spent the following decades arguing that human + machine together beat either one alone. He calls it "augmented intelligence", not artificial.
Ada Lovelace (1843), the first programmer, wrote that the machine "can do whatever we know how to order it to perform" β it originates nothing. Turing named this "Lady Lovelace's objection" and took it seriously.
There is no "correct" answer to collect marks on β the thinking itself is the lesson. A student who can defend either side with reasons has already learned more than one who memorises a definition.
Check yourself Β· 1
Q1. A classical bit can be 0 or 1. While a quantum computer is working, what can a qubit be?
β Correct answer: a qubit can be in a superposition β a blend of 0 and 1 at once, like a spinning coin β and only gives one definite answer when measured.
Check yourself Β· 2
Q2. If 3 qubits can hold 8 possibilities at once, how many can 4 qubits hold?
β Each new qubit doubles the possibilities: 2 β 4 β 8 β 16. The pattern is 2βΏ for n qubits. This doubling is called exponential growth, and it is why quantum computers excite scientists.
Topic 2
Definitions of Quantum Computing
One idea, defined at four levels β from the market square to the examination hall. All four are correct; they differ only in formality.
The definitions, written out fully
π£οΈ Level 1 β The everyday definition
"A quantum computer is a new kind of computer that can consider very many possible answers at the same time, instead of checking them one by one."
π Level 2 β The student definition (recommended for class)
"Quantum computing is a type of computing that uses qubits instead of ordinary bits. Because a qubit can exist as a mixture of 0 and 1 at the same time (superposition), a quantum computer can process many possibilities in parallel, which makes it far more powerful than a classical computer for certain kinds of problems."
π¬ Level 3 β The technical definition
"Quantum computing is the use of quantum-mechanical phenomena β superposition, entanglement, and interference β to perform computation. Devices that perform such computation are called quantum computers."
You will not just memorise this definition β you will run every word of it as code: superposition in Lab 1, entanglement in Lab 2, and interference beating a classical computer in Lab 2.5 (Deutsch's algorithm), all in Part B.
π Level 4 β The formal definition
"Quantum computation is a model of computation in which information is stored in quantum states (qubits) and processed by unitary transformations called quantum gates, with results extracted by measurement."
Key terms that live inside the definitions
Term
Plain meaning
Picture to hold
Quantum mechanics
The physics of very small things (atoms, electrons, light particles), where objects behave in surprising ways.
The rulebook nature uses at the smallest scale.
Qubit
Quantum bit β the basic unit of quantum information.
The spinning coin.
Superposition
A qubit being in a blend of 0 and 1 at once.
The spin itself.
Entanglement
Two or more qubits linked so that they behave as one system, even far apart.
Twin coins that always agree.
Interference
Possibilities can add up (louder) or cancel out (silent), like ripples meeting on water. Quantum algorithms use this to cancel wrong answers.
Two ripples meeting on a calm river.
Measurement
Reading the qubit β which forces it to pick 0 or 1.
Slapping the spinning coin flat.
Quantum gate
An operation that changes a qubit's state β the quantum version of AND, OR, NOT.
A hand that flicks or re-spins the coin in a controlled way.
Lock the terms in β play the matching game
Interactive Β· Match the term to its picture (works offline)
Tap a term on the left, then tap the picture that belongs to it on the right. Correct pairs lock in green. Can you clear the board without a single miss?
Teaching tip
When teaching, give students Level 1 first and let them repeat it back in their own words. Only after they own the plain idea should Levels 2 and 3 be introduced. A definition memorised before it is understood is quickly forgotten.
β Pause & Think Β· Class discussion
Can we use something we do not fully understand?
You have just read four definitions of quantum computing. Here is an uncomfortable secret: even the professors who write these definitions admit the deep "why" of quantum mechanics is still mysterious. So β is it honest to build billion-dollar machines on it? Before you answer, think: do you fully understand electricity? Your own brain? Yet you use both every day.
Richard Feynman, Nobel laureate, famously said: "I think I can safely say that nobody understands quantum mechanics." He did not mean the mathematics β that is precise and tested β he meant the deep why underneath it.
The engineers' answer: a working motto in the field was long "shut up and calculate" β the equations predict perfectly, so build with them, and let the philosophy catch up later. Aeroplanes flew before we fully understood turbulence; medicine healed before we understood every cell.
The teachers' answer: a definition is not the end of understanding β it is a handle for carrying an idea while your understanding grows. That is why this course gives you four handles, not one.
Good discussion direction: ask students for other things humanity used before understanding (fire? fermentation? gravity?). Science is not finished knowledge β it is honest work in progress.
Check yourself
Which three quantum phenomena appear in the technical definition of quantum computing?
β The three pillars are superposition (many states at once), entanglement (linked qubits), and interference (cancelling wrong answers, boosting right ones). We will meet each one with its own visual on Page 6.
Topic 3
Historical Development
Not a history lesson β a short relay race. Each runner passed the baton to the next. π Click any event to open its story.
Scientists studying heat, light and atoms found that nature at the smallest scale does not follow everyday rules. Energy comes in packets ("quanta"), particles behave like waves, and a particle can be in a mixture of states. This strange rulebook β quantum mechanics β became the most accurate theory in all of physics. No computers yet; just the raw physics.
1981β82 Β· The spark
Richard Feynman asks the founding question
The famous physicist Richard Feynman observed that ordinary computers struggle badly to simulate molecules and atoms (quantum systems), because the possibilities multiply too fast. His proposal: "Nature isn't classicalβ¦ if you want to simulate nature, you'd better make it quantum mechanical." In other words β build a computer out of quantum parts. This moment is widely taken as the birth of quantum computing. Paul Benioff had also shown, around 1980, that a quantum-mechanical model of a computer was theoretically possible.
1985 Β· The blueprint
David Deutsch defines the universal quantum computer
At Oxford, David Deutsch worked out the mathematics of a universal quantum computer β a machine that could, in principle, perform any computation. This gave the field its formal foundation, the quantum version of what Alan Turing did for classical computing.
1994 Β· The alarm bell
Peter Shor's algorithm threatens world cryptography
Peter Shor (AT&T Bell Labs) discovered a quantum algorithm that could factor huge numbers exponentially faster than any known classical method. Why it mattered: internet security (RSA encryption, used by banks everywhere) depends on factoring being hard. Suddenly governments and companies worldwide started funding quantum computing seriously. This single algorithm turned a physics curiosity into a global race.
1996 Β· The search trick
Lov Grover's search algorithm
Grover showed a quantum computer can search an unsorted list of N items in roughly βN steps instead of N. Searching 1,000,000 items takes about 1,000 quantum steps. A second major proof that quantum machines beat classical ones on real tasks.
1998β2010s Β· First baby hardware
From 2 qubits in a lab to working chips
The first tiny quantum computers (2β7 qubits) were demonstrated using molecules and trapped atoms. In 1999β2011, companies entered: D-Wave sold the first commercial quantum annealer in 2011 (a specialist optimisation machine β fully explained on the next page), and superconducting qubit chips (the technology IBM and Google use today) matured rapidly.
2016 Β· Quantum for everybody
IBM puts a quantum computer on the internet
IBM launched the IBM Quantum Experience β free access to a real quantum computer over the cloud, and later the open-source Qiskit Python library. This is the single most important event for this course: it means our students in Nigeria can run programs on a real quantum computer in America using only a laptop and internet. The practical part of this course (Part B) is built on Qiskit.
2019 Β· The milestone
Google claims "quantum supremacy"
Google's 53-qubit Sycamore chip performed a (very specialised) sampling task in about 200 seconds that they argued would take the best supercomputer thousands of years. IBM disputed the exact numbers, but the moment stands as the first public claim that a quantum machine did something practically impossible classically. The term for this is quantum supremacy (also called quantum advantage) β defined fully on Page 6.
2020s β today Β· The engineering era
Bigger chips, fewer errors, early usefulness
IBM crossed 1,000+ physical qubits (Condor, 2023) and shifted focus to error correction β making qubits reliable, which is today's central challenge. Google's Willow chip (2024) showed errors can be driven down as systems scale, a key milestone. China, the EU, and startups (IonQ, Quantinuum, PsiQuantum, Rigetti) are all racing. We are in the NISQ era β "Noisy Intermediate-Scale Quantum" β machines big enough to be interesting, still too noisy to be perfect.
The story in one paragraph (for exams)
Quantum mechanics was developed in the early 1900s. In 1981β82, Feynman (building on Benioff) proposed computing with quantum systems. Deutsch formalised the universal quantum computer in 1985. Shor (1994) and Grover (1996) provided killer algorithms that proved quantum computers would matter. Hardware followed: first lab qubits (late 1990s), first commercial machine (D-Wave, 2011), cloud access for everyone (IBM, 2016), Google's supremacy experiment (2019), and today's race toward error-corrected machines.
β Pause & Think Β· Class discussion
Einstein doubted quantum mechanics all his life β and his doubt became a gift. Can being "wrong" be valuable in science?
The greatest scientist of the 20th century never accepted that nature is random at the bottom. He fought Bohr about it for decades. And here is the beautiful twist: Einstein's sharpest attack (the 1935 EPR paper) forced physicists to study entanglement so carefully that it became the experiments that won the 2022 Nobel Prize β and the technology inside quantum computers. His doubt built the field he doubted.
Albert Einstein:"God does not play dice with the universe" β his way of saying a true theory should describe reality itself, not just probabilities of what we will see.
Niels Bohr is said to have replied: "Einstein, stop telling God what to do." (A famous anecdote β historians note the exact words are uncertain, a good lesson in checking sources!) Bohr held that you cannot separate reality from the act of measuring it.
The verdict of experiment: Bell's theorem (1964) turned the philosophy into a measurable test; Aspect, Clauser and Zeilinger ran the tests β nature sided with Bohr. The dice are real. Yet Einstein's questions sharpened the field more than easy agreement ever could.
For the classroom: ask students when a respectful disagreement last taught them something. Science moves forward on good questions, not just right answers β a student who disagrees with the lecturer and gives reasons should be celebrated, not silenced.
Check yourself Β· 1
Who is generally credited with proposing the idea of a quantum computer in 1981β82?
β Feynman proposed simulating nature with quantum machines; Benioff had shown it was theoretically possible. Shor came later (1994) with the factoring algorithm; Turing founded classical computing theory.
Check yourself Β· 2
Why did Shor's 1994 algorithm cause governments to take quantum computing seriously?
β Shor's algorithm factors large numbers quickly β and internet security (RSA) depends on factoring being slow. The threat to cryptography unlocked massive funding worldwide.
Topic 4
Examples of Quantum Computers
Real machines exist today. They differ mainly in what they build their qubits out of β and each choice has a trade-off.
The key insight
A qubit can be made from anything that obeys quantum rules and has two states we can control: a tiny superconducting circuit, a single trapped atom, a particle of light, an electron's spin. Different companies bet on different materials β like different car makers betting on petrol, diesel, or electric.
π§ Superconducting qubits β IBM & Google
Machines: IBM Quantum (Eagle 127 qubits, Osprey 433, Condor 1,121; now the Heron series), Google Sycamore (53) and Willow (105).
How: Tiny electric circuits cooled to about β273 Β°C (colder than outer space) so current flows without resistance and behaves quantum-mechanically.
Fast gatesEasy to manufacture like chipsNeeds giant fridgeShort memory (microseconds)
βοΈ Trapped-ion qubits β IonQ & Quantinuum
Machines: IonQ Forte, Quantinuum H2.
How: Individual charged atoms (ions) held floating in a vacuum by electric fields, controlled with laser beams. Each atom is one qubit.
Very accurateLong memoryIdentical qubits (atoms are perfect)Slower gatesHard to scale to thousands
π‘ Photonic qubits β PsiQuantum & Xanadu
Machines: Xanadu Borealis; PsiQuantum (building toward a million qubits).
How: Particles of light (photons) carry the quantum information through optical chips.
Works at room temperatureLight travels β good for quantum networksPhotons are hard to make interact
π§² Quantum annealers β D-Wave
Machines: D-Wave Advantage (5,000+ qubits β but a different, weaker kind).
How: Not a general-purpose quantum computer. It is a specialist machine that only solves optimisation problems (finding the best arrangement β e.g., cheapest delivery routes, best schedule).
Available commercially since 2011Many qubitsOnly one problem typeCannot run Shor/Grover
Comparing them at a glance
Technology
Who
Qubit made from
Temperature
Main strength
Main weakness
Superconducting
IBM, Google, Rigetti
Tiny cold electric circuit
β β273 Β°C
Fast, chip-like manufacturing
Noisy, giant fridges
Trapped ion
IonQ, Quantinuum
A single floating atom
Room-temp trap (lasers do the work)
Highest accuracy
Slow, hard to scale
Photonic
Xanadu, PsiQuantum
A particle of light
Mostly room temperature
Networking, no fridge
Photons barely interact
Annealer
D-Wave
Superconducting loops
β β273 Β°C
Optimisation problems now
Not general-purpose
Neutral atoms / spin qubits
QuEra, Pasqal, Intel
Uncharged atoms / electrons in silicon
Varies
Promising scaling paths
Younger technology
Test your eye β "Which machine am I?"
Interactive Β· Guess the technology from its clue (works offline)
Each clue describes one of the four machine families above. Tap your answer β then get a fresh clue.
Which one will our students touch?IBM's superconducting machines β because IBM gives free cloud access and the open-source Qiskit Python library. In Part B (practicals), students will write Python on their laptops in Nigeria and run it on a real IBM quantum computer abroad. No fridge required on our side!
Check yourself Β· 1
Why do IBM's and Google's quantum chips need to be cooled to about β273 Β°C?
β Heat is random jiggling β and random jiggling destroys delicate quantum states (we call this decoherence). Near absolute zero, the circuit loses electrical resistance and the qubit's quantum state survives long enough to compute.
Check yourself Β· 2
D-Wave's machines have over 5,000 qubits β far more than IBM's. Why is D-Wave still not "ahead"?
β Qubit count alone doesn't decide power. An annealer's qubits solve one family of problems (optimisation). A universal gate-based machine (IBM, Google, IonQ) can run any quantum algorithm. Lesson for students: always ask what kind of qubits, not just how many.
Topic 5 Β· The building block
Qubits
Everything in quantum computing stands on this one object. Take this page slowly β once qubits are clear, every other topic becomes easy.
One idea only: the LEAN
A bit is a pole lying flat against a wall β fully on the "0" side or fully on the "1" side. Finished. Certain. Nothing more to say.
A qubit is that pole stood up and spinning β and here is this entire page in one sentence: a qubit is a spin that can LEAN. Lean it toward one side, and when you slap it, it falls to that side more often β in exact proportion to the lean. That is the whole idea. Everything below is just this one picture, practiced with your own hands.
Interactive Β· The spinning coin that LEANS β your first real qubit
Drag the slider = set the lean. Slap = one toss. The big numbers on the floor are not decoration β they ARE the answer: a 60% lean means 60 out of every 100 slaps land on "1". That is the whole machine. Play:
"But what MAKES it fall 60/40 β where is the machinery?" There is none hidden. The lean IS the whole story β the same way nothing extra "makes" a leaning pole fall the way it leans. That the fall-shares match the lean exactly is the measured law of nature (physicists call it the Born rule) that every quantum computer stands on. The qubit's secret is not machinery; it is geometry.
What you just learned by playing
One slap tells you almost nothing. Many slaps, counted, reveal the lean. And that counting is exactly how real quantum computers are used every day: run the same circuit hundreds of times (engineers call the runs "shots"), count the results, read the shares. You will do precisely this, with real code, in Part B.
β "It looks like the qubit is learning to match my sliderβ¦" β it is not. Read this slowly once
Nothing in this demo learns. Nothing improves. Nothing changes. You set a lean with the slider. Then you slapped the pole, many times, and counted the falls. A leaning pole falls the way it leans β slap it 10 times and the tally is rough, slap it 1,000 times and the tally clearly shows the lean. The lean stayed the same from the first slap to the last. Only your COUNT grew.
Picture a woman selling puff-puff who drops one in ten on a bad day. Watch her for 10 customers and maybe she drops none β you'd wrongly think she never drops any. Watch her for 500 customers and you will count very close to one-in-ten drops. She did not change. You just watched long enough to see the truth. That is ALL the right chart is doing: watching long enough.
So when IS something actually learning? Learning would be if the pole re-leaned itself after every slap to please you. That never happens here β but machines that genuinely re-adjust themselves after every mistake DO exist, and you will build one in Part B (Lab 6). When you get there, remember this page: counting tosses (here) and a machine re-adjusting itself (there) look similar on a chart, but they are completely different things.
The two particles, side by side
Interactive Β· BIT vs QUBIT β same floor, different physics
Left β the classical bit: a coin lying flat. Certain. Flip it to change it; read it a thousand times β same answer, no damage. Right β the qubit: spinning with a 60% lean. Reading it is an EVENT: one slap, one forced fall, one answer β then it must be re-spun. Try both sides:
stored value: 1 β not read yet
spinning (60% lean) β not slapped yet
β A question from Dr. Ophori's reading β answered
"Some materials say a qubit can be in three states: quantum state 0, quantum state 1, and superposition. But if superposition is 0-and-1, what does 'quantum state of 1' even mean β and what would the computer print?"
A mixture β e.g. {'0': 48, '1': 52} for a fair spin
And the full truth is even richer: between the two poles lie infinitely many blends (every tilt of the arrow below) β "three states" is just the beginner's summary of poles + everything-in-between. In Part B, Lab 1, you will run all three on a real simulator and watch each one print exactly this table.
From the coin to the globe β one small step
In the demo above, your coin could only lean left or right. But a real spinning coin can lean in any direction β toward you, away from you, north-east, anywhere around the circle. Now ask: if I drew a dot for every possible lean β every direction, every amount β what shape would all those dots make? A ball. That ball is the famous Bloch sphere: nothing mysterious, just the map of every lean a qubit can have, with an arrow showing the lean it has right now.
How to read the globe in ten seconds:
Top of the ball = no lean toward "1" at all β always falls "0".
Bottom = fully leaned β always falls "1".
How far DOWN the arrow points = the percentage. Equator = exactly 50/50. That is the same slider you have been dragging all along β just drawn on a map.
Interactive Β· The map of every lean β in 3D
Slider = lean the arrow (watch the percentages follow it, same as the coin). Drag the ball itself = turn the map in your hands.
"But why a whole BALL? A simple dial from 0% to 100% would doβ¦"
Sharp question β and here is the honest answer. For the fall-percentages alone, a dial WOULD do: only how far down the arrow points matters for that. But the direction around the ball (toward you, away, sideways) is a real, physical part of the lean too β it just stays invisible until two leans meet. When they meet, leans pointing the same way around add up, and leans pointing opposite ways around cancel β and that adding-and-cancelling is exactly the interference you will watch wipe out randomness on the next page. So: up-down = the percentages (today's lesson), around = the secret handshake between qubits (next page's lesson). The ball holds both.
What is a qubit physically?
Remember Page 4: anything quantum with two controllable states can be a qubit.
Superconducting circuit (IBM/Google): two energy levels of a cold circuit.
Trapped ion (IonQ): two energy levels of a single atom.
Photon (Xanadu): e.g., two polarisations of light.
Electron spin (Intel): spin-up vs spin-down in silicon.
The mathematics is identical for all of them. That is why we can learn qubits once and program any machine.
The two hard truths about qubits
β οΈ Truth 1 β Measurement destroys the blend
The moment you measure, the superposition collapses to plain 0 or 1 and the extra information is gone. You cannot peek and continue. Algorithms must do all their clever work before measuring.
β οΈ Truth 2 β Qubits are fragile (decoherence)
Heat, vibration, stray radio waves β any disturbance acts like an accidental measurement and ruins the state. This is why machines live in extreme cold and why error correction is the biggest challenge in the field today.
No-cloning (bonus fact students love)
It is physically impossible to copy an unknown qubit. There is no "copy & paste" in quantum! This sounds like a weakness, but it is the foundation of quantum cryptography: a spy cannot copy the message without destroying it β so eavesdropping is always detected.
β Pause & Think Β· Class discussion
Before you measured the qubit, did it HAVE a value β or did your looking create the answer?
You just played with the blend slider and watched measurements collapse. Now sit with the deeper question. Einstein once asked a colleague, walking under the night sky: does the moon exist only when somebody looks at it? For big things like moons, of course it is there. But for a qubit, experiment says the answer genuinely was not there before the measurement. Where, then, does "reality" begin?
Erwin SchrΓΆdinger (1935) pushed the discomfort to its limit with his famous cat: a cat whose fate is tied to a quantum event would be, absurdly, alive-and-dead until observed. He designed the picture to show how strange the theory sounds when scaled up β and it became its most famous teaching tool.
The Copenhagen view (Bohr): physics does not describe what nature is β it describes what we can say about nature. The measurement is part of the story, not an interruption of it.
The many-worlds view (Everett, 1957): nothing collapses β every outcome happens, each in its own branch of reality. Mathematically clean, philosophically breathtaking, and still seriously defended today.
Let students vote on which view they find most believable, then defend their vote. Physicists themselves are split β your students are entering a live debate, not a settled one.
Why do quantum programs run the same circuit many times ("shots") instead of once?
β One shot = one collapsed answer. Hundreds of shots = a histogram showing the real probabilities. You experienced this yourself with the "Measure 100 times" button above.
Topic 6 Β· The three powers
Superposition, Entanglement & Quantum Supremacy
Three terms, one family: the first two are the powers a quantum computer uses; the third is the finish line that proves those powers beat classical machines.
Power 1 β Superposition (the spinning coin, now official)
Real-life anchor
Checking routes for a delivery van through 10 cities: a classical computer tries routes one-by-one. A quantum computer in superposition holds all routes at once, then uses interference to make the bad routes cancel out and the good one stand tall.
The experiment behind it all β the double slit
β A question from Dr. Ophori's reading β answered"The materials talk about electrons and photons behaving one way when observed and another way when not observed. What is that about?" β That is the double-slit experiment, the single most famous experiment in physics. Richard Feynman said it contains "the only mystery" of quantum mechanics. Instead of reading about it β run it yourself, right here.
The setup: a gun fires particles (electrons or photons) one at a time at a wall with two narrow slits. Behind the wall is a screen that records where each particle lands. Common sense says particles are like small stones β they should pile up in two bands, one behind each slit. Watch what actually happens:
Interactive Β· The double-slit experiment β watch a single particle travel
π¬ Fire ONE and watch: with the detector OFF, the particle leaves the gun as a dot, then spreads into a ripple that passes through BOTH slits at once β the two ripples overlap, and it lands as a single dot placed by their meeting pattern. Switch the detector ON and fire again: now it stays a dot, takes ONE slit (the detector flashes), and lands in a plain band. Then use the fast buttons to build the statistics.
Detector OFF. Fire some particles and watch the stripes appearβ¦
πβπ¨ Detector OFF β the mystery
The particles land in many alternating stripes (an interference pattern) β the signature of a wave passing through both slits at once and interfering with itself. Yet each particle arrives as a single dot! Each one travelled as a superposition of "through the left slit" AND "through the right slit" β the spinning coin, in flight.
π Detector ON β the collapse
Place a detector at the slits to see which path each particle takes, and the stripes vanish β just two plain bands, like stones. Knowing the path IS a measurement, and measurement collapses the superposition. Nature behaves differently when the information exists β whether or not any human is looking.
β WHY does it behave like this? β the question every student asks, answered straight
Why stripes when nobody watches? Drop two stones into a calm river and watch the ripples meet: where crest meets crest the water jumps high; where crest meets trough the water cancels flat. An unwatched particle travels exactly like that ripple β one wave of possibilities that passes through both slits and then meets itself on the far side. Where its two halves agree β many landings (a bright stripe). Where they cancel β almost none (a dark gap). The stripes are the meeting-pattern of a particle overlapping itself.
Then why does each particle land as ONE dot? Because travelling and arriving are different acts. It travels as a wave β but the screen is a measurement, a slap: the wave must surrender one definite landing point, chosen with chances set by its own stripes. This is not philosophy β in 1989, physicists in Japan (Tonomura's team) filmed electrons arriving one at a time: each a lone dot, random-lookingβ¦ and after thousands, the stripes stood there, assembled dot by dot. Travels as a wave. Arrives as a particle. Both, honestly.
And why does watching kill the stripes? Here is the answer to give a student slowly: it is not eyes, not minds β it is INFORMATION. The stripes exist only while "went through the top" and "went through the bottom" remain two indistinguishable halves of one spinning possibility β your coin being both faces at once. A detector at the slit makes a permanent record of which path β and two recorded, distinguishable histories can no longer overlap and cancel. The detector's record is a slap delivered at the slit instead of at the screen: the coin is forced to land early, so it flies the rest of the way as a decided little stone β two slits, two plain piles. The universe never cared that someone looked; it cares that anything kept the record.
Why this experiment matters for OUR course
The double slit is superposition + measurement + interference in one picture β the same three ingredients inside every quantum computer. A quantum algorithm is, at heart, a cleverly engineered interference pattern: wrong answers land in the dark stripes, right answers in the bright ones. And one honest correction to popular myth: the "observer" needs no eyes and no consciousness β any physical detector that records the path information collapses the pattern. It is information, not attention, that does it.
Power 2 β Entanglement (the twin coins)
Take two qubits and link them with a special operation. They now form one shared state: measuring one instantly tells you about the other, even if they were separated across the world. Einstein was so uncomfortable with this that he called it "spooky action at a distance" β but experiments (Nobel Prize 2022: Aspect, Clauser, Zeilinger) confirm it is real.
Interactive Β· Entangled twin coins
These two coins are entangled so they always land the same way. Both are spinning (superposition). Measure either one β and watch its distant twin collapse instantly to match.
?
Coin A β Lagos
β
?
Coin B β London
Careful β common misconception
Entanglement does not let us send messages faster than light. The outcome of each measurement is still random β only the correlation is guaranteed. What entanglement does give us: qubits that work as one team, which is what makes multi-qubit algorithms, quantum error correction, and quantum cryptography possible.
How the two powers work together
The finish line β Quantum Supremacy
DefinitionQuantum supremacy (politely: quantum advantage) is the demonstrated moment when a quantum computer performs a task that no classical computer could complete in any practical amount of time.
2019 β Google Sycamore: 53 qubits performed a sampling task in ~200 seconds; Google estimated ~10,000 years for the top supercomputer. IBM argued it could be done in days β but even "days vs 200 seconds" made the point.
Important honesty: the task was artificial, chosen because it suits quantum machines. Supremacy β "quantum computers are now better at everything." The current race is for useful quantum advantage β a real-world problem (chemistry, materials, finance) solved better. That milestone is still being contested today.
β Pause & Think Β· Class discussion
If two particles can stay connected across the whole world, what does "distance" even mean to nature?
You just measured the Lagos coin and watched the London coin obey instantly. Everything in your daily experience says influence needs travel β a letter, a signal, a journey. Entanglement says: not always. Some physicists believe this hints that space itself is not fundamental β that connection is deeper than distance. Others say the correlation is simply how shared quantum states work, nothing mystical. In your own life, you already know relationships that distance cannot weaken. Is nature telling us something similar β or is that reading too much poetry into physics?
Einstein dismissed it as "spooky action at a distance" β surely, he argued, the particles carried hidden instructions all along, like twins who agreed before parting.
John Bell (1964) found the genius test: if hidden instructions existed, measurement statistics must obey a certain limit. Experiments broke the limit. No hidden instructions β the connection is real.
A caution from the physicists: entanglement carries correlation, never messages β so it does not break Einstein's speed limit for information. Nature is spooky, but it is also disciplined.
A lovely class exercise: let two students act out the twin coins at opposite ends of the room, then ask the class to design a way to send a message using only the coins β and discover together why it cannot work.
Check yourself Β· 1
Two entangled qubits are separated β one in Lagos, one in London. The Lagos qubit is measured and gives 1. What do we instantly know?
β Entangled qubits form one shared state β measuring one determines the other's correlated outcome instantly. But note: no usable message travels, because the Lagos result itself was random.
Check yourself Β· 2
Which statement about quantum supremacy is most accurate?
β Supremacy is a one-task milestone (Google claimed it in 2019 with an artificial sampling task). Your laptop is still champion of everyday computing β the race now is for advantage on useful problems.
Topic 7
Difference Between Classical and Quantum Computers
Everything from the previous pages, now arranged side by side β the page to revise from the night before a test.
Frequent β error correction is the central challenge
Results
Deterministic β same input, same output
Probabilistic β run many shots, read the histogram
Best at
Everyday tasks: documents, web, databases, video
Simulation of molecules, optimisation, factoring, (quantum) machine learning
Today's maturity
Decades of refinement, billions of devices
Early era (NISQ) β powerful but noisy prototypes
Watch them race
Interactive Β· The search race (works offline)
A prize is hidden in one of 16 boxes. The classical computer must open boxes one at a time. The quantum computer holds all 16 in superposition, then uses interference waves (ββ16 = 4 of them) to make the prize box stand out. Race them!
The prize has been hidden. Choose a computer.
The partnership, not a war
The future is hybrid: a classical computer handles the everyday work and sends only the hard quantum-friendly piece to a quantum processor β exactly as your laptop today sends heavy graphics work to a GPU. Remember this; it returns on Page 10, because quantum machine learning is built exactly this way.
Check yourself Β· 1
Which task should remain on a classical computer even when quantum computers mature?
β Everyday tasks (documents, web, video) are already handled perfectly and cheaply by classical machines. Quantum computers are specialists for simulation, optimisation and certain mathematics β not replacements.
Check yourself Β· 2
Same quantum circuit, run twice, gives different outputs. Is the computer faulty?
β Probabilistic output is normal quantum behaviour (each measurement collapses the superposition randomly according to the blend). The information lives in the distribution over many shots β the histogram practical in Part B.
Topic 8
Application Areas of Quantum Computing
Where will all this power actually be used? Six big areas β each with a picture you can hold, and a Nigerian angle where it fits naturally.
π 1. Drug discovery & chemistry
Molecules are quantum systems β simulating them is exactly what Feynman said quantum computers were born for. Instead of years of trial-and-error in the lab, researchers could test candidate drugs inside the computer first.
Picture: designing a new malaria or sickle-cell drug by simulating how the molecule binds β before a single test tube is opened.
π 2. Cryptography & security
Two sides of one coin: Shor's algorithm will one day break today's RSA encryption β so banks and governments are already migrating to post-quantum cryptography. Meanwhile, quantum physics itself gives quantum key distribution: communication where eavesdropping is physically detectable (thanks to no-cloning, Page 5).
Picture: every bank's security team, including Nigerian banks, planning their "quantum-safe" migration.
π 3. Optimisation & logistics
Best routes for hundreds of delivery vans in Lagos traffic; optimal scheduling of flights; smartest arrangement of a national power grid. These problems explode combinatorially β perfect targets for quantum optimisation (and today, for D-Wave-style annealers).
π° 4. Finance
Portfolio optimisation (best mix of investments under risk limits), fraud detection, and option pricing via quantum-accelerated simulations. Banks like JPMorgan and Goldman Sachs run active quantum research teams today.
π€ 5. Machine learning & AI
Quantum computers may speed up the heavy linear algebra inside machine learning, and quantum models can explore patterns in data differently from classical ones. This is our destination topic β fully opened on Page 10.
π§ͺ 6. Materials & energy
Designing better batteries, superconductors, and fertilizers. One famous target: nitrogen fixation β nature makes fertilizer at room temperature while our factories (Haber process) burn ~1β2% of the world's energy. Simulating the responsible enzyme could transform agriculture β a direct African food-security interest.
Make it yours β match the problem to its quantum answer
Interactive Β· Nigerian problems, quantum application areas (works offline)
Tap a real problem on the left, then the application area that would attack it on the right.
How close is each application?
Application
Status today
Rough horizon
Optimisation (annealers, hybrid)
Pilot projects running now
Now β near term
Quantum machine learning
Active research, small demos (Qiskit!)
Near β mid term
Chemistry & drug simulation
Small molecules demonstrated
Mid term
Finance models
Bank research teams, prototypes
Mid term
Breaking RSA (Shor at scale)
Needs millions of error-corrected qubits
Long term β but defences must start now
Why Nigerian students should care now
The hardware race may be abroad, but the software, algorithms, and applications are open to everyone with a laptop β Qiskit is free, and IBM's machines are on the cloud. The nations that benefited most from classical computing were not only those who built chips, but those who built software and solutions. Quantum is at that same early doorway today, and this classroom is standing in it.
β Pause & Think Β· Class discussion
Shor's algorithm can one day break the encryption protecting every bank. Should such research have been published at all?
The same discovery funds cancer-drug simulation and threatens your account balance. This is the dual-use dilemma, and it is as old as fire β the knife that cooks dinner can also wound. Peter Shor published openly in 1994. Because he did, the world got a thirty-year head start on building quantum-proof locks. Would secrecy have been safer β or more dangerous?
The case for openness: cryptographers argue security through secrecy always fails β someone else discovers the weakness quietly and exploits it. Publishing Shor's algorithm is why post-quantum cryptography standards already exist before the machines that threaten us do.
The sobering precedent: the physicists of the 1940s watched their beautiful equations become weapons, and many spent the rest of their lives on the ethics of it. Science does not get to choose how it is used β but scientists get to speak about it.
The African angle: nations that understand a technology shape its rules; nations that ignore it receive the rules. A Nigerian computer scientist fluent in post-quantum security is not a luxury β she is national infrastructure.
Debate format for class: split into two benches β "publish openly" vs "restrict" β then swap sides halfway. Arguing the side you disagree with is where the deepest learning happens.
Check yourself Β· 1
Which application was quantum computing literally invented for (Feynman, 1981)?
β Feynman's founding argument: quantum systems (like molecules) are impossibly expensive for classical computers to simulate β so simulate them with a quantum machine. Chemistry and materials remain the most natural application.
Check yourself Β· 2
Breaking RSA encryption with Shor's algorithm needs machines far bigger than today's. Why are banks acting already?
β Encrypted data intercepted today can sit in storage until quantum machines can crack it. Anything that must stay secret for 10+ years needs quantum-safe protection now β which is why post-quantum cryptography migration has already begun worldwide.
Topic 9
The Architecture of a Quantum Computer
What is actually inside those golden "chandelier" machines you see in photos? Let us open one up, layer by layer β from a computer-science point of view.
The golden chandelier, explained
That famous golden structure is not the computer β it is mostly the fridge (a dilution refrigerator). Each layer downward is colder, and the actual quantum chip β about the size of a thumbnail β sits at the very bottom at β 0.015 K, colder than outer space. π Click each layer below.
Interactive Β· Inside the machine (click the layers)
The five layers every computer scientist should name
Just as a classical computer has layers (transistor β logic gate β CPU β operating system β application), a quantum computer has a clean layered architecture:
#
Layer
What it is
Classical cousin
1
Physical layer
The qubits themselves + the fridge, lasers, shielding keeping them alive
Transistors on silicon
2
Control layer
Classical electronics firing precise microwave/laser pulses β each pulse is a quantum gate
Clock + control circuitry
3
Gate / circuit layer
Sequences of quantum gates (H, X, CNOTβ¦) arranged into circuits β the quantum "program"
Logic gates β machine code
4
Software layer
Languages & compilers: Qiskit (IBM, Python), Cirq (Google), Q# (Microsoft). Translates your code into pulse schedules
OS, compilers, Python
5
Application layer
The actual algorithms: Shor, Grover, chemistry simulation, quantum machine learning
Apps: Word, browsers, ML models
Where our course lives
Our practicals (Part B) live in layers 3, 4 and 5: we design circuits, write them in Qiskit (Python), and build quantum machine learning applications. Layers 1 and 2 belong to physicists and hardware engineers β we only need to understand them, not build them. Exactly as a web developer understands but does not manufacture CPUs.
One job's journey through the machine
Check yourself Β· 1
In the famous photos, the golden "chandelier" structure is mostlyβ¦
β The chandelier is the fridge. Each golden plate is a colder stage, ending near 0.015 K where the small chip lives. Great exam distinction: the computer is tiny; the life-support is enormous.
Check yourself Β· 2
A student writes Qiskit code in Python. Which architecture layers will she work in during our practicals?
β Our work is circuits (layer 3), Qiskit software (layer 4), and QML applications (layer 5). The cloud carries our circuits to IBM's physical machine and returns the histogram β the exact workflow of Part B.
Topic 10 Β· The destination
Quantum and Machine Learning
The two biggest ideas in modern computing, joined. This page bridges everything you have learned into the first topic of the practical course.
First, machine learning in one minute
Machine learning (ML) is teaching a computer by examples instead of by rules. You do not write "if the fruit is yellow and curved, it is a banana" β you show the computer 1,000 photos of bananas and oranges, and it works out the pattern by itself.
1 Β· Data
Examples with answers: photos labelled "banana"/"orange", past house prices, past exam scores.
2 Β· Model
A flexible mathematical machine with adjustable knobs (parameters/weights). A neural network is the most famous model.
3 Β· Training
Show the data, measure the mistakes (loss), nudge the knobs to reduce mistakes, repeat thousands of times. The nudging recipe is backpropagation + gradient descent.
Interactive Β· Watch a machine "learn"
This tiny model must learn to separate β oranges from β bananas by moving a dividing line. Press Train and watch the mistakes (loss) fall step by step β this is the heart of all machine learning.
Now β why bring quantum into it?
Machine learning is, under the bonnet, mountains of linear algebra β multiplying huge grids of numbers (vectors and matrices). And here is the beautiful coincidence:
The deep connection
A quantum computer's natural language is linear algebra. The state of n qubits is a vector in a 2βΏ-dimensional space, and every quantum gate is a matrix multiplying it. So a quantum computer performs certain enormous linear-algebra operations natively, in physics, in one step β operations a classical computer must grind through number by number.
Quantum Machine Learning (QML) β the idea
QML uses quantum computers to do part of the machine-learning work. Today's standard recipe is the hybrid loop β remember the classicalβquantum partnership from Page 7:
The dictionary: every ML idea has a quantum twin
Classical ML concept
Quantum twin
Where you'll meet it in Part B
Input features (numbers)
Data encoding β rotating qubits by angles that represent the data
Quantum circuits practical
Neural network layers
Parameterised quantum circuit β gates with adjustable rotation angles ΞΈ
Quantum neural network in Python
Weights / parameters
The rotation angles ΞΈ
QNN practical
Prediction (output)
Measurement statistics (the histogram!)
Plotting histogram practical
Backpropagation
Parameter-shift rule β run the circuit at shifted angles to find the gradient
Backpropagation practical
Training loop
The hybrid loop in the diagram above
ML algorithms for QC practical
Randomness in data
Quantum probability β e.g., a Hadamard gate = a perfect coin toss
Qiskit coin-tossing practical
Look at that table again
Every practical topic in the course outline β quantum neural networks, backpropagation, quantum circuits, ML algorithms, histograms, Qiskit coin tossing β appears in the right-hand columns. Part A has quietly prepared you for every single one. The coin you spun on Page 1 is the Hadamard gate you will program in Part B.
Honest expectations (important for a teacher)
QML is young. Today's quantum computers are small and noisy; QML has not yet beaten classical ML on big real-world problems. We teach it because the field is being built right now β and our students can be builders, not just users.
The skills transfer. Learning QML forces mastery of linear algebra, probability, Python and ML fundamentals β valuable even outside quantum.
Everything we need is free: Python, Qiskit, and IBM's cloud machines.
One quiet trend to keep in your pocket: the field is drifting toward teams of small models working together β like a committee of wise elders β rather than one giant brain. Hold that picture loosely; it will grow on its own as the course continues.
β Pause & Think Β· Class discussion
When a machine "learns", is it really learning β or only calculating? And is there a difference?
Machine learning borrowed a human word β learning β for a mathematical process of adjusting numbers. The model that recognises a banana has never tasted one, never peeled one, never shared one with a friend. Does it know what a banana is? Now be careful before you laugh β someone may ask the same of a student who memorises definitions for an exam without ever using them. What, truly, is the difference between knowing and performing?
Alan Turing (1950) proposed a practical test: if a machine's answers are indistinguishable from a human's, what grounds remain for denying it thinks? Judge the behaviour, he suggested, since we cannot open the mind.
John Searle (1980) answered with the famous Chinese Room: a man in a room follows rule-books to answer notes in perfect Chinese β without understanding one word. Flawless performance, zero understanding. Searle says all programs are that man.
The teacher's mirror: this ancient debate is also a theory of education. If performance without understanding is not learning for machines, it is not learning for students either β which is exactly why this course makes you build, predict and argue, not just memorise.
Ask the class: how would you PROVE to someone that you understand something, beyond passing a test on it? Their answers will quietly describe good science.
Check yourself Β· 1
In hybrid quantum machine learning, what job does the QUANTUM computer do?
β The quantum processor is the model: encode data β run circuit U(ΞΈ) β measure. The classical computer keeps the data, computes the loss and updates ΞΈ. Partnership, not replacement.
Check yourself Β· 2
Why is a quantum computer naturally suited to machine learning mathematics?
β The deep connection: n qubits live in a 2βΏ-dimensional vector space and every gate is a matrix operation. The heavy linear algebra of ML is the quantum computer's mother tongue.
Check yourself Β· 3
The "Qiskit probability β tossing of a coin" practical connects to which Part A idea?
β The spinning coin from Page 1 becomes real code: one Hadamard gate + one measurement = a true quantum coin toss, and 1,000 shots give the histogram. Theory and practice meet exactly here.
Revision
Final Revision Quiz
Ten questions covering the whole of Part A. Answer all, then check your score at the bottom. Suitable as a class test template.
Question 1
The basic unit of quantum information is theβ¦
β The qubit β which can be made from many physical things (circuits, ions, photons), but mathematically is always the same object.
Question 2
Superposition means a qubitβ¦
β The spinning coin: a weighted blend of both states at once, collapsing to one answer on measurement.
Question 3
n qubits in superposition can represent how many possibilities simultaneously?
β 2βΏ β doubling with every qubit. 10 qubits β 1,024; 50 qubits β over a quadrillion.
Question 4
Who proposed quantum computing in 1981β82, and whose 1994 algorithm made the world take notice?
β A shared state with guaranteed correlation β "spooky action at a distance" β but no faster-than-light messaging, since each individual outcome is random.
Question 7
Reading (measuring) a qubitβ¦
β Measurement collapses the state β hence many "shots" and histograms, and hence no-cloning makes quantum cryptography possible.
Question 8
Which is NOT a leading application area of quantum computing?
β Quantum computers are specialists β everyday tasks like opening Word stay with classical machines forever (and that's fine).
Question 9
In the five-layer architecture, Qiskit (Python) lives in theβ¦
β Physical β Control β Circuit β Software (Qiskit) β Application. Our course works in layers 3β5 via the cloud.
Question 10
In hybrid quantum machine learning, the quantum computer plays the role of theβ¦
β Quantum = the model (encode β circuit U(ΞΈ) β measure). Classical = data, loss, and knob-updating. The loop between them is the whole of Part B.
Your score
0 / 10
Answer the questions above β your score updates automatically.
β Pause & Think Β· The closing question
The computing revolution made some nations rich twice β once for building chips, once for building software. Quantum is at that same doorway. Where should Africa stand?
The fridges and chips may be built abroad β but Qiskit is free, the cloud is open, and the algorithms are unwritten. The nations that won the internet era were not only the chip-makers: they were the ones whose young people built solutions. You, reading this in Nigeria, have the same access to IBM's quantum computers as a student in New York β this very material proves it. So the honest question is not "can we participate?" It is: what will you build?
The leapfrog lesson: Africa largely skipped landlines and jumped straight to mobile β and built M-Pesa, mobile banking the West later copied. Technologies in their early days reward newcomers who solve their own problems with them.
Feynman's blackboard (1988): at his death, his blackboard read "What I cannot create, I do not understand." Creation is the deepest test of knowledge β and the invitation of this entire course.
Dr. Ophori's classroom principle: the human is the author; the computer is the pen. Quantum computers will be the most powerful pens ever made β and pens do not choose what gets written.
Close the class with this: each student writes one sentence β "If I had a quantum computer, the Nigerian problem I would point it at is ______." Collect them. That page is a research agenda.
What comes next β Part B
With Part A complete, the class is ready for the practical series: 1. Quantum & machine learning (deepened) Β· 2. Implementing a quantum neural network in Python Β· 3. Backpropagation Β· 4. Quantum circuits Β· 5. ML algorithms for quantum computing Β· 6. Plotting histograms Β· 7. Qiskit probability β tossing of a coin. Every one of them plugs directly into a concept from this material.
Part B Β· Practical Course
Practical Quantum Computing & Machine Learning
Nine hands-on labs. Everything you need is inside this one page β the Python engine, the quantum simulator, the exercises. No VS Code. No Jupyter. A phone with Chrome is enough to follow along.
Before you start
Part A (the introduction material) explained what qubits, superposition, entanglement and the hybrid quantumβML loop are. Part B is where we touch them with our hands. If any concept feels foggy, revisit its Part A page β every lab tells you which one.
Step 1 β Install the Python engine (one click)
This page carries a complete Python scientific engine that runs inside your browser. Click the button once; it downloads the engine (about 10 MB, one time only β afterwards your browser remembers it). Then every lab's code runs live, right here.
βοΈ Quantum Lab Engine
Engine not installed yet. The visual demos in every lab work WITHOUT it β the engine is for running real Python code.
If you are on a slow connection, you can do the whole course with the visual demos first and install the engine later.
No internet? No problem
Every single lab also contains visual simulators built directly into this page (no download needed at all). The Python engine is the icing β the cake works offline.
Step 2 β Know the toolbox (names you will hear in industry)
Tool
What it is
In this course
Python
The programming language of science and ML
Embedded in this page β runs live
Qiskit
IBM's open-source quantum library for Python
We use a built-in mini version with the same commands; full Qiskit code is given for the real machine
Simulator
Classical software that imitates a small quantum computer perfectly
Built into this page (up to 8 qubits)
IBM Quantum cloud
Free access to real quantum hardware
Optional final step β the same code runs there
Jupyter / VS Code
Traditional tools for writing Python
Not required β but your skills transfer there directly
Step 3 β The syllabus map
The official course outline, and the lab where each topic is treated:
Official outline topic
Covered in
Simple quantum program Β· quantum vs classical environment
Lab 1 (orientation, as taught by Dr. Ophori)
Quantum circuits
Lab 2
Qiskit probability β tossing of a coin
Lab 3
Plotting histogram
Lab 4
Quantum and machine learning
Lab 5
Backpropagation
Lab 6 (with toggleable techniques)
Implement quantum neural network in Python
Lab 7
Machine learning algorithms for quantum computing
Lab 8
Machine learning example with Python
Labs 5β7 + Capstone
The order is slightly rearranged from the outline so each lab stands on the one before it β the standard sequence used by IBM's own Qiskit textbook: circuits before histograms, histograms before ML, ML before quantum neural networks.
Warm-up check
What do you need installed on your computer or phone before starting these labs?
β The whole lab lives in this page. Visual simulators need nothing; live Python needs one click. (And nobody needs their own quantum computer β even IBM's engineers use simulators daily.)
Lab 1 Β· Orientation
Your First Quantum Program
Exactly as done on the first day in a real laboratory: meet the environment, run one classical program, run one quantum program, and see the difference with your own eyes.
1.1 β The classical program (the world you know)
In classical Python, a bit is just a variable. It is 0 or 1 β decided the moment you write it, the same every time you run it.
π classical_bit.py
Press βΆ Run (install the engine on Page 0 first).
1.2 β The quantum program (the new world)
Now the same idea, written for a quantum computer. We take one qubit, apply a Hadamard gate (h) β the instruction that "spins the coin" into superposition β and measure it. Watch what happens when we run it several times:
Press βΆ Run β then press it AGAIN and compare. The results change!
Stop and look at what just happened
The classical program prints the same answer forever. The quantum program gives a different random answer each run β because until measurement, the qubit was genuinely 0-and-1 at once (the spinning coin from Part A, Page 1). You have just witnessed superposition and collapse in code.
1.2b β The three faces of one qubit (a lecturer's question, answered in code)
β The question"Materials say a qubit has three states β quantum state 0, quantum state 1, and superposition. If the qubit is in 'quantum state 1', what exactly will the computer print?" β Let the machine itself answer. The program below prepares a qubit in each of the three textbook states and measures each one 100 times.
A simulator here; a real IBM machine via the cloud
1.4 β Watch the two programs RUN (animated, no engine needed)
Here is the same comparison as a moving picture. Watch the dot travel through each program. In the classical lane it follows one road. In the quantum lane, the H gate splits it into two ghost-paths at once β and the measure box forces one ghost to become real.
Interactive Β· The program journey
Press a button β run each program several times and compare the endings.
The same experiment, as a still picture
Press each button several times. The classical bit never changes. The quantum bit is re-spun and re-measured each time.
0
classical bit
?
quantum qubit
1.5 β Running on the REAL IBM quantum computer (the full industry path)
Everything in this course runs on simulators β perfect for learning. But the same code can run on IBM's actual quantum hardware, free, from Nigeria. This follows IBM's own official course flow. Three stages:
Create a free account at quantum.ibm.com (IBM Quantum Platform).
Copy your API token from the dashboard (your personal key β keep it private like a password).
On any computer with Python: pip install qiskit qiskit-aer qiskit-ibm-runtime
Stage 2 β The simulator version (what you learned, in full Qiskit)
# Same logic as our labs β industry Qiskit, perfect noiseless simulatorfrom qiskit import QuantumCircuit
from qiskit_aer import AerSimulator
qc = QuantumCircuit(1)
qc.h(0)
qc.measure_all()
qc.draw("mpl") # draws the circuit as a picture β wires and gates, like Lab 2's builder
result = AerSimulator().run(qc, shots=1000).result()
print(result.get_counts())
Stage 3 β The real machine (the goosebumps moment)
# Runs on actual quantum hardware in IBM's lab β same circuit!from qiskit_ibm_runtime import QiskitRuntimeService, SamplerV2 as Sampler
from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager
service = QiskitRuntimeService(channel="ibm_quantum_platform", token="YOUR_TOKEN")
backend = service.least_busy(operational=True) # pick the shortest queueprint("Running on:", backend.name)
# TRANSPILE: translate our circuit into the exact gate-language of that chip
pm = generate_preset_pass_manager(backend=backend, optimization_level=1)
qc_ready = pm.run(qc)
job = Sampler(backend).run([qc_ready], shots=1000)
print(job.result()[0].data.meas.get_counts())
π― What is "transpiling"?
Each real chip only speaks its own small dialect of gates, and its qubits are wired to specific neighbours. The transpiler is a translator: it rewrites your circuit into that chip's dialect and layout β like translating a lesson from English into Yoruba before teaching it in a Yoruba-speaking class. Same meaning, local language.
β³ What to expect from the real machine
A queue β your job waits in line behind researchers worldwide (seconds to hours; least_busy picks the shortest line). And noise β unlike our perfect simulator, a few percent of shots will land on "impossible" outcomes. Seeing that noise with your own eyes is the lesson: you are touching real, imperfect, genuine quantum hardware.
Lab 1 check Β· 3
Before a circuit runs on real IBM hardware, it must be "transpiled". What does that mean?
β Transpiling = translating your ideal circuit into the chip's own gate set and layout, like translating a lesson into the local language before class. The simulator skips this because it speaks every dialect.
Lab 1 check Β· 4
Your Bell-state histogram from the REAL machine shows 00: 478, 11: 489, 01: 18, 10: 15 β but the simulator gave only 00 and 11. Which statement is right?
β Real qubits are noisy (Part A, Page 5): a few percent of shots misfire. Signal 97%, noise 3% β a successful real-hardware run. Learning to see signal through noise is a professional skill.
β Pause & Think Β· Class discussion
You just watched the dice roll. Einstein insisted "God does not play dice" β your own program suggests otherwise. Who do you side with?
Take a breath and notice what happened on this page: the classical program obeyed you completely; the quantum program kept its own counsel until measured. Einstein believed the randomness must be hiding a deeper, deterministic story we have not found yet. Decades of experiments (Nobel Prize 2022) say no β the randomness is genuine, physics at its very floor. You have now run that randomness with your own hand. Does it change how you see the question?
Einstein's hope: hidden variables β the qubit "knew" its answer all along, like a tossed coin whose landing is already determined by physics too fast to see.
Bell & the experimenters: designed and ran tests that hidden variables could never pass. Nature failed the hidden-variable test β the undecidedness is real.
The question students always raise next: if nature is random at the bottom, what happens to fate and free will? Philosophers genuinely disagree β some say randomness rescues freedom, others say random is no more "free" than determined. There is no examiner's answer; there is only good thinking.
Let the class debate for five minutes, then return to the keyboard. Great scientists hold the philosophy in one hand and the working code in the other.
Lab 1 check Β· 1
The classical program prints 0 every time. Why does the quantum program's answer keep changing?
β qc.h(0) creates a 50/50 superposition; measure collapses it. Different runs β independent collapses β different answers. This is physics, not a bug.
Lab 1 check Β· 2
Which line of the quantum program "spins the coin"?
A quantum program is a circuit: qubits drawn as horizontal wires, gates placed along them left to right, measurements at the end. Learn the four gates that carry 90% of this course.
The entangler. Two qubits: flips the target only if the control is 1. H + CNOT together create the entangled twin coins of Part A Page 6.
2.2 β Build circuits with your fingers
Interactive circuit builder (works offline)
1) Tap a gate in the palette. 2) Tap a slot on a wire to place it (for CNOT: tap control slot, then target slot in the same column). The chart shows the measurement results of 1,000 shots, updating live.
How to read a result: read each bitstring right-to-left β the rightmost digit is q0, the next is q1, then q2. So 01 means q0 gave 1 and q1 gave 0. (This right-to-left convention is IBM Qiskit's standard too.)
Palette: tap H, then tap a slot on wire q0.
2.3 β Three classic circuits to reproduce
The coin: H on q0 β histogram shows ~50% 0, ~50% 1.
The certain flip: X on q0 β 100% 1. Deterministic β gates are not always random!
The Bell state (entanglement!): H on q0, then CNOT (control q0, target q1) β only 00 and 11 appear, ~50% each. 01 and 10never occur: the qubits always agree. You have just built the twin coins.
2.4 β The same circuits in code
βοΈ bell_state.py β create entanglement
Press βΆ Run.
Reading a result like a pro{'00': 503, '11': 497} means: out of 1,000 shots, 503 times both qubits gave 0, 497 times both gave 1 β and no shot ever disagreed. On a real machine you would also see a few 01/10 counts: that is noise, today's great engineering battle (Part A, Page 5).
β Pause & Think Β· Class discussion
You just built entanglement with two taps. Einstein wrestled with it for twenty years. Does building something mean you understand it?
Feel the strangeness of this moment: a mystery that troubled the greatest physicist of the 20th century now sits on your phone screen, built by your own fingers in two gates. But be honest with yourself β can you explain why the coins always agree, or did you only follow the recipe? Both are respectable places to stand. The question is which one you are standing in.
Richard Feynman's blackboard, left at his death in 1988: "What I cannot create, I do not understand." For Feynman, building was the royal road to understanding β which is the entire philosophy of these labs.
The counter-view: a child can strike a match without understanding combustion; billions use phones without understanding radio. Creation from a recipe is not yet understanding β understanding begins when you can predict what happens if you change the recipe.
The resolution this course takes: build first, then break. That is why every lab asks you to change a number, re-run, and predict before you look. Prediction is where recipe-following becomes understanding.
Challenge for the class right now: BEFORE trying it, predict what the histogram shows if you put the H gate on q1 instead of q0, keeping CNOT from q0 to q1. Write the prediction down β then build it above and check. That feeling of being right (or wrong!) is understanding being born.
2.5 β The third power, finally in your hands: INTERFERENCE
Part A's technical definition promised three powers: superposition (you ran it β H gate), entanglement (you ran it β the Bell state), and interferenceβ¦ which until now you only read about. Time to close that gap β because interference is where quantum computing's speed actually comes from.
Step 1 β Interference made visible in two gates
Common sense says: spin the coin twice and it is doubly random. Watch what actually happens:
βοΈ interference.py β randomness that cancels itself
Press βΆ Run β and watch randomness annihilate itself.
Step 2 β Your first true quantum ALGORITHM: Deutsch's (1985)
Now use that engine to beat a classical computer, provably, with your own hands. The game: a sealed machine flips coins by a hidden rule. The rule is either CONSTANT (it gives the same answer no matter what you feed it) or BALANCED (its answer depends on the input). Classically you must try both inputs β two questions, no shortcut exists. Quantumly: feed it a superposition of both inputs at once, let interference recombine the two answers, and read the verdict in one question.
βοΈ deutsch.py β one question where classical needs two
Press βΆ Run β your first algorithm that provably beats classical computing.
The definition, now earned
Part A, Page 2, Level 3 defined quantum computing as "computation using superposition, entanglement and interference to solve certain problems faster." As of this moment you have personally executed all three words of that definition β H (superposition, Lab 1), H+CNOT (entanglement, this lab), and Deutsch's algorithm (interference beating a classical bound, just now). You no longer quote the definition. You have run it.
Lab 2 check Β· 1
You place an X gate on a fresh qubit and measure 1,000 shots. What histogram do you expect?
Which two-gate recipe creates the entangled Bell state?
β H creates superposition on the control; CNOT spreads it onto the target so the two qubits share one state. Result: only 00 and 11, perfectly correlated.
Lab 3 Β· Official outline: "Qiskit probability β tossing of a coin"
Tossing a Coin with Qiskit
The world's simplest quantum program β and secretly the world's only true random coin. Your phone's "random" is a formula pretending; a measured qubit is genuinely undecided until it lands.
3.1 β Why a qubit coin is special
π² Classical "random"
Computers use formulas (pseudo-random generators). With the starting seed, every "toss" can be predicted. Good enough for games β not for cryptography.
βοΈ Quantum random
The outcome of measuring a superposed qubit is not hidden anywhere β it does not exist before the measurement. Physics guarantees unpredictability. Companies sell quantum random-number generators for exactly this reason.
3.2 β One toss, then a thousand
βοΈ coin_toss.py
Press βΆ Run β run it a few times and watch the single toss change while the 1000-toss percentages stay near 50%.
3.3 β A biased coin (your first controlled quantum state)
H always gives 50/50. The RY gate rotates the qubit by any angle you choose β letting you build a coin with any bias. This exact skill β controlling probabilities with rotation angles β is the foundation of quantum machine learning in Labs 5β7.
βοΈ biased_coin.py
Press βΆ Run β then edit 0.80 to another probability and run again!
Visual twin Β· Design-a-coin (works offline)
Drag the angle ΞΈ and toss 1,000 times. You are doing exactly what ry(theta, 0) does.
3.4 β Loops: putting the quantum coin to work
Real programs wrap quantum circuits in ordinary Python loops β run, check, decide, repeat. Here is a playful but honest example: keep tossing the quantum coin until it gives 5 heads in a row, and count how long that takes. (On average it should take about 2β΅ = 32 extra tosses after each failure β watch!)
βοΈ streak_hunter.py β a quantum circuit inside a Python loop
Press βΆ Run several times β compare your numbers with your neighbour's.
Exercise for the class (loops + probability)Task: change the loop to hunt for 3 heads in a row, run it 5 times, and write down the counts. Then hunt for 7 in a row. Question to discuss: why does each extra head roughly double the waiting time? (Hint: Page 1 of Part A β the doubling machine β has been here all along.)
Lab 3 check Β· 1
What makes a quantum coin toss fundamentally different from Python's random.random()?
β Classical randomness is pseudo-random (deterministic formula + seed). Quantum randomness is guaranteed by physics β which is why it matters for security.
Lab 3 check Β· 2
To build a coin that lands heads 25% of the time, you shouldβ¦
β RY(ΞΈ) tilts the Bloch-sphere arrow to any angle β any probability. ΞΈ = 2Β·asin(β0.25) = 60Β°. Controlling probabilities via rotation angles is the exact mechanism quantum ML models use to learn.
Lab 4 Β· Official outline: "Plotting histogram"
Plotting Histograms
The histogram is the face of every quantum result. A quantum computer never hands you "the answer" β it hands you counts, and the histogram is how you read them.
4.1 β Anatomy of a quantum histogram
This is a Bell-state run on a real IBM machine: the tall 00/11 bars are the entanglement signal; the tiny 01/10 bars are hardware noise. Reading signal-vs-noise from a histogram is a core professional skill.
4.2 β Plot your own, in code
βοΈ histogram.py β counts β picture
Press βΆ Run.
In full Qiskit, the same picture is one line: plot_histogram(counts). Keep this for the real machine:
from qiskit.visualization import plot_histogram
plot_histogram(counts) # the official Qiskit chart, same bars you drew above
4.3 β Histogram detective game
Interactive Β· Guess the circuit from its histogram (works offline)
A mystery circuit was run 1,000 times. Study the histogram and deduce which circuit produced it. Science works exactly this way β evidence first, conclusion after.
Lab 4 check
A histogram from a real quantum machine shows bars 00: 480, 11: 490, 01: 15, 10: 15. The best interpretation isβ¦
β Perfect entanglement would give ONLY 00 and 11; the small 01/10 bars (~3%) are hardware noise. Distinguishing signal from noise is exactly what quantum engineers do every day.
Lab 5 Β· Official outline: "Quantum and machine learning" + "ML example with Python"
Quantum & Machine Learning β Hands On
Part A, Page 10 gave you the map. Now we walk the road: train a real machine-learning model in Python, then see precisely where a quantum computer plugs into the loop.
5.1 β Machine learning in 20 lines of real Python
A model that learns to convert Celsius to Fahrenheit from examples only β it is never told the formula. This is the entire soul of ML in one small program:
π learn_temperature.py β a complete ML training loop
Press βΆ Run β watch the loss fall and the formula emerge from nothing.
Name what you just saw β the universal ML loop1. Predict with current parameters β 2. Measure mistakes (loss) β 3. Compute the nudge direction (gradient) β 4. Update parameters β repeat. Every ML system on Earth β from this 20-line script to ChatGPT β runs this identical loop. Memorise it; Labs 6 and 7 reuse it exactly.
5.2 β Where does quantum enter?
Look at the loop again. Steps 2, 3, 4 (loss, gradient, update) are bookkeeping β a classical computer does them happily. Step 1, the model itself, is where we substitute:
Everything else β the loop, the loss, the nudging β stays classical. That is the hybrid architecture, and it is how every serious quantum-ML system is built today (IBM's Qiskit Machine Learning, Google's TensorFlow Quantum, Xanadu's PennyLane).
5.3 β Encoding data into qubits (the bridge skill)
One preparation step first: squeeze every data value into the range 0 to 1 before encoding β for example, divide each Celsius value by the largest one (40 Β°C β 40/40 = 1.0, 25 Β°C β 0.625). Angle encoding expects x between 0 and 1; this squeezing is called normalisation and you will do it in every quantum ML program, including Lab 7 and Part C.
βοΈ encode_data.py β put a number into a qubit
Press βΆ Run β see the data value smoothly control the qubit's behaviour.
β Pause & Think Β· Class discussion
The program just "discovered" F = 1.8C + 32 from examples alone. So β who is better: the machine that found it in seconds, or the human who wrote the loop?
This is Dr. Ophori's question from Part A, and now you can answer it with evidence from your own screen. Yes, the machine found the formula faster than any student would. But look again at the code: a human chose the examples, designed the loss, picked the learning rate, decided what "better" even means. The machine descended the hill β a human built the hill and pointed at the valley. Faster is not the same as better; the pen is not the author.
Ada Lovelace (1843): the machine does "whatever we know how to order it to perform." Every line of the training loop you just ran is such an order β written by a person.
Garry Kasparov, after losing to Deep Blue, championed "centaur chess" β human + machine teams that beat both grandmasters and supercomputers alone. His conclusion: the future belongs to those who partner with machines, not those who compete with them or surrender to them.
The uncomfortable modern twist: today's large AI models surprise even their builders. When a machine does something nobody explicitly ordered, is Lovelace's answer still enough? This question is genuinely open β your generation will answer it.
Re-run the class vote from Part A, Page 1 β "who is better?" β and count hands again. Minds that have changed (in either direction!) should say what changed them. That is education happening out loud.
Lab 5 check Β· 1
In the universal ML loop, which step does the quantum computer take over in hybrid QML?
β Quantum replaces the model (step 1). Loss, gradients and updates stay classical. Loop unchanged β engine swapped.
Lab 5 check Β· 2
Angle encoding puts the data value x into a qubit byβ¦
β ry(xΒ·Ο, 0) β the data literally becomes geometry: the tilt of the Bloch-sphere arrow. The biased coin of Lab 3 was secretly your first data encoder.
Lab 6 Β· Official outline: "Backpropagation"
Backpropagation
The algorithm that teaches neural networks β explained as a hill walk in fog, then placed under your fingers with every technique toggleable.
6.1 β The fog-covered hill
Imagine standing on a hillside in thick fog, needing to reach the valley floor. You cannot see the valley β but you can feel the slope under your feet. Strategy: feel the slope, take a step downhill, repeat. In ML language:
Your position on the hill = the model's parameters (the knobs).
The height = the loss (total mistakes).
The slope under your feet = the gradient.
Backpropagation = the efficient bookkeeping method that computes that slope for every knob at once, by passing the error backwards through the network layer by layer (chain rule of calculus).
The step downhill = the parameter update; the step size = the learning rate.
Choose your level
This lab is taught in three depths. Start at Basic; each level stands on the one before. The lecturer can teach any level to any class β Basic suits 100-level, Advanced suits 400-level and research students.
π’ Level 1 β The ball and the valley (no mathematics)
Forget formulas. Watch a ball released on a hillside: it rolls downhill, settles in the valley, done. That is ALL that training a neural network is β the ball is the model's settings, the height is "how wrong the model is", and the valley floor is the best possible model. Backpropagation is simply the way the ball feels which way is downhill.
Interactive Β· Release the ball (works offline)
The ball starts high on the hill (a bad, untrained model).
Level 1 vocabulary β just three wordsLoss = how high the ball is (how wrong the model is). Gradient = the slope under the ball (which way is downhill). Learning rate = the size of each roll. Say these three aloud and Level 1 is complete.
π‘ Level 2 β The laboratory: every technique under your control
A small neural network (2 inputs β 6 hidden neurons β 1 output) learns to separate two classes of points. Toggle the techniques and watch how each choice changes the learning β this is the experimentation the course outline asks for.
6.3 β Experiments to run (write your observations!)
Learning rate too small: Choose "Too small", train. Observe: it learns β but painfully slowly. The fog-walker is taking baby steps.
Learning rate too large: Choose "Too large". Observe: the loss jumps wildly and may never settle β the walker is leaping across the valley and up the other side.
Momentum vs plain SGD: On "Circle inside ring", compare. Momentum is a ball rolling downhill, gathering speed through flat regions.
Adam: The modern default β momentum plus a self-adjusting step size per knob. Watch how quickly and smoothly it converges.
The XOR lesson: XOR cannot be split by one straight line β the hidden layer must bend the boundary. This famous problem froze neural-network research for years until backpropagation (Rumelhart, Hinton & Williams, 1986) made training hidden layers practical.
π΄ Level 3 β Under the bonnet: the chain rule, and backprop from scratch
Level 2 used the playground's built-in backpropagation. Level 3 removes the cover. The entire algorithm is one idea from calculus β the chain rule: if the loss depends on the output, and the output depends on a weight, then
The one formulaβLoss/βweight = βLoss/βoutput Γ βoutput/βweight
"How much does this weight matter?" = "how much the output matters to the loss" Γ "how much this weight matters to the output". For deep networks the chain just grows longer, multiplying link by link backwards from the loss β hence the name back-propagation. One backward pass computes the slope for every weight at once, which is why training is affordable at all.
π backprop_from_scratch.py β the full algorithm, no libraries, 30 lines
Press βΆ Run β XOR learned with gradients you can read line by line. This is the same algorithm inside ChatGPT, just 100 billion times smaller.
Level 3 exercise
In the code above: (1) change lr to 0.05 and re-run β connect what you see to the playground's "too small" setting; (2) change the hidden layer from 2 neurons to 1 (delete index j=1 everywhere) and watch XOR become unlearnable β the 1986 lesson, reproduced by your own hand.
6.4 β Backpropagation in the quantum world
The quantum twist β parameter-shift rule
A quantum circuit's gradient cannot be found by classical backpropagation β you cannot peek inside a superposition without collapsing it! Instead we use the parameter-shift rule: run the circuit twice, once with the knob shifted up (ΞΈ + Ο/2) and once shifted down (ΞΈ β Ο/2); the gradient is (loss at ΞΈ+Ο/2 β loss at ΞΈβΟ/2) β 2 β two ordinary numbers, subtracted. Simple, exact, and hardware-friendly. You will use it with your own hands in Lab 7.
β Pause & Think Β· Class discussion
Your network reached 100% accuracy. Does it UNDERSTAND the pattern β or is it a man in a room, following rules it cannot read?
In 1980 the philosopher John Searle imagined a man locked in a room, passing out perfect Chinese answers by following rule-books, while understanding not one word of Chinese. Searle's claim: every program, however impressive, is that man. Your trained network separates the classes flawlessly β but its "knowledge" is just numbers that got nudged downhill. Then againβ¦ a sceptic might ask whether your own neurons are doing anything fundamentally different. Careful β this question bites in both directions.
John Searle (1980): perfect performance without understanding is possible β syntax is not semantics; rule-following is not knowing. The room speaks Chinese; nobody in it understands Chinese.
The "systems reply" from Searle's critics: the man doesn't understand Chinese, but perhaps the whole room β man, rule-books and all β does, the way no single neuron in your brain understands English, yet you do.
What the backprop playground adds: you watched learning happen as a purely mechanical process β errors flowing backwards, knobs nudging downhill. Whatever understanding is, you have now seen exactly how much of it can be built from arithmetic alone. Where the arithmetic ends and understanding begins, nobody yet knows.
A gentle classroom move: ask students to describe how THEY knew the XOR pattern needed a curved boundary. Could they write their insight as a rule a machine could follow? The struggle to answer is the lesson.
Lab 6 check Β· 1
In the hill-in-fog picture, what is backpropagation?
β Backprop computes the gradient (the slope) for all parameters in one backward pass using the chain rule. The update that follows (the step) is gradient descent β two partners, often confused.
Lab 6 check Β· 2
Your loss curve is jumping wildly up and down and never settles. The most likely culprit isβ¦
β Classic over-large learning rate. You saw it yourself with the "Too large (1.5)" toggle. First reflex of every ML practitioner when loss explodes: reduce the learning rate.
Lab 6 check Β· 3
Why do quantum circuits need the parameter-shift rule instead of ordinary backpropagation?
β Backprop needs to read intermediate values; measurement destroys quantum states. Parameter shift sidesteps this: evaluate at ΞΈ+Ο/2 and ΞΈβΟ/2, halve the difference β an exact gradient from whole-circuit runs only.
Lab 7 Β· Official outline: "Implement quantum neural network in Python"
Implement a Quantum Neural Network in Python
The summit of the course. Every lab has placed one stone: encoding (Lab 5) + circuits (Lab 2) + histograms (Lab 4) + training loop (Labs 5β6). Today we stack them into a working quantum neural network β and train it.
7.1 β What a QNN actually is
Encoder + trainable rotations + measurement. In research papers this is called a parameterised (variational) quantum circuit β "quantum neural network" is its friendly name, because the rotation angles ΞΈ play exactly the role of weights.
7.2 β The complete QNN, trained live
The task: classify exam scores (scaled 0β1) as fail (0) or pass (1), learning the pass-mark from examples alone. Small β and genuinely complete: every ingredient of published QML research is here.
βοΈ quantum_neural_network.py β the full summit
Press βΆ Run β training takes a few seconds (it is simulating hundreds of quantum circuits!).
Read the output like a researcher
The loss falls step by step β the circuit is learning. The trained ΞΈ shifts the decision point so low scores give P(pass) near 0 and high scores near 1. One trainable knob only β yet the complete architecture of a QNN: this same pattern with 4 qubits and 20 knobs is a publishable variational classifier.
7.3 β Watch the same QNN train, visually
Interactive Β· QNN trainer (works offline)
The curve is the QNN's output P(1) across all inputs; dots are the training data. Press Train and watch the quantum model bend itself to fit the data.
7.4 β Scaling up: the industry version
The same architecture in production Qiskit Machine Learning β notice it is our three blocks with more qubits:
# pip install qiskit qiskit-machine-learningfrom qiskit.circuit.library import ZZFeatureMap, RealAmplitudes
from qiskit_machine_learning.algorithms import VQC
feature_map = ZZFeatureMap(2) # block 1: the encoder (our ry(xΒ·Ο), richer)
ansatz = RealAmplitudes(2, reps=2) # block 2: trainable rotations (our ry(ΞΈ), many)
vqc = VQC(feature_map=feature_map, ansatz=ansatz) # block 3 + training loop built in
vqc.fit(X_train, y_train) # same fit() style as scikit-learn!
Lab 7 check Β· 1
In our QNN, what plays the role that weights play in a classical neural network?
β ΞΈ is the knob the optimiser nudges, exactly as w and b were nudged in Lab 5's temperature model. Weights β angles; everything else in the loop is unchanged.
Lab 7 check Β· 2
The QNN's prediction for one input is obtained byβ¦
β The prediction is a probability read from the histogram β Lab 4's skill powering Lab 7's model. One shot would give a noisy 0-or-1; hundreds of shots reveal P(1).
Lab 8 Β· Official outline: "Machine learning algorithms for quantum computing"
Machine Learning Algorithms for Quantum Computing
You have built one QNN. Now meet the whole family β the standard algorithm toolbox of quantum machine learning, each mapped to what you already know.
8.1 β The four families
1 Β· Variational Quantum Classifier (VQC)
You already built one. Encoder + trainable circuit + measurement, trained by parameter shift. The workhorse of near-term QML. Lab 7's model is a one-qubit VQC.
supervisedruns on today's machines
2 Β· Quantum Kernel Methods (QSVM)
Instead of training a circuit, use the quantum computer as a similarity meter: encode two data points, measure how much their quantum states overlap, feed those similarities into a classical Support Vector Machine. The quantum part maps data into a huge space where tangled classes may separate cleanly.
supervisedquantum + classical SVM
3 Β· Quantum Approximate Optimisation (QAOA)
For optimisation problems β best routes, schedules, portfolios. Writes the problem's cost as energy, then uses a trainable circuit to coax the qubits toward the lowest-energy (= best) answer. Cousin: VQE, the same idea used for molecule energies in chemistry.
optimisationlinks to Part A, Page 8
4 Β· Quantum Sampling & Generative Models
Quantum circuits produce genuinely random samples from very complex distributions (your Lab 3 coin was the simplest case). Used for generative modelling β learning to produce data resembling the training data β and quantum Boltzmann machines.
unsupervisednative quantum strength
8.2 β Taste a quantum kernel (live)
The heart of family 2 in a few lines: a quantum similarity between two numbers β 1.0 for identical points, falling as they separate:
βοΈ quantum_kernel.py β the similarity meter
Press βΆ Run.
8.3 β Choosing the right tool (decision guide)
Your problem
Reach for
Why
Classify labelled data (spam/not, pass/fail)
VQC β or QSVM if the classes are badly tangled
Supervised classifiers; VQC is simplest, kernels handle hard geometry
Find the best arrangement (routes, timetables, portfolios)
QAOA
Optimisation is its native language
Simulate a molecule / material
VQE
Molecules are quantum β the home advantage
Generate realistic samples / model a distribution
Quantum generative models
Sampling is what measurement does naturally
Everyday prediction on big tabular data
Classical ML!
Honesty: today's quantum devices don't beat XGBoost on ordinary data β know when NOT to use the quantum hammer
The honest frontier (teach this!)
Quantum ML has not yet demonstrated clear advantage over classical ML on real-world datasets β the field is searching for the problems where quantum geometry genuinely helps (quantum data, chemistry, specific structures). Students who can state this honestly and build a working VQC are exactly the researchers the field needs. And notice one quiet pattern across this whole table: again and again, a team of small specialists beats one giant generalist β the ensemble idea of classical machine learning, returning at every scale. Keep it; it matters later.
β Pause & Think Β· Class discussion
Quantum computing attracts billions in funding β and some of its own leaders spend their careers warning against the hype. Should a scientist ever oversell to keep the funding flowing?
Here is a tension your generation will live inside. Governments and investors fund what sounds revolutionary; careful scientists know revolutions take decades and might even fail. Oversell, and you betray the truth; undersell, and the laboratory closes. Nigerian science faces this squeeze more sharply than most. Where is the honest line?
John Preskill coined the sober term NISQ β "Noisy Intermediate-Scale Quantum" β precisely to set honest expectations: today's machines are promising, limited, and noisy. Naming the limits honestly strengthened the field's credibility.
Scott Aaronson, called "the conscience of quantum computing", has spent years publicly puncturing exaggerated claims β including the claim that quantum will soon revolutionise machine learning β while still believing deeply in the field. He even grants that quantum computing could, in principle, turn out impossible. Honesty and belief, held together.
Feynman's rule for scientists: the first principle is that you must not fool yourself β and you are the easiest person to fool. A scientist's reputation for honesty is her only permanent asset; funding cycles end, credibility compounds.
Class exercise: each student writes a two-sentence grant pitch for a quantum project β one version "fundable", one version brutally honest β then reads both aloud. Discuss: can the honest one be made exciting WITHOUT lying? (It can. That skill is called science communication.)
Lab 8 check Β· 1
A bank wants the best arrangement of 50 delivery stops. Which quantum algorithm family fits?
β "Best arrangement" = optimisation = QAOA (or an annealer, Part A Page 4). VQC/QSVM are for classification; VQE for chemistry.
Lab 8 check Β· 2
What does a quantum kernel method use the quantum computer for?
β Quantum = similarity meter; classical SVM = decision maker. Your quantum_similarity() function was a genuine quantum kernel.
Capstone
Capstone & Final Quiz
One program that uses every lab at once β then ten questions to certify the journey.
9.1 β The capstone program
Read it first, predict what it will print, then run it. It combines: circuits (L2), the coin (L3), histograms (L4), encoding (L5), parameter-shift training (L6), and a QNN (L7).
βοΈ capstone.py β everything, together
Press βΆ Run.
9.2 β Where to go next (all free)
IBM Quantum Platform β quantum.ibm.com: free account, run your circuits on real hardware.
Qiskit documentation & textbook β the official learning path; your commands here transfer directly.
PennyLane (Xanadu) β the other great QML library, with excellent tutorials.
Class project idea: each student designs a biased coin for a given probability, proves it with a 1,000-shot histogram, and explains the angle mathematics β every skill in one exercise.
β Pause & Think Β· The final discussion
You began this course answering "who is better β computer or human?" You end it having trained a quantum machine with your own hands. Answer it one last time.
Look at what you did in these labs: you commanded superposition, built entanglement, taught a classical network, taught a quantum circuit. At every step, the machine supplied the speed β and you supplied the question, the design, the judgment of right and wrong, the decision of what was worth doing at all. Dr. Ophori's answer stands at the end of the evidence: the human wrote the algorithm. The machine is magnificent β and it is yours. The only remaining question is the one no computer, classical or quantum, can answer for you: what will you point it at?
The whole debate, in one line each: Turing asked if machines can think; Lovelace said they only perform our orders; Searle said performing is not understanding; Kasparov said partner with them; Einstein doubted the dice and his doubt built the field. Every one of them would agree on a single point β the asking of the question is the human part.
Final class ritual: every student states one sentence beginning "With what I now know, I willβ¦" β and the lecturer goes last. Education is complete when the teacher also answers.
The honest status of quantum machine learning today:
β Real algorithms, real hardware, open frontier. Scientists who state limits honestly are the ones trusted to announce the breakthroughs.
Your final score
0 / 10
Answer the questions above β your score updates automatically.
To the student who reached this line
You installed nothing but a browser page β yet you ran quantum circuits, created entanglement, built a true random coin, read histograms like an engineer, trained classical and quantum neural networks, and used the parameter-shift rule from current research papers. You are no longer an outsider to quantum computing. Welcome to the field.
Part C Β· Research Track
The Research Journey β From Stacking to Quantum
Two papers published. A third one waiting β and it sits at a crossroads almost nobody has visited yet. This section turns Dr. Ophori's research instinct into a concrete, publishable plan.
Where the journey stands
β Paper 1 Β· Published
Software cost estimation using stacking (ensemble methods)
Multiple estimation models are trained on past-project data, then a stacking arrangement combines their predictions β a "committee of estimators" whose joint answer beats any single member. This established the classical ML baseline of the research line.
β Paper 2 Β· Published
Smoothing methods to increase the dataset
The deepest problem in software cost estimation is tiny datasets β historical project records number in the dozens, not millions. Paper 2 attacked this directly: data-smoothing / augmentation methods that generate additional realistic training samples, giving the models more to learn from.
β Paper 3 Β· The proposal
Quantum-enhanced software cost estimation on augmented small datasets
The new question: can quantum machine learning β quantum kernels and quantum neural networks β estimate software cost better than classical methods, especially on the small datasets that define this field? Papers 1 and 2 are not left behind: they become the baselines and the fuel of Paper 3.
Why this trilogy fits together perfectly
The core insight (hold this)
Quantum machine learning's best known weakness is that it cannot yet handle big data β circuits are small, encoding is slow. But software cost estimation's defining property is that its datasets are small (often 60β100 projects). The field's weakness and the technology's limitation cancel out. Add Paper 2's augmentation to feed the quantum models richer training data, and the trilogy becomes one coherent research programme β each paper justifying the next.
β Pause & Think Β· Research discussion
A good research programme is a staircase, not a pile of papers. What makes Paper 3 a step UP from Papers 1 and 2 β rather than a jump sideways into fashion?
The danger with hot technologies is "quantum sprinkling" β adding the word quantum to an old study for novelty's sake. The defence is the insight above: a reasoned argument why quantum fits this problem (small data, kernel-friendly features, expensive wrong estimates). If a reviewer asks "why quantum?", the answer must never be "because it is new".
The reviewer's razor (every journal): a method change must be motivated by a property of the problem, not the popularity of the method. Small datasets + kernel methods is exactly such a property-match.
Scott Aaronson's standing warning: claims that quantum will revolutionise machine learning "always warranted skepticism." A paper that measures instead of promises β even if quantum loses! β is publishable and honest. Negative results on a fresh crossroads are contributions too.
Write the answer to "why quantum for cost estimation?" in three sentences, in your own words, before reading further. It will become the heart of your introduction section.
Part C Β· Page 2
Background: Software Cost Estimation
The problem the trilogy serves β stated so plainly that the quantum chapter later will feel inevitable.
The problem
Before a software project starts, someone must answer: how much effort (person-months) and money will this take? Underestimate and the project dies half-built; overestimate and the contract is lost to a cheaper bidder. Estimation error is one of the oldest and most expensive diseases in software engineering β and it is why this research line matters to industry, not just to journals.
The three generations of estimators
Generation
Approach
Example
Limitation
1 Β· Expert judgment
Experienced people guess, structured or not
Delphi method
Subjective, unrepeatable, optimistic
2 Β· Algorithmic models
Fixed mathematical formulas from project size
COCOMO (effort = aΒ·KLOCbΒ·EAF), Function Points
Rigid β calibrated to 1980s projects
3 Β· Machine learning
Learn the sizeβeffort pattern from past projects
These public datasets are the standard battlegrounds β note the sizes:
Dataset
Projects
Typical features
COCOMO81
63
KLOC + 15 cost drivers
Desharnais
81
Team experience, transactions, entities, language
NASA93
93
COCOMO-style drivers, NASA projects
Maxwell
62
Size, application type, 15+ factors
Albrecht
24
Function-point components
ISBSG
1000s (commercial)
Industry-submitted projects, heterogeneous
Sixty-three projects. Twenty-four projects. Modern deep learning eats millions of samples β here it starves. This is why Paper 2 (augmentation) exists, and why a quantum approach designed for small data deserves a hearing.
How estimators are judged (the metrics for Paper 3)
MMRE
Mean Magnitude of Relative Error β average of |actual β predicted| β actual. Lower is better. The traditional headline metric (though known to favour underestimates β report it, but not alone).
PRED(25)
The percentage of projects whose estimate lands within 25% of the true effort. Higher is better. Industry-intuitive: "how often are we close enough?"
MAE / MdAE
Mean / median absolute error in raw person-months. Robust, unbiased, increasingly the reviewer-preferred choice.
SA (Standardised Accuracy)
Improvement over random guessing, as a percentage. Modern best practice β makes results comparable across datasets and studies.
Interactive Β· Feel the metrics (works offline)
A project truly took 40 person-months. Drag the slider to set your model's estimate and watch MRE and the PRED(25) verdict respond β this is exactly how every prediction in Paper 3 will be judged.
Connecting to the course you just took
Everything in Part B reappears here wearing work clothes: the training loop (Lab 5) trains the estimators; angle encoding (Lab 5) will load project features into qubits; the quantum kernel (Lab 8) will measure similarity between projects; and the histograms (Lab 4) will read out every quantum prediction. The course was secretly the methods chapter of Paper 3.
Part C Β· Page 3
The Gap in the Literature
A publishable paper lives or dies on one paragraph: "here is what exists, and here is the hole we fill." This page drafts that paragraph with evidence.
What is already crowded (avoid competing here)
Classical ML for cost estimation: saturated. Regression, neural networks, deep learning (CNN + particle-swarm optimisation appeared in Scientific Reports 2024), neuro-fuzzy models, KNN, ensembles β COCOMO alone has been the test bed of 40+ investigations. A purely classical Paper 3 would fight hundreds of prior results for inches.
Ensembles for estimation: well studied β which is good news: it makes Paper 1 a recognised, citable baseline rather than an obscure one.
Data augmentation for estimation: an active but smaller conversation β Paper 2 already stands in it.
What exists on the quantum side
Quantum regression methods exist and are maturing: quantum support vector regression via quantum kernel estimation (QKE-QSVR, Quantum Information Processing, 2023/24), quantum kernel benchmarking studies (Quantum Machine Intelligence, 2025), and classical-vs-quantum regression comparisons in physics data. The tools are ready β Qiskit Machine Learning ships QSVR and QNN regressors off the shelf.
QML has entered software engineering β but through the other door: published explorations cover defect prediction and vulnerability detection. A 2025 roadmap paper ("Quantum-Based Software Engineering") maps the territory.
Interactive Β· The literature map β find the open ground (works offline)
Tap each research crossroads and see the verdict: π΄ crowded (hundreds of papers), π‘ active (dozens), π’ open ground (none found). A PhD lives on green squares.
The hole
The gap statement (draft for the paper)
"To the best of our knowledge, no published study has applied quantum machine learning β quantum kernel regression or quantum neural networks β to software cost/effort estimation, nor examined the interaction between data augmentation and quantum model performance on the field's characteristically small datasets (COCOMO81, Desharnais, Maxwell, Albrecht). This study fills that gap, benchmarking quantum estimators against a published stacking-ensemble baseline under identical augmentation conditions."
Two honest duties attached to that claim: (1) run a fresh systematic search (Scopus, IEEE Xplore, arXiv β keywords: quantum + effort/cost estimation) in the month before submission, because gaps close fast; (2) if something small has appeared by then, the framing shifts from "first" to "first on augmented data with ensemble baselines" β the augmentationΓquantum interaction is a second, deeper novelty that is very hard to scoop.
Why reviewers will believe quantum belongs here
1 Β· Small data is quantum's arena
Current quantum hardware and simulators handle dozens-to-hundreds of samples comfortably β exactly the size of estimation datasets. Nobody can say "just use deep learning" when there are 63 projects.
2 Β· Kernels are the mature QML tool
Estimation features (size, team experience, complexity drivers) are low-dimensional tabular data β precisely what quantum feature maps encode naturally, one feature per rotation.
3 Β· A published baseline of her own
Comparing against one's own peer-reviewed stacking results (Paper 1) on identical splits is methodologically airtight β no accusations of weak baselines.
4 Β· The augmentation twist is unique
Paper 2's smoothing gives the study a dimension no rushed competitor would have: does augmentation help quantum models more than classical ones? Either answer is a finding.
Part C Β· Page 4
The Proposed Study
Research questions, the experimental pipeline, and a miniature of the quantum method you can run right now.
Research questions
RQ1 β Can quantum estimators (quantum kernel regression / QSVR, and a QNN regressor) match or outperform a published classical stacking ensemble on standard small software-effort datasets?
RQ2 β Does data augmentation (the smoothing methods of Paper 2) improve quantum estimators more, less, or equally compared with classical estimators?
RQ3 β Does a hybrid stack β the Paper 1 ensemble with a quantum model added as one more base learner β outperform both the all-classical stack and the standalone quantum models?
The experimental pipeline
Taste the method β a miniature you can run now
The heart of Arm B in a few lines: estimating a new project's effort by quantum similarity to past projects. (Install the Python engine on Part B's setup page if you haven't.)
βοΈ quantum_cost_estimate.py β Arm B in miniature
Press βΆ Run β your first quantum software-cost estimate.
Expected contributions (the reviewer's checklist)
First benchmark of quantum estimators on standard software-effort datasets, against a published ensemble baseline.
The augmentation Γ quantum interaction β a finding nobody else holds the ingredients for (Paper 2 is hers).
A hybrid quantum-classical stacking architecture for estimation β new in this domain either way the result goes, and aligned with where AI at large is heading: committees of small, diverse models over single giants.
Open artefacts: code, splits and augmented datasets released β reproducibility is a publication accelerant.
Threats to validity (write them before the reviewer does)
Simulator vs hardware: initial results on Qiskit simulators; a small hardware validation run (free IBM tier) answers the inevitable question.
Hyperparameter fairness: equal tuning budgets for classical and quantum arms, or the comparison is theatre.
Small-sample statistics: leave-one-out CV plus non-parametric tests; never a single lucky split.
No overclaiming: if quantum loses, the paper still stands β "quantum estimators do not yet beat tuned classical ensembles on augmented small data" is a citable, honest result (remember Lab 8's discussion).
Part C Β· Page 5
The Paper Skeleton
Everything above, folded into the shape journals expect β ready to grow into a manuscript.
Working titles (pick, mix, refine)
"Quantum Machine Learning for Software Cost Estimation: A Benchmark on Augmented Small Datasets"
"Can Quantum Kernels Estimate Software Effort? An Empirical Study with Ensemble Baselines"
"Quantum-Enhanced Stacking for Software Cost Estimation on Smoothed Small Datasets"
Draft abstract (β150 words β edit freely)
Software cost estimation remains constrained by small historical datasets, limiting the accuracy of machine-learning estimators. Quantum machine learning (QML) offers models whose practical sweet spot is precisely small, low-dimensional tabular data, yet no study has applied QML to effort estimation. We benchmark two quantum approaches β quantum kernel regression and a variational quantum neural network β against a published stacking-ensemble baseline on four standard datasets (COCOMO81, Desharnais, Maxwell, Albrecht), each under two data conditions: raw, and augmented with smoothing-based data generation. We further propose a hybrid architecture that adds a quantum base learner to the classical stack. Across leave-one-out validation with Wilcoxon tests, we report MAE, standardised accuracy, PRED(25) and MMRE. [Results sentence β written last.] We release all code, splits and augmented datasets. Our findings characterise, for the first time, when quantum models help β and when they do not β in software cost estimation.
Section outline
Section
Content
You already haveβ¦
1 Β· Introduction
The estimation problem, the small-data pain, the "why quantum fits" argument, RQ1βRQ3
Pages 2β4 of this Part C
2 Β· Background
Cost estimation models; QML essentials (qubits β kernels β QNN) written for SE readers
The whole course, Parts AβB!
3 Β· Related work
Classical ML for SEE; augmentation for SEE; QML in SE (defect prediction); the gap statement
Page 3 of this Part C
4 Β· Method
The pipeline diagram, four arms, encoding choices, tuning protocol
RQ answers, the augmentationΓquantum interaction, threats to validity
Threats drafted (Page 4)
7 Β· Conclusion
Contributions + the honest frontier
Lab 8's honesty discipline
Target venues
Journals
Quantum Machine Intelligence (Springer β the natural home for the crossroads) Β· Journal of Systems and Software Β· Empirical Software Engineering Β· IEEE Access (faster, broad scope).
Conferences (earlier feedback)
PROMISE (predictive models in SE β the exact community) Β· ESEM (empirical SE) Β· a national/regional CS conference first for friendly review.
A realistic six-step plan (no dates β steps)
Replicate Paper 1's baseline on the four public datasets with frozen splits β Arm A done, confidence built.
Apply Paper 2's augmentation to the same splits β both data conditions ready.
Build Arm B (QSVR) in Qiskit Machine Learning on the simulator β the Lab 8 kernel, industrial grade.
Build Arm C (QNN regressor) β Lab 7's architecture with 2β4 qubits.
Arm D + full evaluation β hybrid stack, all metrics, statistics; small hardware run on IBM's free tier.
Write β the skeleton above, results last; fresh literature sweep the month before submission.
Tools (all free)
Python + scikit-learn (stacking, metrics) Β· Qiskit + Qiskit Machine Learning (QSVR, QNN β pip install qiskit qiskit-machine-learning) Β· the public datasets (PROMISE/SEACRAFT repositories) Β· IBM Quantum free tier for the hardware validation run. Every skill needed was taught in Parts A and B of this very material.
β Pause & Think Β· The researcher's question
If the experiments show quantum models LOSING to your classical stack β is the PhD programme in trouble?
Sit with this before starting, because it removes the fear that bends results. The answer is no: a careful, first-of-its-kind negative result at a fresh crossroads is publishable, citable, and honest β it tells the field where the frontier actually is. The study is designed so that every outcome of RQ1βRQ3 is a contribution. That is what a well-posed research question means.
Feynman's first principle returns from Lab 8: you must not fool yourself β and you are the easiest person to fool. Pre-register the metrics, freeze the splits, let the data speak. Reviewers can smell a result that was tortured into existence; they reward one that was simply found.
The strongest sentence a PhD researcher can write is: "we expected X; we found Y; here is what that teaches." May Paper 3 earn that sentence.