Skip to content
DeepForgeby svx
All problems
MediumInformation Theoryinfo-182

Qubit Measurement Probability

Problem

Return the probability of measuring outcome 0 for a qubit in the state (a, b): P(0) = a^2. The Born rule squares the amplitude.

Hint

Probabilities come from squaring amplitudes, not from the amplitudes themselves.

Test cases

case 1
in: [1,0]
expected: 1
case 2
in: [0,1]
expected: 0
case 3
in: [0.7071067811865476,0.7071067811865476]
expected: 0.5000000000000001
case 4
in: [0.6,0.8]
expected: 0.36
Starter codePython
def qubit_measure_prob0(a, b):
    # Your code here
    pass

4 test cases · run your code against them in the editor