How To Make A Qubit Represent A Probability
Even though probabilities are not what you should care about
The Ry gate is a single-Qubit Quantum Gate that rotates a Qubit’s state around the Y-axis of the Bloch sphere by a specified angle theta. It changes the probabilities (through the Amplitudes) of measuring |0⟩ or |1⟩ without altering their relative Quantum Phase.
The above image shows that effect in a two-dimensional representation that omits the complex Quantum Phase.
The closer the head of the Quantum State Vector |ψ⟩ is to either Basis State |0⟩ or |1⟩ the more likely we measure the Qubit in that state.
Rotating the Quantum State Vector around the y-axis (which would protrude perpendicularly from the center of the circle) therefore has a direct influence on the Measurement probabilities.
The following listing shows how the Ry Gate works in Qiskit.
from math import pi
from qiskit import QuantumCircuit
from qiskit.quantum_info import Statevector
from qiskit.visualization import plot_histogram
# initialize a quantum circuit with a single qubit
qc = QuantumCircuit(1)
# the angles in radians to rotate the state vector
theta = pi / 3
# apply the roation angle to the qubit at position 0
qc.ry(theta, 0)
# turn quantum circuit into statevector
psi = Statevector.from_instruction(qc)
# show the data
print(f”|ψ⟩: {psi.data}”)
# compute the probabilities from the statevector
# and show them in a histogram
plot_histogram(psi.probabilities_dict())

