# How is outer product an operator?

I was going through Qiskit online text book and came across this part. The relevant (slightly modified) paragraph is -

Suppose we have two states $$|\psi_0\rangle$$ and $$|\psi_2\rangle$$. Their inner product would be $$\langle\psi_0|\psi_1\rangle$$. If we apply the same $$U$$ to both, the inner product of the resulting states would still be the same -

The Hermitian conjugate of first state, after applying $$U$$ would be $$\langle\psi_0|U^\dagger$$. So inner product would be $$(\langle\psi_0|U^\dagger)\ (|\psi_1\rangle U)= \langle\psi_0|UU^\dagger|\psi_1\rangle =\langle\psi_0|\psi_1\rangle$$ This property provides us with a useful way of thinking about these gates. It means that for any set of states $$\{|\psi_j\rangle\}$$, that provide an orthonormal basis for our system, the set of states$$\{|\phi_j\rangle=U|\psi_j\rangle\}$$ will also be an orthonormal basis. The unitary can then be thought of as a rotation between these bases, and can be written accordingly as $$U = \sum_j{\lvert\phi_j\rangle\langle\psi_j\rvert}$$

I didn't really get the last part. How is $$U = \sum_j{\lvert\phi_j\rangle\langle\psi_j\rvert}$$ is connected to preceding discussion? How does this follow from previous discussion?

My second question is how $$U = \sum_j{\lvert\phi_j\rangle\langle\psi_j\rvert}$$ is mapping operator as described in this post? How is this derived?

• Welcome to QCSE! Each question should be a separate post. Aug 8 at 6:04

$$U=\sum_{j}|\phi_{j}\rangle\langle\psi_{j}|$$ by the preceding discussion, as $$(\langle\psi_0|U^\dagger)\ (|\psi_1\rangle U)= \langle\psi_0|UU^\dagger|\psi_1\rangle =\langle\psi_0|\psi_1\rangle$$ preserves the I.N. This means we can also write it as $$\langle\psi_0|UU^\dagger|\psi_1\rangle =\langle\phi_0|\phi_1\rangle$$ due to the action of the unitary operator on the states $$|\psi_{0}\rangle$$ and $$|\psi_{1}\rangle$$.

Since this is the case, I can then just expand the unitary operator as sum of the operations that will map a pure state in one basis to a pure state in another, and since the I.N is preserved, those states must also be orthogonal.

I am answering my own question.

Suppose we have a state vector $$|\psi\rangle$$, and we apply a some gate $$U$$ on this state vector, we get -

$$|\phi\rangle = U|\psi\rangle$$

where $$|\phi\rangle$$ is another state vector. In quantum computing, the gate $$U$$ is always an unitary matrix. If set $$\{|\psi_i\rangle\}$$ is a set of orthonormal vectors, the set $$\{|\phi_i\rangle\}$$ will also be a set of orthonormal vectors. This has been shown in question-post.

One important property of unitary matrices to keep in mind is that columns of a unitary matrix represent a set of orthonormal vectors. For example, consider the matrix representation of Hadamard gate -

$$\frac{1}{\sqrt2}\begin{bmatrix}1&1\\1&-1\end{bmatrix}$$

First column is $$\{\frac{1}{\sqrt2},\frac{1}{\sqrt2}\}$$. This gives us the first vector. Similarily, second vector would be $$\{\frac{1}{\sqrt2},-\frac{1}{\sqrt2}\}$$. We can see that length of each vector (normality) is 1. Also their inner product is zero. This shows these vectors form a set of orthonormal vectors.

For simplicity, we'll only consider 2 x 2 matrix. Since columns represent a set of orthonormal vectors, we can write -

$$U = (\vec{v_1}, \vec{v_2})$$

$$\Rightarrow U^\dagger = \begin{bmatrix}{\vec{v_1}^*}\\{\vec{v_2}^*}\end{bmatrix}$$

We also know that -

$$UU^\dagger = U^\dagger U=I$$

Using above two, we can write (in Dirac notation) -

$$(UU^\dagger )=[|v_1\rangle\ |v_2\rangle]\begin{bmatrix}\langle v_1|\\ \langle v_2|\end{bmatrix}=I$$ $$\Rightarrow |v_1\rangle\langle v_1|+|v_2\rangle\langle v_2|=I$$

We can write above expression in more compact form -

$$\sum_{i}{|v_i\rangle\langle v_i|} = I$$

This is an important result.

Now, coming to the question -

..for any set of states $$\{|\psi_j\rangle\}$$, that provide an orthonormal basis for our system, the set of states$$\{|\phi_j\rangle=U|\psi_j\rangle\}$$ will also be an orthonormal basis. The unitary can then be thought of as a rotation between these bases, and can be written accordingly as $$U = \sum_j{|\phi_j\rangle\langle\psi_j|}$$

It is easy to see that -

$$U = \sum_j{|\phi_j\rangle\langle\psi_j|} = \sum_j{U|\psi_j\rangle\langle\psi_j|}$$

$$= U\sum_j{|\psi_j\rangle\langle\psi_j|}$$

The part $$\sum_j{|\psi_j\rangle\langle\psi_j|}$$ equals to 1 as shown earlier which shows that

$$U = \sum_j{|\phi_j\rangle\langle\psi_j|}$$

This completes our proof.