Free quantum tool · Level: First-year university

Quantum gates and interference

Build a chain of gates on |0⟩ and see where it lands. It opens on two Hadamards, because that pair is the whole case for amplitudes in one move.

|0⟩1.00|0⟩
Add a gate
45°
Final state1.00|0⟩

Try this

The chain H · H takes |0⟩ to 1.00|0⟩, which is a 100% chance of measuring 0. Add another gate and watch which numbers move.

Final state

Gates apply left to right, as drawn. Undo takes off the last one.

Try this on the tool above

  1. The chain starts as H then H and the final state reads 1,00|0⟩. Press undo once: a single H gives a 50/50. The second H puts it back.
  2. Switch on the amplitudes layer. The two contributions to |1⟩ are +0,50 and −0,50, drawn as arrows pointing opposite ways, and they add to 0,00.
  3. Clear, build X then H and read the |1⟩ amplitude: −0,71. Clear again and build H then X and it reads +0,71. Same two gates, different sign.

A quantum gate is a matrix that turns the state rather than reading it. H sends |0⟩ to an even 50/50 mix, X flips the bit, Z flips the sign on |1⟩, and the phase gate turns |1⟩ by any angle you set. Two Hadamards in a row give back a certain |0⟩, because the two routes to |1⟩ carry +0,5 and −0,5 and cancel exactly.

The usual mistake

After the first H the qubit is really 0 or 1, we just do not know which yet.

Then the second H would be a second coin flip and you would land on 50/50. You land on a certain 0 instead. Probabilities can only ever pile up, while amplitudes can be +0,5 and −0,5 and leave nothing behind, and that cancelling is the part no classical machine can copy.

Two coin flips that make a certainty

One Hadamard turns a definite |0⟩ into a 50/50. A second one does the same operation again and hands back a definite |0⟩. Read the middle step as a hidden 0 or 1 and this becomes impossible, because two coin flips do not compose into certainty.

Turn on the amplitudes layer and the reason is sitting there. The |1⟩ amplitude picks up one contribution from each branch, the two come out the same size pointing opposite ways, and they cancel. Amplitudes cancel. Probabilities never do.

What each gate is for

X is the bit flip, and the only gate on the palette a classical computer also has. Z leaves |0⟩ alone and flips the sign on |1⟩, which does nothing at all to the odds and everything to what happens next. That pairing, invisible now and decisive later, is why phase is the hard part of a first course.

S and T are phase gates at 90° and 45°. Press P with the slider anywhere and you have built your own. Turn on the matrix layer and the whole chain collapses into one 2 by 2 grid, which is all a circuit ever was.

Order matters, and the drawing hides it

Build X then H, note the answer, clear and build H then X. They differ. Gates are matrices, matrices do not commute, and the order you click is the order the physics happens in.

The notation sets a trap here. A circuit reads left to right while a matrix product multiplies right to left, so the algebra runs backwards against the picture. This tool applies the chain in drawing order so you can watch the physics without also holding that flip in your head.

Circuits not clicking yet?

Browse physics and maths tutors, pick one whose subjects match your course, and book a single hour to start.

Frequently asked questions

What is a quantum gate?
A reversible operation on a qubit, written as a unitary matrix. Unitary means total probability is preserved, so a state that summed to 1 before still sums to 1 after. Every quantum gate has an inverse, which is why a quantum circuit can always be run backwards and many classical ones cannot.
What does the Hadamard gate do?
It sends |0⟩ to an even mix of |0⟩ and |1⟩, and |1⟩ to the same mix carrying a minus sign. It is its own inverse, so two in a row return you to the start. That minus sign is the whole reason the second one cancels rather than doubling up.
Why does the Z gate seem to do nothing?
Z multiplies the |1⟩ amplitude by −1, and squaring a size destroys the minus, so no measurement taken straight afterwards can see anything at all. Put an H behind it and that sign decides which way the amplitudes add, turning an invisible change into a completely different outcome.
Is quantum interference the same as wave interference?
The arithmetic is identical. Two contributions with a size and a direction add like arrows, and where they point opposite ways they cancel. What differs is what interferes: not a wave in space, but the amplitudes for one final outcome reached by different routes.

More interactive quantum tools

Use this tool on your site

This tool is free to use and free to link to. If it helps your students, please link back with the snippet below.

HTML

<a href="https://itutoronline.com/tools/quantum/quantum-gates">Interactive quantum gate and interference tool</a>