
Some quantum computing concepts feel strange until we stop trying to translate them directly into our classical intuition. Believe me, this is the greatest difficulty for those of us software developers who have so deeply internalized classical computing that learning to handle information under a new paradigm is truly hard.
Quantum entanglement is probably one of the best examples of this. Two entangled qubits are not simply two variables holding related values. The whole system has a state that, in general, we cannot decompose into two independent states.
For a programmer, this last sentence is more important than any analogy: when there is entanglement, the unit of information we must describe is the whole system.
I hope that after reading this article you get an idea of the implications of entanglement in quantum computing.
From product states to entanglement
First, let’s quickly look at an entangled state using the mathematical formalism. To do so, consider two independent qubits. A state such as
, can be perfectly separated into the state of the first qubit and that of the second. Even if each one is in superposition, as long as we can write the global state as
, there is no entanglement between them.
Now look at one of the best-known Bell states (which is a good example of an entangled state):
We cannot find two individual states and whose tensor product produces that state. That is the essential mathematical difference.
How do we generate it? With a surprisingly small circuit. We start from , apply a Hadamard gate to the first qubit, and then a CNOT that uses that qubit as the control:
q0: |0> ──H──■──
│
q1: |0> ─────X──
After the Hadamard gate we have
and the CNOT transforms this state precisely into .
If you run it many times on an ideal simulator and measure both qubits, you will get 00 or 11, each with probability . 01 and 10 will never appear.
It is not a simple classical correlation: it generates a new kind of state
This is the usual confusion. I can also write a classical program that flips a coin and assigns the same result to two variables. I will get a perfect correlation: 00 or 11. So, what is special about the Bell state?
The difference appears when we change the bases in which we perform the measurements. To understand it better, let’s first imagine a completely classical system. We can write a program that randomly generates two bits with the same value: in each run it will return 00 or 11, each possibility with a probability of 50%. If we repeat the experiment many times and look only at the results, we will find a perfect correlation between both bits.
At first glance, this looks exactly like what happens when we measure the Bell state
When we measure this state in the computational basis, we also get 00 or 11, both with probability . We never get 01 or 10. So, what is the difference between the two cases?
In the classical system we can assume without any problem that the bits already had a definite value before we observed them. If we get 00, both bits were already zero before we read them; we simply did not know it. The same goes for 11. The uncertainty lies in our knowledge of the system, not necessarily in the system itself.
We can conceptually represent that situation as a classical distribution:
By contrast, the Bell state above does not mean that the quantum computer has previously chosen between 00 and 11 and is keeping the result hidden until we decide to measure. Before the measurement we have a single quantum state:
The two terms are part of a coherent superposition. Their amplitudes also have a definite phase relationship, and that information can affect the outcome of later quantum operations.
Here lies one of the subtleties of the matter: if we merely measure over and over in the computational basis, that difference can remain hidden. The classical mixture and the entangled state can produce exactly the same statistics: roughly half the time we will observe 00 and the other half 11.
We need to do something more.
One possibility is to change the measurement basis before observing the qubits. In a circuit we can do this by applying certain gates before the measurement. For example, applying a Hadamard gate lets us relate the and bases, since
and
, where
When we measure the qubits using different bases, the phase relationships that are part of the quantum state begin to have observable consequences. This is where a simple classical statistical mixture stops being equivalent to an entangled state.
We can take this idea even further. If we make different measurement choices on both qubits and study the correlations obtained after repeating the experiment many times, we can build tests based on Bell inequalities. These set limits on the correlations that certain models based on local hidden variables can achieve. Quantum mechanics predicts correlations capable of violating those limits.
This result is much deeper than it may initially seem. An intuitive classical explanation might imagine that each particle carries some kind of hidden information that determines in advance which result it will give when measured. It would be something like creating two objects with some shared information, sending them to different places and later checking their state. The result might surprise us if we did not know that information, but everything would have been decided from the start.
The quantum correlations observed in Bell experiments cannot be explained that way by a local hidden-variable model that satisfies the assumptions used to derive those inequalities.
Now, be careful not to draw a conclusion too quickly: entanglement does not allow two qubits to be used as an instantaneous communication channel. The individual result of a measurement remains probabilistic, and we cannot choose which value we will get in order to transmit information to the other party. The correlations appear when the measurement results are compared afterwards.
Therefore, observing only equal results in the computational basis is not enough to demonstrate entanglement. We can reproduce that same statistic with a simple classical algorithm that randomly returns 00 or 11.
What is specifically quantum appears when we study the state in greater depth, preserve its coherence and analyze the correlations it shows under different measurement choices.
This nuance is especially important because it prevents us from interpreting entanglement as a particularly sophisticated kind of shared variable. Two entangled qubits are not simply two variables that have previously agreed on which value to return when someone queries them.
Mathematically, something far more interesting happens: the joint state cannot be written as the tensor product of two individual states.
For a programmer, perhaps this is the most useful way to hold on to the concept. With two classical variables we can reason individually about the state of each one, even if they are correlated. With two entangled qubits, on the other hand, that individual description is no longer sufficient.
The whole system becomes the unit we must consider.
So what is it good for?
Entanglement does not allow us to send information instantly or communicate faster than light, as it might seem at first. What it does provide is a resource that quantum algorithms and protocols can exploit together with superposition, unitary transformations, interference and measurement.
It appears centrally in the quantum teleportation protocol, where a quantum state can be transferred using an entangled pair and classical communication. It also plays a role in quantum cryptography and key distribution (QKD) protocols, and it is fundamental to many quantum error correction schemes, in which logical information is distributed among several physical qubits.
And, of course, it appears constantly in the design of quantum algorithms: applying two-qubit gates can create global states whose structure can no longer be described by processing each qubit as an isolated entity.
That is, the phenomenon of entanglement is one of the fundamental properties of quantum computing, hence the need to understand it well.
An important caveat about quantum advantage
It is tempting to end by saying that entanglement allows exponential problems to be solved in polynomial time. But that would be a bit of an exaggeration and not entirely true. Entanglement alone does not imply an exponential speedup, nor is there a general rule by which an algorithm that entangles many qubits will necessarily outperform a classical algorithm.
What is truly interesting is that it opens up a different computational space. Algorithms such as Shor’s show that, for specific problems and under the appropriate quantum model, extraordinary improvements over the best known classical algorithms are possible. That advantage arises from combining several quantum resources, not from just one.
For a developer, perhaps that is the idea worth keeping: a quantum register cannot always be understood as a collection of strange bits processed independently. With entanglement, the state of the system is a computational entity in itself.
And that small conceptual shift completely changes the way we think about an algorithm and about processing information.