# Simple Quantum Gates

1. May 19, 2012

### brydustin

The example from my text book shows one example of how to compute the matrix for a gate.
The example is the U_CNOT operator: |00> -> |00>, |01> -> |01>; |10>->|11>; |11>->|10>

Then they show that the operator is merely the sum of the outer products of these.

|00><00| + |10><10| + |01><11| + |11><01| = [ I 0 ; 0 X] : where X is the "NOT" operator.

When I perform the same sort of computation with the "top" part of the circuit as the "target bit" and the bottom part as the "control bit" I get the identity; however, my first intuition was that it should be [X 0; 0 I] (which is also wrong). The correct answer is that it should be:
[1 0 0 0; 0 0 0 1; 0 0 1 0 ; 0 1 0 0 ] (that's row by row). I understand how to read the circuit, but not how to compute the associated matrix.

I've noticed that if I put the basis set into a "vector" then I can get the computation to work out, but this seems kinda "hand-wavy":
$$\begin{pmatrix} 1 &\0 &\0 &\0 \\ 0 &\0 &\0 &\1 \\ 0 &\0 &\1 &\0 \\ 0 &\1 &\0 &\0 \end{pmatrix} \begin{pmatrix}|00) \\ |01)\\ |10)\\ |11)\\ \end{pmatrix}= \begin{pmatrix}|00) \\ |11)\\ |10)\\ |01)\\ \end{pmatrix}$$

For example I suppose this will also work:

$$\begin{pmatrix} \alpha &\0 &\0 &\0 \\ \beta &\1 &\1 &\0 \\ \gamma &\--1 &\0 &\+1 \\ \delta &\1 &\0 &\0 \end{pmatrix} \begin{pmatrix}|00) \\ |01)\\ |10)\\ |11)\\ \end{pmatrix}= \begin{pmatrix}|00) \\ |11)\\ |10)\\ |01)\\ \end{pmatrix} : {\alpha, \beta,\gamma,\delta \in Reals}$$

Last edited: May 19, 2012