Lesson 3 of 15
Measurement
The Born Rule
When we measure a qubit, the superposition collapses to either or . The probabilities are given by the Born rule:
- P(|1 angle) = |eta|^2
For the state [1.0, 0.0]: , — certain outcome.
For the equal superposition left[rac{1}{sqrt{2}}, rac{1}{sqrt{2}} ight]: , — truly random.
import math
def prob_zero(state):
return state[0] ** 2
def prob_one(state):
return state[1] ** 2
s = 1 / math.sqrt(2)
superposition = [s, s]
print(round(prob_zero(superposition), 4)) # 0.5
print(round(prob_one(superposition), 4)) # 0.5
After measurement, the qubit is irreversibly in the measured state — the superposition is gone.
Your Task
Implement prob_zero(state) and prob_one(state) using the Born rule.
Python runtime loading...
Loading...
Click "Run" to execute your code.