[Math] Pauli Operator acting on Hadamard Basis doesn’t behave as I would expect

linear algebraquantum-computationquantum-information

I'm currently reading through some elementary quantum computing materials (McMahon; Quantum Computing Explained) and have become confused over the action of an operator in outer-product form.

The Pauli Matrices are defined as:
$$
\sigma_x^c=
\begin{pmatrix}
0 & 1\\
1 & 0\\
\end{pmatrix}
$$
$$
\sigma_y^c =
\begin{pmatrix}
0 & -i\\
i & 0\\
\end{pmatrix}
$$
$$
\sigma_z^c=
\begin{pmatrix}
1 & 0\\
0 & -1\\
\end{pmatrix}
$$

I take the above to be matrix representations with respect to the computational basis
$|0\rangle=\bigl(\begin{smallmatrix}
1\\
0\\
\end{smallmatrix}\bigr)$
and
$|0\rangle=\bigl(\begin{smallmatrix}
0\\
1\\
\end{smallmatrix}\bigr)$
. I know that an alternative basis for $\mathbb C^2$ is the Hadamard basis
$|+\rangle= \frac{1}{\sqrt2} \bigl(\begin{smallmatrix}
1\\
1\\
\end{smallmatrix}\bigr)$
and
$|-\rangle= \frac{1}{\sqrt2} \bigl(\begin{smallmatrix}
1\\
-1\\
\end{smallmatrix}\bigr)$

From this I calculate the change of basis matrix from the computational basis to the Hadamard basis like so:
$$
H=
\begin{pmatrix}
\langle + | 0 \rangle & \langle + | 1 \rangle\\
\langle – | 0 \rangle & \langle – | 1 \rangle\\
\end{pmatrix}
=
\frac{1}{\sqrt2}
\begin{pmatrix}
1 & 1\\
1 & -1\\
\end{pmatrix}
$$

From now I will use $\sigma_x$ as my example. Using the change of basis matrix (Hadamard matrix) to transform $\sigma^c_x$ to its equivalent representation in the Hadamard basis I get:
$$
\sigma^H_x=
\frac{1}{\sqrt2}
\begin{pmatrix}
1 & 1\\
1 & -1\\
\end{pmatrix}
\begin{pmatrix}
0 & 1\\
1 & 0\\
\end{pmatrix}
\frac{1}{\sqrt2}
\begin{pmatrix}
1 & 1\\
1 & -1\\
\end{pmatrix}
=
\begin{pmatrix}
1 & 0\\
0 & -1\\
\end{pmatrix}
$$

Noting that the relationship between an operator (basis independent) and its matrix representation (basis dependent) in the computational and Hadamard bases is like so:
$$
\sigma_x^c=
\begin{pmatrix}
\langle 0 | \hat{\sigma_x} | 0 \rangle & \langle 0 | \hat{\sigma_x} | 1 \rangle\\
\langle 1 | \hat{\sigma_x} | 0 \rangle & \langle 1 | \hat{\sigma_x} | 1 \rangle\\
\end{pmatrix}
$$
$$
\sigma_x^H
=
\begin{pmatrix}
\langle + | \hat{\sigma_x} | + \rangle & \langle + | \hat{\sigma_x} | – \rangle\\
\langle – | \hat{\sigma_x} | + \rangle & \langle – | \hat{\sigma_x} | – \rangle\\
\end{pmatrix}
$$

I now have two expressions each for $\sigma_x^c$ and $\sigma_x^H$ which I can compare and read off the operator form of the Pauli X-operator:

$$\hat{\sigma_x} = |0\rangle\langle 1|+|1\rangle\langle 0| = |+\rangle\langle +|-|-\rangle\langle -| $$

So now I can act the operators/matrices on Basis states as I choose; and as it is generally referred to as the NOT gate, I expect it to flip between basis states.

Working in the computational basis works as expected:
$$\hat{\sigma_x}|0\rangle =
\sigma_x^c
\begin{pmatrix}
1\\
0\\
\end{pmatrix}
=
\begin{pmatrix}
0 & 1\\
1 & 0\\
\end{pmatrix}
\begin{pmatrix}
1\\
0\\
\end{pmatrix}
=
\begin{pmatrix}
0\\
1\\
\end{pmatrix}
=
|1\rangle $$

$$\hat{\sigma_x}|1\rangle =
\sigma_x^c
\begin{pmatrix}
0\\
1\\
\end{pmatrix}
=
\begin{pmatrix}
0 & 1\\
1 & 0\\
\end{pmatrix}
\begin{pmatrix}
0\\
1\\
\end{pmatrix}
=
\begin{pmatrix}
1\\
0\\
\end{pmatrix}
=
|0\rangle $$

And it is obvious that the outer-product form as defined above behaves in the same way – like a NOT gate, so all is as expected.

Looking at the Hadamard basis in matrix formalism gives:
$$\hat{\sigma_x}|+\rangle =
\sigma_x^H
\frac{1}{\sqrt2}
\begin{pmatrix}
1\\
1\\
\end{pmatrix}
=
\begin{pmatrix}
1 & 0\\
0 & -1\\
\end{pmatrix}
\frac{1}{\sqrt2}
\begin{pmatrix}
1\\
1\\
\end{pmatrix}
=
\frac{1}{\sqrt2}
\begin{pmatrix}
1\\
-1\\
\end{pmatrix}
=
|-\rangle $$

$$\hat{\sigma_x}|-\rangle =
\sigma_x^H
\frac{1}{\sqrt2}
\begin{pmatrix}
1\\
-1\\
\end{pmatrix}
=
\begin{pmatrix}
1 & 0\\
0 & -1\\
\end{pmatrix}
\frac{1}{\sqrt2}
\begin{pmatrix}
1\\
-1\\
\end{pmatrix}
=
\frac{1}{\sqrt2}
\begin{pmatrix}
1\\
1\\
\end{pmatrix}
=
|+\rangle $$

So again this acts as I would expect it to, it flips the basis states like a NOT operator. Apologies for the tedious detail that it took me to get to this point, but my question is this: Why then, when I act the operator form expressed using the Hadamard basis, do I get a different result from the matrix form:

$$\hat{\sigma_x}|+\rangle = (|+\rangle\langle +|-|-\rangle\langle -|)|+\rangle = |+\rangle$$

$$\hat{\sigma_x}|-\rangle = (|+\rangle\langle +|-|-\rangle\langle -|)|-\rangle = -|-\rangle$$

Again sorry for the essay, but as I'm sure this is a silly flaw in my logic I thought it best to map out all of my reasoning.

What am I doing wrong/not understanding?

Best Answer

The operator associated with $\sigma_x$ -- let me write $X$ for this -- is a (real) self adjoint operater and as such has two eigenvalues and corresponding eigenvectors. This means there are numbers $a, b$ and (orthogonal unit) vectors $v_a, v_b$ such that $$Xv_a = a v_a, Xv_b = b v_b$$

So $X$ cannot flip the members of every possible orthonormal basis, in particular it will not flip the members of this basis of eigenvectors.

It's rather easy to see that you may choose $a=1, b = -1$ and $v_a =\frac{1}{\sqrt{2}}\left( \array{1\\1}\right)$ $v_b = \frac{1}{\sqrt{2}}\left( \array{ 1\\ -1}\right)$, so your basis $|+\rangle, |-\rangle$ is just a basis of eigenvectors of (the operator!) $X$.

This means the calculation using the operator form with the Hadamard basis is correct.

The error happens in the formula after the statement "Looking at the Hadamard basis in matrix formalism gives: ". If you write down a matrix representation for $X$ with respect to the Hadamard basis you have to use the correct coordinate representation for this basis $|+\rangle, |-\rangle$ with respect to that basis.

This is just $\left( \array{1\\0}\right)$ for $|+\rangle$ and $\left( \array{0\\1}\right)$ for $|-\rangle$, respectively, and not $\frac{1}{\sqrt{2}}\left( \array{1\\1}\right)$ and $\frac{1}{\sqrt{2}}\left( \array{1\\-1}\right)$.