# Nielsen & Chuang Exercise 2.2 - “Matrix representations: example” [closed]

Reproduced from Exercise 2.2 of Nielsen & Chuang's Quantum Computation and Quantum Information (10th Anniversary Edition):

Suppose $$V$$ is a vector space with basis vectors $$|0\rangle$$ and $$|1\rangle$$, and $$A$$ is a linear operator from $$V$$ to $$V$$ such that $$A|0\rangle = |1\rangle$$ and $$A|1\rangle = |0\rangle$$. Give a matrix representation for $$A$$, with respect to the input basis $$|0\rangle, |1\rangle$$, and the output basis $$|0\rangle, |1\rangle$$. Find input and output bases which give rise to a different matrix representation of $$A$$.

Note: This question is part of a series attempting to provide worked solutions to the exercises provided in the above book.

## closed as off-topic by Sanchayan Dutta♦Jan 7 at 15:14

• This question does not appear to be about quantum computing or quantum information, within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

## locked by Sanchayan Dutta♦Jan 7 at 15:17

This question exists because it has historical significance, but it is not considered a good, on-topic question for this site, so please do not use it as evidence that you can ask similar questions here. This question and its answers are frozen and cannot be changed. More info: help center.

Immediately, we can see that $$A = |1\rangle\langle0| + |0\rangle\langle1|.$$ If the input and out bases are $\{|0\rangle, |1\rangle\}$, then $$|0\rangle = \begin{pmatrix} 1 \\ 0 \end{pmatrix}, \quad |1\rangle = \begin{pmatrix} 0 \\ 1 \end{pmatrix} \quad\textrm{and}\quad \langle0| = \begin{pmatrix} 1 & 0 \end{pmatrix}, \quad \langle1| = \begin{pmatrix} 0 & 1 \end{pmatrix},$$ so we can write the first equation as \begin{align} A &= \begin{pmatrix} 1 \\ 0 \end{pmatrix} \otimes \begin{pmatrix} 0 & 1 \end{pmatrix} + \begin{pmatrix} 0 \\ 1 \end{pmatrix} \otimes \begin{pmatrix} 1 & 0 \end{pmatrix} \\ &= \begin{pmatrix} 0 & 1 \\ 0 & 0 \end{pmatrix} + \begin{pmatrix} 0 & 0 \\ 1 & 0 \end{pmatrix}\\ &= \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix} \end{align} to solve the first question. Note that in this case, $A$ is the equal to the bitflip or Pauli $X$ operation.
Secondly, for fun, let us choose to write $A$ in input basis $\{|+\rangle, |-\rangle\}$, where $$|+\rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle) \quad\textrm{and}\quad |-\rangle = \frac{1}{\sqrt{2}}(|0\rangle - |1\rangle)$$ and output basis $\{|L\rangle, |R\rangle\}$, where $$|L\rangle = \frac{1}{\sqrt{2}}(|0\rangle + i|1\rangle) \quad\textrm{and}\quad |R\rangle = \frac{1}{\sqrt{2}}(|0\rangle - i|1\rangle).$$ Rewriting our original $\{|0\rangle, |1\rangle\}$ bases vectors in terms of the above bases, we find \begin{align} |0\rangle &= \frac{1}{\sqrt{2}}(|+\rangle + |-\rangle) = \frac{1}{\sqrt{2}}(|L\rangle + |R\rangle) \quad \textrm{and}\\ |1\rangle &= \frac{1}{\sqrt{2}}(|+\rangle - |-\rangle) = \frac{i}{\sqrt{2}}(|R\rangle - |L\rangle), \end{align} with $\langle0| = (|0\rangle)^\dagger$ and $\langle1| = (|1\rangle)^\dagger$.
From this we can rewrite $A$ as \begin{align} A &= \frac{i}{2}(|R\rangle - |L\rangle)(\langle+| + \langle-|) + \frac{1}{2}(|L\rangle + |R\rangle)(\langle+| - \langle-|) \\ &= \frac{1}{2}\big[ (1+i)|R\rangle\langle+| + (1-i)|L\rangle\langle+| + (-1+i)|R\rangle\langle-| + (-1-i)|L\rangle\langle-|\big] \\ &= \frac{1+i}{2}(|R\rangle\langle+| - i|L\rangle\langle+| + i|R\rangle\langle-| - |L\rangle\langle-|) \end{align} To get $A$ in the desired matrix form, we then set $$|L\rangle = \begin{pmatrix} 1 \\ 0 \end{pmatrix}, \quad |R\rangle = \begin{pmatrix} 0 \\ 1 \end{pmatrix} \quad\textrm{and}\quad \langle+| = \begin{pmatrix} 1 & 0 \end{pmatrix}, \quad \langle-| = \begin{pmatrix} 0 & 1 \end{pmatrix},$$ such that $$A = \frac{1+i}{2} \begin{pmatrix} -i & -1 \\ 1 & i \end{pmatrix}.$$
• How do you know that $\left|0\right> = \begin{pmatrix} 1 \\ 0 \end{pmatrix}, \quad \left|1\right> = \begin{pmatrix} 0 \\ 1 \end{pmatrix}$ ? Do the vectors always have these components? – Turkhan Badalov Aug 15 '18 at 20:20
• Just wondering, if $\left|0\right> = \begin{pmatrix} 1 \\ 0 \end{pmatrix}$, why is it that you can also set $\left|L\right> = \begin{pmatrix} 1 \\ 0 \end{pmatrix}$? – wei2912 Nov 4 '18 at 8:28