Tutorial

How To Make A Qubit Represent A Probability

Even though probabilities are not what you should care about

Ry-Gate is the direct way to control measurement probabilities. At least, it seems that way. But it is based on a fundamental assumption that, if not met, will break your code.

by Frank Zickert
December 11, 2025
How To Make A Qubit Represent A Probability

The Ry gate is a single-A qubit is the basic unit of quantum information, representing a superposition of 0 and 1 states.
Learn more about Quantum Bit
A quantum gate is a basic operation that changes the state of one or more qubits, similar to how a logic gate operates on bits in classical computing. It uses unitary transformations, meaning it preserves the total probability (the state’s length in complex space). Quantum gates enable superposition and entanglement, allowing quantum computers to perform computations that classical ones cannot efficiently replicate.
Learn more about Quantum Gate
that rotates a A qubit is the basic unit of quantum information, representing a superposition of 0 and 1 states.
Learn more about Quantum Bit
state around the -axis of the Bloch sphere by a specified angle ("theta"). It changes the probabilities (through the In quantum computing an amplitude is a complex number that describes the weight of a basis state in a quantum superposition. The squared magnitude of an amplitude gives the probability of measuring that basis state. Amplitudes can interfere, this means adding or canceling, allowing quantum algorithms to bias outcomes toward correct solutions.
Learn more about Amplitude
) of measuring is a basis state.
Learn more about
or is a basis state.
Learn more about
without altering their relative A **quantum phase** is the angle component of a particle’s wavefunction that determines how its probability amplitude interferes with others. It doesn’t affect observable probabilities directly but becomes crucial when comparing two or more states, as phase differences lead to interference effects. Essentially, it encodes the relative timing or “alignment” of quantum waves.
Learn more about Quantum Phase

The above image shows that effect in a two-dimensional representation that omits the A complex number is a number that has two parts: a real part and an imaginary part, written as , where . The real part behaves like ordinary numbers, while the imaginary part represents a direction perpendicular to the real axis on the complex plane. Complex numbers let us represent and calculate quantities involving square roots of negative numbers.
Learn more about Complex Number
A **quantum phase** is the angle component of a particle’s wavefunction that determines how its probability amplitude interferes with others. It doesn’t affect observable probabilities directly but becomes crucial when comparing two or more states, as phase differences lead to interference effects. Essentially, it encodes the relative timing or “alignment” of quantum waves.
Learn more about Quantum Phase
.

The closer the head of the A quantum state vector is a mathematical object (usually denoted |ψ⟩) that fully describes the state of a quantum system. Its components give the probability amplitudes for finding the system in each possible basis state. The squared magnitude of each component gives the probability of measuring that corresponding outcome.
Learn more about Quantum State Vector
is to either A basis state in quantum computing is one of the fundamental states that form the building blocks of a quantum system’s state space. For a single qubit, the basis states are and ; any other qubit state is a superposition of these. In systems with multiple qubits, basis states are all possible combinations of s and s (e.g., , , , and ), forming an orthonormal basis for the system’s Hilbert space.
Learn more about Basis State
is a basis state.
Learn more about
or is a basis state.
Learn more about
the more likely we In quantum computing, measurement is the process of extracting classical information from a quantum state. It collapses a qubit’s superposition into one of its basis states (usually or ), with probabilities determined by the amplitudes of those states. After measurement, the qubit’s state becomes definite, destroying the original superposition.
Learn more about Measurement
the A qubit is the basic unit of quantum information, representing a superposition of 0 and 1 states.
Learn more about Quantum Bit
in that state.

This post is accompanied by a PDF file summarizing the key points.

Please Login to Download the PDF (your PyQML subscription works here!)

Rotating the A quantum state vector is a mathematical object (usually denoted |ψ⟩) that fully describes the state of a quantum system. Its components give the probability amplitudes for finding the system in each possible basis state. The squared magnitude of each component gives the probability of measuring that corresponding outcome.
Learn more about Quantum State Vector
around the y-axis (which would protrude perpendicularly from the center of the circle) therefore has a direct influence on the In quantum computing, measurement is the process of extracting classical information from a quantum state. It collapses a qubit’s superposition into one of its basis states (usually or ), with probabilities determined by the amplitudes of those states. After measurement, the qubit’s state becomes definite, destroying the original superposition.
Learn more about Measurement
probabilities .

? shows how the 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 . It changes the probabilities (amplitudes) of measuring or without altering their relative phase.
Learn more about Ry Gate
works in Qiskit is an open-source Python framework for programming and simulating quantum computers. It lets users create quantum circuits, run them on real quantum hardware or simulators, and analyze the results. Essentially, it bridges high-level quantum algorithms with low-level hardware execution.
Learn more about Qiskit

ry_gate.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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())
Listing 1 Using the Ry gate in Qiskit

In this code listing, we

  1. the required functions from math and Qiskit,
  2. a QuantumCircuit instance (qc) with a single A qubit is the basic unit of quantum information, representing a superposition of 0 and 1 states.
    Learn more about Quantum Bit
    Qiskit is an open-source Python framework for programming and simulating quantum computers. It lets users create quantum circuits, run them on real quantum hardware or simulators, and analyze the results. Essentially, it bridges high-level quantum algorithms with low-level hardware execution.
    Learn more about Qiskit
    initializes A qubit is the basic unit of quantum information, representing a superposition of 0 and 1 states.
    Learn more about Quantum Bit
    in the state ,
  3. the angle theta in radians,
  4. the 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 . It changes the probabilities (amplitudes) of measuring or without altering their relative phase.
    Learn more about Ry Gate
    with the specified angle theta to the first (and only) A qubit is the basic unit of quantum information, representing a superposition of 0 and 1 states.
    Learn more about Quantum Bit
    at position 0 of the qc,
  5. the qc A quantum circuit is a sequence of quantum gates applied to qubits, representing the operations in a quantum computation. Each gate changes the qubits’ state using quantum mechanics principles like superposition and entanglement. The final qubit states, when measured, yield the circuit’s computational result probabilistically.
    Learn more about Quantum Circuit
    into a Statevector class instance by using the static method from_instruction.

The Statevector class allows us to analyze the resulting A quantum state vector is a mathematical object (usually denoted |ψ⟩) that fully describes the state of a quantum system. Its components give the probability amplitudes for finding the system in each possible basis state. The squared magnitude of each component gives the probability of measuring that corresponding outcome.
Learn more about Quantum State Vector
and reason about its implications, such as its raw data. That is the amplitudes depicted in ?.

1
|ψ⟩: [0.8660254+0.j 0.5 +0.j]
Listing 2 The resulting amplitudes of the Ry gate

We can also a histogram of the In quantum computing, measurement is the process of extracting classical information from a quantum state. It collapses a qubit’s superposition into one of its basis states (usually or ), with probabilities determined by the amplitudes of those states. After measurement, the qubit’s state becomes definite, destroying the original superposition.
Learn more about Measurement
probabilities associated with this A quantum state vector is a mathematical object (usually denoted |ψ⟩) that fully describes the state of a quantum system. Its components give the probability amplitudes for finding the system in each possible basis state. The squared magnitude of each component gives the probability of measuring that corresponding outcome.
Learn more about Quantum State Vector
resulting in ?.

Figure 1 Histogram of the probabilities resulting from the circuit

As we see, rotating the A quantum state vector is a mathematical object (usually denoted |ψ⟩) that fully describes the state of a quantum system. Its components give the probability amplitudes for finding the system in each possible basis state. The squared magnitude of each component gives the probability of measuring that corresponding outcome.
Learn more about Quantum State Vector
by corresponds to a resulting probability of In quantum computing, measurement is the process of extracting classical information from a quantum state. It collapses a qubit’s superposition into one of its basis states (usually or ), with probabilities determined by the amplitudes of those states. After measurement, the qubit’s state becomes definite, destroying the original superposition.
Learn more about Measurement
the A qubit is the basic unit of quantum information, representing a superposition of 0 and 1 states.
Learn more about Quantum Bit
as is a basis state.
Learn more about
of .


Apparently, since the 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 . It changes the probabilities (amplitudes) of measuring or without altering their relative phase.
Learn more about Ry Gate
rotates the A quantum state vector is a mathematical object (usually denoted |ψ⟩) that fully describes the state of a quantum system. Its components give the probability amplitudes for finding the system in each possible basis state. The squared magnitude of each component gives the probability of measuring that corresponding outcome.
Learn more about Quantum State Vector
around the -axis, we can directly control the resulting In quantum computing, measurement is the process of extracting classical information from a quantum state. It collapses a qubit’s superposition into one of its basis states (usually or ), with probabilities determined by the amplitudes of those states. After measurement, the qubit’s state becomes definite, destroying the original superposition.
Learn more about Measurement
probabilities. So, if what we care about is probability, why not think directly in probabilities and let the angle take care of itself?

In fact, we don't even need to specify the angle ourselves. We can compute it classically.

Join to continue

This part is available to PyQML students and above. Log in or start a subscription to unlock member content.

Already a member? Use Log in. New here? Choose Subscribe.