Computing State Vector of Probability Distributions
Published on September 11, 2026
In this article, we will show how we can derive a generic circuit for probability distribution functions. Let a quantum system be described by the state
∣Ψ⟩=a∣0⟩+b∣1⟩
According the quantum theory, if we measure this system, we can find it in state ∥0⟩ with probability ∥a∥2 and in state ∥1⟩ with probability ∥b∥2, where a and b are complex numbers and ∥a∥2+∥b∥2=1.
Suppose a and b are real numbers, f(x) a probability distribution with x=0,1 and f(0)=a2 and f(1)=b2, then we can write ∥Ψ⟩ as
∣Ψ⟩=f(0)∣0⟩+f(1)∣1⟩
In general, if we have n qubits and the domain of f(x) is 0,1,2,…2n−1, then we can write ∥Ψ⟩ as
∣Ψ⟩=x=0∑2n−1f(x)∣x⟩
If the distribution is continuous, we will need to discretize it and map it to the intervals generated by n qubits. We will show this later in the example on Lognormal distribution.
Probability Distributions on 2-Qubits
If we have two qubits, then the following table summarizes the possibilities:
q1↓01q0→0001010111
Let P0 be the probability of the first qubit to have a value of 0 and P1 be the probability of the first qubit to have a value of 1. Then according to the above table
P0P1=P00+P10=P01+P11
where Pij is the probability of getting the state ∥ij⟩.
Define the following
f(0)f(1)f(2)f(3)=P00=P01=P10=P11
Then we can write the probability distribution for this system as:
∣Ψ⟩=P00∣00⟩+P01∣01⟩+P10∣10⟩+P11∣11⟩
Deriving the Circuit
We will now derive a circuit for this probability distribution. We are going to use the RY(θ) gate defined by
# Import the Qiskit SDKfrom qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister
from qiskit import execute, Aer
import numpy as np
# Create the input Quantum Register with 2 qubits.qin = QuantumRegister(2)# Create a Classical Register with 2 bits that will hold the result of the measurementc = ClassicalRegister(2)# Create the Quantum Circuitqc = QuantumCircuit(qin,c)# compute the anglesP00=<input>P01=<input>P10=<input>P11=<input>P0=P00+P10
P1=P01+P11
theta0 =2*np.arccos(np.sqrt(P0))theta1 =2*np.arccos(np.sqrt(P00/P0))theta2 =2*np.arccos(np.sqrt(P01/P0))print(theta0)print(theta1)print(theta2)# Implement the circuitqc.ry(theta0, qin[0])qc.x(qin[0])qc.cry(theta1,qin[0],qin[1])qc.x(qin[0])qc.cry(theta2,qin[0],qin[1])qc.barrier()# Measure and drawqc.measure(qin,c)qc.draw(output='mpl',interactive=True)
Here is how the circuit will look like:
Example: Uniform Distribution
A 2-qubit system will allow us to create 4-bins. Since this is uniform distribution, each bin will have the same probability of occuring, that is
Plugging in these values in the above code and simulating we get:
Example: Sum of Quantum 2-dice
Suppose we have 2 dice with each die having 2 faces whose value can be 0 or 1. We throw the dice and examine the face that shows when they land. Whatever is the value, we take the sum. The question is what value of the sum is most probable?
We can tabulate the possible sums of 2-dices as follows where the values of the sum correspond to their binary representation.
010000110110
For example, if die 1 and die 2 come up as 1 and 1, then the sum is equal to 2 which is 10 in binary.
From the table above, we can compute the following probabilities:
Using values μ=0 and σ=1, create 4 bins with the following boundaries 0,0.25,0.5,0.75,1.0 and get the probabilities from the lognormal cumulative distribution for each bin. The following are the probabilities:
We have learned how to derive a generic 2-qubit circuit for a probability distribution. We validated the circuit using the uniform distribution and it is what we expected it to be. We have also shown the simulation for 2 other distributions. A challenge is to derive the circuit for a 3-qubit system, and for an n-qubit system. The number of gates is expected to be exponential on the number of qubits. That would be a further challenge for the interested person.