9. Probability Theory: Random Variables

Random Variables

This is where the "Physics" of quantum mechanics meets the "Statistics" of reality. A qubit in superposition is not a fuzzy value; it is a Random Variable waiting to be sampled.

In classical probability, a random variable $X$ is a variable that takes on specific values with specific probabilities. In Quantum Computing, the act of measurement creates this random variable.

1. The Discrete Random Variable (The Outcome)

When you measure a qubit in the $Z$-basis, you are querying a discrete random variable that can only take one of two specific values (the eigenvalues of the $Z$-operator):

  • +1 (corresponding to state $|0\rangle$)
  • -1 (corresponding to state $|1\rangle$)

Crucial Note: Computer scientists often map these to the bits $0$ and $1$, but physically/mathematically, the math works on the eigenvalues $+1$ and $-1$.

2. The Probability Distribution (The State)

The quantum state vector $|\psi\rangle = \alpha|0\rangle + \beta|1\rangle$ defines the Probability Mass Function (PMF) for this random variable.

$$P(X = +1) = |\alpha|^2$$ $$P(X = -1) = |\beta|^2$$

Constraint: Since something must happen, $|\alpha|^2 + |\beta|^2 = 1$.

3. The Expectation Value (The Average)

This is the most misunderstood concept for beginners. The Expectation Value (denoted as $E[X]$ or $\langle Z \rangle$) is NOT the value you expect to see in a single measurement.

Since the outcomes are only $+1$ or $-1$, you will never see the expectation value (which is usually a decimal, like $0.5$) in a single shot.

The Expectation Value is the average of the results if you repeated the experiment 1000 times.

$$E[X] = \sum x_i P(x_i)$$ $$E[X] = (+1) \cdot P(0) + (-1) \cdot P(1)$$ $$E[X] = |\alpha|^2 - |\beta|^2$$

This number tells us the "bias" of the qubit.

  • If $E[X] = 1$, the qubit is definitely $|0\rangle$.
  • If $E[X] = -1$, the qubit is definitely $|1\rangle$.
  • If $E[X] = 0$, the qubit is perfectly balanced (50/50 superposition).
H
X
Y
Z
S
T
Rx
Ry
Rz
CNOT
SWAP
M
Run simulation to see results...