# How to find the matrix representation of an operator from its action on a basis?

First, I apologize if something is poorly written but English is not my first language.

I know that these exercises have been solved in this question. But I do not agree. Inner product and concrete vectors are used and I think that this question has to be solved only with information we have from the beginning of chapter 2 until the exercise.

So I think we only have to use eq. 2.12 in this way:

if we write $$\left|0\right>=\left|v_{0}\right>$$ and $$\left|1\right>=\left|v_{1}\right>$$ and we use them as input and output basis, we can write (2.12) as $$A\left|v_{j}\right> = \sum_{i} A_{ij} \left|v_{i}\right>$$; so,

$$A\left|v_{0}\right> = A_{00}\left|v_{0}\right> + A_{10}\left|v_{1}\right> = \left|v_{1}\right> \Rightarrow A_{00}=0; A_{10}=1$$

$$A\left|v_{1}\right> = A_{01}\left|v_{0}\right> + A_{11}\left|v_{1}\right> = \left|v_{0}\right> \Rightarrow A_{01}=1; A_{11}=0$$

$$A = \begin{bmatrix} 0 & 1\\ 1 & 0 \end{bmatrix}$$

As we can see I don't use concrete basis vectors and this works for basis $$\begin{pmatrix}0 \\1 \end{pmatrix}$$ and $$\begin{pmatrix}1 \\0 \end{pmatrix}$$.

But not with basis like $$\frac{1}{\sqrt{2}}\begin{pmatrix}1 \\1 \end{pmatrix}$$ and $$\frac{1}{\sqrt{2}}\begin{pmatrix}1 \\-1 \end{pmatrix}$$.

My feeling was that this solution doesn't depend on the basis but it does. So why?

• @Sam Palmer Erm, why not? You can write each element in the first basis as a linear combination of the second basis elements and the other way around. So their spans are the same. – Rammus Jun 26 '20 at 19:07
• @Rammus sorry, yes my mistake, however for an illustration of why it is dependant on the basis try drawing both sets of basis as axes in $\mathbb{R}^2$. So to find $A$ that 'swaps' the basis you need to reflect along the plane at $45^o$ to the axes, thus you can see that as the axes are rotated around so does this plane of reflection, so $A$ depends on the basis$– Sam Palmer Jun 26 '20 at 19:28 • I don't quite understand the question. Why shouldn't it work for the other basis you mention? You correctly show that for any pair of orthonormal vectors$v,w$, if$Av=w$and$Aw=v$, then$A$has that matrix representation. This works in the computational basis, the$|\pm\rangle$basis, or any other – glS Jun 26 '20 at 20:36 • @glS May be I'm not doing well calculations but$A \frac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ 1 \end{pmatrix} \ne \frac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ -1 \end{pmatrix}$and$A \frac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ -1 \end{pmatrix} \ne \frac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ 1 \end{pmatrix}$– user12503 Jun 26 '20 at 21:56 • the basis$|v_0\rangle,|v_1\rangle$, whatever that means for you. If you decide that$|v_0\rangle=(1,0)$and$|v_1\rangle=(0,1)$, then those are your "values". I don't really understand what you are confused about. Also about the comment above, there is no contradiction, reread the comment more carefully. I'm saying that in the basis$|\pm\rangle$, if$A$is defined as such that$A|\pm\rangle=|\mp\rangle$, then$A=\begin{pmatrix}0&1\\1&0\end{pmatrix}$. This does not contradict that if$A=\begin{pmatrix}0&1\\1&0\end{pmatrix}$in the computational basis, then$A|\pm\rangle=\pm|\pm\rangle$– glS Jun 27 '20 at 12:14 ## 2 Answers A simple explanation is if we look geometrically at what $$A$$ is doing, which is a reflection. For orthogonal basis $$|v_1\rangle, |v_2\rangle$$ we want to find unitary transform $$A$$, where $$A|v_1\rangle = |v_2\rangle$$, and $$A|v_2\rangle = |v_1\rangle$$, i.e. we want to find a reflection matrix. We want to find the vector, $$r$$, that reflects $$|v_1\rangle$$ to $$|v_2\rangle$$, and this is dependant on the choice of $$|v_1\rangle$$ to $$|v_2\rangle$$. The axis of reflection is the vector inbetween so $$r = \frac{1}{2}\left( |v_1\rangle - |v_2\rangle \right)$$. Using the Householder identity for the reflection matrix $$R = I - 2rr^T = A$$, gives us $$A$$ which is dependent on the basis vectors. As an example for the computational basis we get: $$r = 0.5\begin{pmatrix} 1 \\ 0 \end{pmatrix} - \begin{pmatrix} 0 \\ 1 \end{pmatrix} = \begin{pmatrix} 0.5 \\ -0.5 \end{pmatrix}$$ plugging this into the Householder identity: $$A = I - 2\begin{pmatrix} 0.5 \\ -0.5 \end{pmatrix}\begin{pmatrix} 0.5 & -0.5 \end{pmatrix} = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}$$. Repeating this for your second basis vectors we can find that we are reflecting about the x-axis, if you can't immediately see this try plotting the two basis vectors. We then get, $$A = \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}$$ • thanks for your demonstration but this is not the problem for me. It's clear from the beginning that different basis give different values for$A$. I'm thinking it's a problem with language. I'm really sorry. My problem is that I've got as result$A=\begin{bmatrix} 0 1 \\ 1 0 \end{bmatrix}$without giving any concrete value to the basis. If you look my calculations, I don't use any special basis. But, this result is valid only for basis like computational basis or basis like (1,2) (2,1) and so on. – user12503 Jun 27 '20 at 11:29 • I think your getting getting confused with the notation of the book, as someone who is self studying I've found sometimes it is not the clearest notation, and you have to look at other sources, or trust your own gut. In this case I think this is bad notation as you must remember that the element of the matrix$A_{i,j}$doesn't act on the whole vector$v_j$, but on the individual components of$v_j\$, just write out the matrix vector multiplication in full rather than the shorthand given in the book. – Sam Palmer Jun 27 '20 at 12:25
• Sam Palmer, thanks for all ... I'm going to follow your advice. – user12503 Jun 27 '20 at 13:44

Ok I think I've got it. The first part of my question is correct; the second one no. The big mistake is that I've tried to use eq 2.12 with the elements of vectors and not with the vectors themselves.

As I've done before, taking any basis, say $$|v_{0}\rangle$$ and $$|v_{1}\rangle$$, I'm looking for the matrix representation of the lineal operator $$A$$ such that $$A |v_{0}\rangle = |v_{1}\rangle$$ and $$A |v_{1}\rangle = |v_{0}\rangle$$. Applying eq. 2.12 we obtain:

$$A |v_{0}\rangle = A_{00} |v_{0}\rangle + A_{10} |v_{1}\rangle = |v_{1}\rangle \Rightarrow A_{00} = 0; A_{10} = 1$$

$$A |v_{1}\rangle = A_{01} |v_{0}\rangle + A_{11} |v_{1}\rangle = |v_{0}\rangle \Rightarrow A_{01} = 0; A_{11} = 1$$

$$A = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}$$

And now my mistake:

I said this works for computational basis $$\begin{pmatrix} 0 \\ 1 \end{pmatrix}$$ and $$\begin{pmatrix} 1 \\ 0 \end{pmatrix}$$ but not for $$\frac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ 1 \end{pmatrix}$$ and $$\frac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ -1 \end{pmatrix}$$ basis.

And I said that because I did these wrong calculations:

• With computational basis:

$$A |v_{0}\rangle = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix} \begin{pmatrix} 0 \\ 1 \end{pmatrix} = \begin{pmatrix} 0 \times 0 + 1 \times 1 \\ 1 \times 0 + 0 \times 1 \end{pmatrix} = \begin{pmatrix} 1 \\ 0 \end{pmatrix} = |v_{1}\rangle$$

• With the other basis:

$$A |v_{0}\rangle = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix} \frac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ 1 \end{pmatrix} = \frac{1}{\sqrt{2}} \begin{pmatrix} 0 \times 1 + 1 \times 1 \\ 1 \times 1 + 0 \times 1 \end{pmatrix} = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ 1 \end{pmatrix} \ne |v_{1}\rangle$$

I used elements of the vectors and not vectors, so all these calculations are wrong.

Let's see how is the correct way:

• With computational basis:

$$A |v_{0}\rangle = 0 \times |v_{0}\rangle + 1 \times |v_{1}\rangle = 0 \times \begin{pmatrix} 0 \\ 1 \end{pmatrix} + 1 \times \begin{pmatrix} 1 \\ 0 \end{pmatrix} = \begin{pmatrix} 1 \\ 0 \end{pmatrix} = |v_{1}\rangle$$

$$A |v_{1}\rangle = 1 \times |v_{0}\rangle + 0 \times |v_{1}\rangle = 1 \times \begin{pmatrix} 0 \\ 1 \end{pmatrix} + 0 \times \begin{pmatrix} 1 \\ 0 \end{pmatrix} = \begin{pmatrix} 0 \\ 1 \end{pmatrix} = |v_{0}\rangle$$

• With the other basis:

$$A |v_{0}\rangle = 0 \times |v_{0}\rangle + 1 \times |v_{1}\rangle = 0 \times \frac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ 1 \end{pmatrix} + 1 \times \frac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ -1 \end{pmatrix} = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ -1 \end{pmatrix} = |v_{1}\rangle$$

$$A |v_{1}\rangle = 1 \times |v_{0}\rangle + 0 \times |v_{1}\rangle = 1 \times \frac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ 1 \end{pmatrix} + 0 \times \frac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ -1 \end{pmatrix} = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ 1 \end{pmatrix} = |v_{0}\rangle$$

I hope all become clear now. I couldn't explain my problem correctly before. I'm really sorry.

I have to thanks a lot to teclado from another forum web page.