# How to properly write the action of a quantum gate implementing an operator $U$ on the superposition of its eigenvectors?

Let's say, that we are in the possession of a quantum gate, that is implementing the action of such an operator

$$\hat{U}|u \rangle = e^{2 \pi i \phi}|u\rangle$$

Moreover, let's say, that this operator has at least two eigenvectors $$|u\rangle$$ and $$|v\rangle$$, with the following eigenvalues:

$$\hat{U}|u \rangle = e^{2 \pi i \phi_0}|u\rangle$$

$$\hat{U}|v \rangle = e^{2 \pi i \phi_1}|v\rangle$$

If we would like to act with such a quatntum gate on the eigenvector $$|u\rangle$$, we could write this in the matrix form:

$$\hat{U}|u\rangle \equiv \begin{bmatrix} e^{2 \pi i \phi_0} & 0 \\ 0 & e^{2 \pi i \phi_0} \\ \end{bmatrix} |u\rangle \equiv e^{2 \pi i \phi_0} |u\rangle$$

What I want to do, is to act with the $$\hat{U}$$ gate on the superposition of $$|u\rangle$$ and $$|v\rangle$$, that is:

$$\hat{U} [c_0|u\rangle + c_1|v\rangle] = c_0e^{2 \pi i \phi_0}|u\rangle + c_1e^{2 \pi i \phi_1}|v\rangle$$

We could use the following notation to write down eigenvectors $$|u\rangle$$ and $$|v\rangle$$ in the matrix form:

$$|u\rangle = \begin{bmatrix} a_0 \\ a_1 \end{bmatrix}, |v\rangle = \begin{bmatrix} a_2 \\ a_3 \end{bmatrix}$$ Then, we could rewrtie the action $$\hat{U} [c_0|u\rangle + c_1|v\rangle]$$ as

$$\hat{U} [c_0|u\rangle + c_1|v\rangle] = c_0e^{2 \pi i \phi_0}|u\rangle + c_1e^{2 \pi i \phi_1}|v\rangle$$

$$= c_0e^{2 \pi i \phi_0}\begin{bmatrix} a_0 \\ a_1 \end{bmatrix} + c_1e^{2 \pi i \phi_1} \begin{bmatrix} a_2 \\ a_3 \end{bmatrix} = \begin{bmatrix} c_0 e^{2 \pi i \phi_0} a_0 + c_1 e^{2 \pi i \phi_1} a_2 \\ c_0 e^{2 \pi i \phi_0} a_1 + c_1 e^{2 \pi i \phi_1} a_3 \end{bmatrix}$$

Is there any way of writing the $$\hat{U}$$ gate in the matrix form for the above case? The only thing that comes to my mind, is that it should "at the same time" have values $$e^{2 \pi i \phi_0}$$ and $$e^{2 \pi i \phi_1}$$ on its diagonal, but I know that this reasoning is wrong and I was wondering, if there is some official way to write this down.

• There is nothing particularly quantum mechanical about this. To write down U in the standard basis just invert expressions of u and v. This will give you the standard basis vectors in terms of u and v. Once you have this you just have to calculate the four matrix elements. – biryani Nov 17 '18 at 7:44

The most straightforward way to construct the matrix representation of $$U$$ is to write $$U=e^{2\pi i\phi_0}|u\rangle\langle u|+e^{2\pi i\phi_1}|v\rangle\langle v|$$ which will work just fine under the assumption that $$\langle u|v\rangle=0$$ (which must be the case if $$U$$ is going to be unitary).

However, you should also be able to work it out from the maths you were writing down, so long as you impose some of the important properties of the eigenvectors. Firstly, you need $$\langle u|u\rangle=1$$, so $$|a_0|^2+|a_1|^2=1$$. Secondly, you need $$\langle u|v\rangle=0$$, as already mentioned. This means that $$|v\rangle=e^{i\gamma}\left(\begin{array}{c} -a_1^\star \\ a_0^\star \end{array}\right)$$

Now, when trying to work out $$U$$, it helps to pick two different sets of $$(c_0,c_1)$$. In the first, we want $$c_0|u\rangle+c_1|v\rangle=\left(\begin{array}{c} 1 \\ 0 \end{array}\right)$$ because $$U\left(\begin{array}{c} 1 \\ 0 \end{array}\right)$$ is the first column of $$U$$. This is achieved with $$c_0=a_0^\star$$ and $$c_1=-a_1e^{-i\gamma}$$. Similarly, if we can calculate $$U\left(\begin{array}{c} 0 \\ 1 \end{array}\right)$$, using $$c_0=a_1^\star$$ and $$c_1=e^{-i\gamma}a_0$$, we find the second column of $$U$$.

It would be better to ask this on Mathematics Stack Exchange.

Let $$V$$ be the unitary matrix that takes

$$\begin{pmatrix} 1\\ 0 \end{pmatrix} \to \begin{pmatrix} a_0\\ a_1 \end{pmatrix}$$

and

$$\begin{pmatrix} 0\\ 1 \end{pmatrix} \to \begin{pmatrix} a_2\\ a_3 \end{pmatrix}$$

Then

$$V \begin{pmatrix} e^{2\pi i \phi_0} & 0\\ 0 & e^{2 \pi i \phi_1} \end{pmatrix} V^\dagger$$

will take $$(a_0,a_1)$$ to $$(1,0)$$ and then $$e^{2 \pi i \phi_0} (1,0)$$ and then from there $$e^{2 \pi i \phi_0} (a_0,a_1)$$.

Similarly for $$(a_2,a_3)$$

Simple change of basis problem.