Curriculum / Quantum Foundations / Measuring in Different Bases

Lesson 8 of 17Code challengeFree+125 XP

Measuring in Different Bases

Code challenge: prepare states and measure in the X and Y bases.

Measuring in Different Bases

The |+⟩ state is (|0⟩ + |1⟩)/√2. If we measure it in the Z-basis we get 50/50 random results. But if we measure in the X-basis (apply H first), we get |0⟩ deterministically.

Your Challenge

  1. 1.Create the |+⟩ state using H on qubit 0
  2. 2.Measure in the X-basis (apply H then measure), you should get 100% "0"
  3. 3.Create |−⟩ = (|0⟩ − |1⟩)/√2 using H then Z
  4. 4.Measure in the X-basis, you should get 100% "1"

Compare both results to show that X-basis measurement distinguishes |+⟩ and |−⟩ perfectly.

How this lesson works

A hands-on coding challenge. You write Qiskit-compatible Python in the browser editor, run it instantly via WebAssembly, watch the circuit and Bloch sphere react, and pass automatic output checks. The AI tutor Qubitus gives Socratic hints if you get stuck.

Part of: Quantum Foundations

Learn the basics: qubits, gates, superposition, and measurement.

Take this lesson free

Create a free account and start this lesson in your browser. No credit card, no installation.