A quantum amplitude is a complex coefficient attached to a basis state in a quantum state. Its squared magnitude determines the probability of observing that basis state during measurement. section 2.2.2 section 4.9
For a single qubit written as α|0⟩ + β|1⟩, computational-basis measurement produces 0 with probability α² and 1 with probability β² when the amplitudes are real. Complex amplitudes behave similarly through their squared magnitudes. section 4.1.1
Amplitudes support several practical tasks:
- Describe an n-qubit state with 2^n coefficients: |ψ⟩ = Σ aⱼ|j⟩. section 2.5
- Predict measurement frequencies from the amplitudes of computational-basis states. section 4.1.1
- Inspect simulator state data, including nonzero amplitudes, probabilities, and phases. section 2.2.2
- Estimate unknown state coefficients by repeated measurements and compare the estimate with the known coefficients. section 4.5.2
Reading amplitudes in Q#
Preparing a qubit with amplitudes 0.6 and 0.8 produces |0⟩ with probability 36% and |1⟩ with probability 64%. Q#'s DumpMachine reports both amplitudes and measurement probabilities while running on a simulator.
Listing 4.11 Qiskit code to reconstruct the coefficients of a state
from math import pi, sqrt
from qiskit import QuantumCircuit, transpile
from qiskit_aer import AerSimulator
simulator = AerSimulator(method='statevector')
def reconstruct_state(state_prep):
circ1 = QuantumCircuit(1, 1) #1
circ1.append(state_prep, [0])
circ1.measure(0, 0)
circ1 = transpile(circ1, backend=simulator)
n_trials = 200 #2
res_map = simulator.run(circ1, shots=n_trials).result().get_counts()
if '0' in res_map:
(n0, n1) = (res_map['0'], n_trials - res_map['0'])
else: #3
(n0, n1) = (n_trials - res_map['1'], res_map['1'])
alpha = sqrt(n0 / n_trials)
beta = sqrt(n1 / n_trials)
circ2 = QuantumCircuit(1, 1) #4
circ2.append(state_prep, [0])
circ2.ry(pi / 2, 0)
circ2.measure(0, 0)
circ2 = transpile(circ2, backend=simulator)
res_map = simulator.run(circ2, shots=n_trials).result().get_counts()
if '0' in res_map and 2 * res_map['0'] > n_trials:
return (alpha, -beta)
else:
return (alpha, beta)
Inspect the Qiskit implementation that reconstructs single-qubit state coefficients from repeated simulator measurements. section 4.5.2

