Search⌘ K
AI Features

Calculating Joint Probability

Explore the calculation of joint probability for two quantum events using multiple qubits and parameterized rotations. Understand the limitations of representing joint probabilities with single qubits, how separate qubits hold marginal probabilities, and the role of entanglement and CNOT gates in modeling joint probabilities in quantum computing.

After finding the marginal probability now, we want to calculate the joint probability of two events. Both events have marginal probabilities between 0.0 and 1.0, just like any other probability.

The following figure depicts the joint probability of two variables.

Mathematically, we can calculate joint probability by multiplying both marginal probabilities. Let’s say event B has a probability of 0.8. We expect a probability of 0.40.8=0.320.4*0.8=0.32.

Let’s try it with Qiskit.

Representing two marginal probabilities with a single qubit

Javascript (babel-node)
# Specify the marginal probabilities
event_a = 0.4
event_b = 0.8
qc = QuantumCircuit(4)
# Set qubit to prior
qc.ry(prob_to_angle(event_a), 0)
# Apply modifier
qc.ry(prob_to_angle(event_b), 0)
run_circuit(qc)

This didn’t work. We’re not even close to the target probability. Instead, we get a probability of 0.9520.952.

The problem is the calculation of the angle θ\theta inside the prob_to_angle-function. We calculate the angle as the arcsine of the target probability’s square root. Let’s look at this function. The following figure depicts the shape of f(x)=arcsin(x)f(x)=arcsin(\sqrt{x}) ...