# What is the difference between $\vert 0 \rangle + \vert 1 \rangle$ and $\vert 0 \rangle \langle 0 \vert + \vert 1 \rangle \langle 1 \vert$?

In a discussion with Jay Gambetta on the QISKit Slack channel, Jay told me that "T2 is the time that $\vert 0 \rangle + \vert 1 \rangle$ goes to $\vert 0 \rangle \langle 0 \vert + \vert 1 \rangle \langle 1 \vert$".

My question is: what is the difference between those two states?

• Possible duplicate of What is the difference between superpositions and mixed states? – glS Aug 8 '18 at 11:08
• It is similar, but this title is helpful for people who don't know what a "pure state" or a "mixed state" are. This is also related to T2. An answer can be given which refers to the other question, and I don't see any harm with leaving it "open". Really there is no point of closing this. – user1271772 Aug 10 '18 at 21:21

In short: "coherence"! It's the crucial difference between quantum and classical. $\rho=|0\rangle\langle 0|+|1\rangle\langle 1|$ is just a statistical mixture, and behaves like a classical coin - any measurement that you perform on it gives a 50:50 split between the two possible outcomes.

By contrast, $|+\rangle=(|0\rangle+|1\rangle)/\sqrt{2}$ is a very different beast. When you look at them both as density matrices, you can see the difference: $$\rho=\frac{1}{2}\left(\begin{array}{cc} 1 & 0 \\ 0 & 1 \end{array}\right)\qquad |+\rangle\langle +|=\frac{1}{2}\left(\begin{array}{cc} 1 & 1 \\ 1 & 1 \end{array}\right)$$ Sure, if you measure $|+\rangle$ in the Z-basis, you get 50:50 outcomes, just like you did with $\rho$, but measurement in other bases gives different outcomes. Most importantly, if you measure in the $X$ basis, you get a definite measurement result, a 100:0 split.

Put another way, if I perform a Hadamard gate on the two states: $$H\rho H=\rho\qquad H|+\rangle\langle +|H=|0\rangle\langle 0|.$$

One of the crucial ways that we use the $|+\rangle$ state is in the first step of quantum algorithms: you prepare one register in $|+\rangle^{\otimes n}$. If, instead, you prepared it in $\rho^{\otimes n}$, this would be equivalent to classical sampling of the function evaluation in the next step. There would be no phase kick-back, and no quantum speed-up.

Imagine a qubit starts in the state $\rho_0=|+\rangle\langle +|$ and experiences the noise map $$\rho_{n+1}=\mathcal{E}(\rho_n)=(1-p)\rho_n+p Z\rho_n Z$$ where $0<p<1$ quantifies the probability of a phase error in a particular time step. Calculate $\rho_n$. Show that:

• $\rho_n-\rho_{n+1}\neq 0$
• the fixed point of the map is $(|0\rangle\langle 0|+|1\rangle\langle 1|)/2$
• as $n\rightarrow\infty$, $\rho_n$ tends to this fixed point.

There are multiple ways to mathematically express the state of a quantum system. One is to write it as a linear combination of basis states, as either a vector or a matrix, as you have here. This is useful in many cases, but it also seems to be confusing to newcomers, since things like $\vert 0 \rangle + \vert 1 \rangle$, $\vert 0 \rangle \langle 0 \vert + \vert 1 \rangle \langle 1 \vert$ and other states all just look like a $50/50$ mix of $\vert 0 \rangle$ and $\vert 1 \rangle$.

So let's look at another way of representing states: using expectation values for a set of observables. For a single qubit we can use the Pauli matrices:

$$\rho = \frac{1}{2} \left( \mathbb{1} + \sum_{\alpha \in \{x,y,z\}} \, \langle \sigma_\alpha \rangle \,\,\sigma_\alpha \right)$$

Here $\langle \sigma_z \rangle$ is a quantity that takes the value $+1$ if a $|0\rangle$/$|1\rangle$ measurement is certain to give the outcome $|0\rangle$, and takes the value $-1$ if the measurement would certainly give the outcome $|1\rangle$. Otherwise we'll find $1 > \langle \sigma_z \rangle > -1$, with the value depending on the probabilities. For example, the value is $\langle \sigma_z \rangle = 0$ for a $50/50$ mix.

The quantity $\langle \sigma_x \rangle$ is the same but for a $|+\rangle$/$|-\rangle$ measurement (this is equivalent to doing a Hadamard immediately before a $|0\rangle$/$|1\rangle$ measurement). Similarly for $\langle \sigma_y \rangle$, but no-one ever cares much about poor $\sigma_y$.

With this method, the state $\vert 0 \rangle + \vert 1 \rangle$ (once normalized) is

$$\rho = \frac{1}{2} \left( \mathbb{1} + \sigma_x \right)$$

This has $\langle \sigma_z \rangle = \langle \sigma_y \rangle =0$. So for these two types of measurement, we'd get the outcomes with $50/50$ probabilities. But $\langle \sigma_x \rangle =1$, showing that the outcome for this type of measurement is certain.

For $\vert 0 \rangle \langle 0 \vert + \vert 1 \rangle \langle 1 \vert$ (once normalized) we get

$$\rho = \frac{1}{2} \mathbb{1}$$

$\langle \sigma_\alpha \rangle = 0$ for $x$, $y$ and $z$. All three of these measurements give random results. In fact, so will any kind of measurement.

This way of representing states is explored in IBM's Hello Quantum project, which might be of some additional help (note: I also helped make this).

This question is (in my opinion) the most important question to ask when trying to understand the mathematics of "quantum superposition." Quantum superposition is the essence of how quantum computations are made.

If I have a coin, and I flip it 50% of the times I'll get heads and 50% of the time I can get tails:

P(Tails) = 50%

But if I make a quantum coin and write it in our fancy ket notation:

$|\psi\rangle = \frac{1}{\sqrt{2}}(|H\rangle + |T\rangle)$

I can see that this fancy notation gives me the same results as my coin flip!

P(H) = $| \langle H |\psi\rangle |^2 = \frac{1}{2}$

P(T) = $| \langle T |\psi\rangle |^2 = \frac{1}{2}$

So what's even the point? We say there's something special about quantum events, but the math is just the same as flipping coins?

What we need to do is investigate a little deeper to see how a coin is different from a quantum coin:

In the case where we simply check if our quantum coin is heads-or-tails, we don't see how its different from a normal coin. Instead we're going to do a different procedure (with an silly analogy for intuition): Without checking if our coin is heads-or-tails, we insert our quantum coin through a special slot machine. This special slot machine (meant for cheaters) has a trick: if we insert the coin in one orientation (Heads-side pointing to the left) it gives luckier odds than when its inserted in the other orientation (heads-side pointing to the right).

This means that if we flip a coin and (without looking) insert it into the machine, our odds look like this:

$$\text{P(win)} = \frac{1}{2}(P(\text{win|lucky-odds}) + \frac{1}{2}(P(\text{win|unlucky-odds})$$

Half the time we get the lucky odds and half the time we get unlucky odds. (And everyone who plays this slot that doesn't know the trick will get this average between the two odds!)

But what about the quantum coin? The quantum coin will not measure what was measured above. Let's work out the mathematical shapes of quantum mechanics, and define winning the slot machine is as a quantum mechanical operator:

$P(\text{win|lucky-odds}) = |\langle W|H \rangle|^2$ and $P(\text{win|unlucky-odds}) = |\langle W|T \rangle|^2$

But now if I insert the Heads-to-the-left orientation into the slot machine, I get the probability of winning with the lucky odds (same as before), and if the same if the heads-to-the-right orientation.

The difference now is that when I apply my fancy ket state from before $| \psi \rangle = |H\rangle + |T\rangle$, I am now working with a quantum state, so now to find the probabilties I have to square everything:

\begin{align} P(Win) &= |\langle W|\psi\rangle|^2 \\ &= \frac{1}{2}|\langle W | (|H\rangle+|V\rangle)|^2 \\ &= \frac{1}{2}|\langle W|H\rangle + \langle W|T\rangle|^2 \\ &= \frac{1}{2}|\langle W|H\rangle|^2 + |\langle W|T\rangle|^2 \\ & + \langle T|W\rangle \langle W|H\rangle + \langle H|W\rangle \langle W|T\rangle \end{align}

So now putting the "normal coin" together with our "quantum coin":

\begin{align} P_{normal}(Win) &= \frac{1}{2}(P(\text{win|lucky-odds}) + \frac{1}{2}(P(\text{win|unlucky-odds}) \\ P_{quantum}(Win) &= \frac{1}{2}(P(\text{win|lucky-odds}) + \frac{1}{2}(P(\text{win|unlucky-odds}) \\ & + \langle T|W\rangle \langle W|H\rangle + \langle H|W\rangle \langle W|T\rangle \end{align}

We see that we have extra terms that are in the quantum case! These "interference terms" are the terms that are fundamental to what a quantum superposition is!

These "interference terms" change depending on the sign of the quantum superposition. So consider the case when $|\psi\rangle = |H\rangle - |T\rangle$ instead of $|H\rangle + |T\rangle$ :

\begin{align} P_{normal}(Win) &= \frac{1}{2}(P(\text{win|lucky-odds}) + \frac{1}{2}(P(\text{win|unlucky-odds}) \\ P_{quantum}(Win) &= \frac{1}{2}(P(\text{win|lucky-odds}) + \frac{1}{2}(P(\text{win|unlucky-odds}) \\ & - \langle T|W\rangle \langle W|H\rangle - \langle H|W\rangle \langle W|T\rangle \end{align}

The sign actually carries through, and this affects the probabilities to win our slot machine. These weird interference terms are the essence of quantum mechanics, and while the notation of bras and kets are convenient, it's often easy to get lost in the mathematical shapes and not realize the essence or intuition of what's going on!

So finally, to answer your question, what is the difference between $|H\rangle + |T\rangle$ and $|H\rangle \langle H | + |T\rangle \langle T|$? The difference is that $|H\rangle + |T\rangle$ is a quantum coin that has these extra terms shown above. The state: $|H\rangle \langle H | + |T\rangle \langle T|$ is a normal coin without any properties of quantum superposition. It has the porbabilities of $P_{normal}$.

In normal unitary quantum mechanics typically taught in undergraduate classes, it's actually not possible to construct a state that acts like a normal coin without quantum superposition! To get this "normal coin" you actually need to add extra rules to quantum mechanics (called working in the "density matrix" framework).