|q⟩ Bad Qubits

beginner · Programming · Single-Qubit Gates II: H, S, T & Phase

The Hadamard Gate

A qubit prepared in 0|0\rangle is perfectly predictable: measure it and you always get 0. The Hadamard gate HH trades that certainty for a balanced superposition — it is the single most important gate for turning a quantum computer "on."

What H does

Acting on a basis state, the Hadamard gate produces

H0=12(0+1),H1=12(01).H|0\rangle = \tfrac{1}{\sqrt{2}}\big(|0\rangle + |1\rangle\big), \qquad H|1\rangle = \tfrac{1}{\sqrt{2}}\big(|0\rangle - |1\rangle\big).

Its matrix is

H=12(1111).H = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}.

You can read the result straight off the matrix: applying HH to the column vector (10)\binom{1}{0} gives 12(11)\tfrac{1}{\sqrt{2}}\binom{1}{1}, so both amplitudes equal 12\tfrac{1}{\sqrt{2}}. By the Born rule the probability of each outcome is 122=12\left|\tfrac{1}{\sqrt{2}}\right|^{2} = \tfrac{1}{2} — a perfect 50/50 split. On the Bloch sphere, HH rotates the north pole 0|0\rangle onto the +x+x axis, the state we call +|+\rangle.

Try it

Complete the circuit so the single qubit ends in an equal superposition. Press Run to watch the amplitudes update, then Check to grade your answer against the simulator.

Run your code to see the quantum state.

Look at the output: the two amplitudes are each 0.707=12\approx 0.707 = \tfrac{1}{\sqrt{2}}, the probabilities are both 0.50.5, and the Bloch vector points along +x+x. That is exactly +|+\rangle.

Sign in on the full site to ask questions and join the discussion.