# Quantum Operations: Unitary and Reversible Matrices

(Kurzgesagt – In a Nutshell)

In classical computation, there are four basic operations that act on information bits, namely Identity (no operation), Negation (NOT), Conjunction (AND), and Disjunction (OR). All other operations are secondary and built upon these four operations. That being said, with the primary and secondary operations, one is able to perform any calculation in classical fashion. Since every operation can be implemented as a logic gate in the circuit, all calculations come down to a specific sequence of logic gates. In the quantum realm, quantum operations, or quantum logic gates, are an anology to classical gates but for qubits given the difference between classical and quantum configuration.

#### A principle of quantum operations

A fundamental property of qubits is that they are constrained by the normalization condition, i.e. sum of amplitudes’ square equal 1. Because operations act on a set of qubits and transform them to another quantum state, the operations must preserve the normalization throughout the whole process. Mathematically, the possible operations are matrices that preserve the Euclidean norm of a vector state they apply on. This kind of matrices are called *unitary matrices* denoted as $U$. A simple way to verify a matrix’s unitarity is to check the equation:
$$U^{\dagger}U=UU^{\dagger}=I \text{ (Eq.1)}$$
where $U^{\dagger}$ ($U$ dagger) is the conjugate transpose of $U$, which means to take the transpose of $U$ and then take the complex conjugate of each of the transpose’ entries. Applying each of a few unitary matrices on quantum state $\left|\psi\right\rangle = \alpha\left|0\right\rangle + \beta\left|1\right\rangle$ results in a new state corresponding to the meaning of the operation.
$$I \text{ (Identity)}= \begin{bmatrix}
1 & 0\\
0 & 1
\end{bmatrix}; I\left|\psi\right\rangle = \begin{bmatrix}
1 & 0\\
0 & 1
\end{bmatrix}\begin{bmatrix}
\alpha\\
\beta
\end{bmatrix} = \begin{bmatrix}
\alpha\\
\beta
\end{bmatrix} = \alpha\left|0\right\rangle + \beta\left|1\right\rangle$$

$$X \text{ (NOT)}= \begin{bmatrix} 0 & 1\\ 1 & 0 \end{bmatrix}; X\left|\psi\right\rangle = \begin{bmatrix} 0 & 1\\ 1 & 0 \end{bmatrix}\begin{bmatrix} \alpha\\ \beta \end{bmatrix} = \begin{bmatrix} \beta\\ \alpha \end{bmatrix} = \beta\left|0\right\rangle + \alpha\left|1\right\rangle$$

$$H \text{ (Hadamard)}= \begin{bmatrix} \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}}\\ \frac{1}{\sqrt{2}} & -\frac{1}{\sqrt{2}} \end{bmatrix}; H\left|\psi\right\rangle = \begin{bmatrix} \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}}\\ \frac{1}{\sqrt{2}} & -\frac{1}{\sqrt{2}} \end{bmatrix} \begin{bmatrix} \alpha\\ \beta \end{bmatrix} = \begin{bmatrix} \frac{1}{\sqrt{2}}\alpha + \frac{1}{\sqrt{2}}\beta\\ \frac{1}{\sqrt{2}}\alpha - \frac{1}{\sqrt{2}}\beta \end{bmatrix} = \frac{\alpha +\beta}{\sqrt{2}}\left|0\right\rangle + \frac{\alpha -\beta}{\sqrt{2}}\left|1\right\rangle$$

$$R_y(\theta) \text{ (Rotation about y-axis)}= \begin{bmatrix} \cos\theta & -\sin\theta\\ \sin\theta & \cos\theta \end{bmatrix}; R_y(\theta)\left|\psi\right\rangle = \begin{bmatrix} \cos\theta & -\sin\theta\\ \sin\theta & \cos\theta \end{bmatrix}\begin{bmatrix} \alpha\\ \beta \end{bmatrix} = \begin{bmatrix} \alpha\cos\theta-\beta\sin\theta\\ \alpha\sin\theta+\beta\cos\theta \end{bmatrix}$$

As you can see in the (Eq.1), because the product of $U$ and $U^{\dagger}$ is equal to the identity operation, any quantum operation can be reverted by applying its complex conjugate on the new state, allowing every quantum operation to be reversible. Please keep in mind that reversibility is a special property of quantum operations. It isn’t always inherent in classical operations. For example, an $\text{AND}$ operation results in outcome $0$ when two inputs is any pair of ${(0,0),(0,1),(1,0)}$; there is no obvious way to retrieve the actual pair of input numbers from the output $0$. On the other hand, it’s easy to verify $XX^\dagger\left|\psi\right\rangle =XX\left|\psi\right\rangle = I\left|\psi\right\rangle = \left|\psi\right\rangle$ by matrix multiplication or just common sense: negate $\left|\psi\right\rangle$ twice keeps the state unchanged.

#### Acting on multiple qubits

In the section above, we have just discussed about single-qubit operators. These nevertheless aren’t enough to transform a quantum system into whatever the state of our interest. There are classes of transformation operating on many qubits simultaneously. A good paradigm in case of two qubits is $$CNOT = \begin{bmatrix} 1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0\\0 & 0 & 0 & 1\\0 & 0 & 1 & 0 \end{bmatrix}$$ CNOT is simply Controlled NOT, which takes a qubit as control qubit and another as target qubit. Intuitively, the operator will only flip the state of the target qubit if the control qubit is one, and do nothing if the control is zero. In the next example, we use the left qubit as the control and the right one target. $$\begin{matrix} CNOT& (\alpha_{00}\left|00\right\rangle+\alpha_{01}\left|01\right\rangle+\alpha_{10}\left|10\right\rangle+\alpha_{11}\left|11\right\rangle) \\ &=\alpha_{00}\left|00\right\rangle+\alpha_{01}\left|01\right\rangle+\alpha_{10}\left|11\right\rangle+\alpha_{11}\left|10\right\rangle \end{matrix}$$ Theoretically, it’s possible to construct more ‘controlled’ gates or operators. They will be based on the same principle in the two-qubit situation. Although using such operators gives us a degree of convenience, there are no realible gates that acts on three or more qubits have been engineered in reality. Fortunately, this problem might not be a serious barrier because any gate of higher level can be built using only one- or two-qubit quantum gate.

A combination of low-level gates together can perform any qubit transformation. In theory, their functions add up into an operator determined by their tensor product. Assume that Trong has two qubits; he wants to transform the first one into the Hadamard state while flipping the other qubit. The collective effect follows from the two operators’ tensor product:

$$H\otimes X = \begin{bmatrix} \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} & -\frac{1}{\sqrt{2}} \end{bmatrix} \otimes \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix} = \begin{bmatrix} \frac{1}{\sqrt{2}}\begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix} & \frac{1}{\sqrt{2}}\begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix} \\ \frac{1}{\sqrt{2}}\begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix} & -\frac{1}{\sqrt{2}}\begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix} \end{bmatrix} = \begin{bmatrix} 0 & \frac{1}{\sqrt{2}} & 0 & \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} & 0 & \frac{1}{\sqrt{2}} & 0 \\ 0 & \frac{1}{\sqrt{2}} & 0 & -\frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} & 0 & -\frac{1}{\sqrt{2}} & 0\end{bmatrix}$$

Applying this combined operator to a Bell state $\left|\Psi\right\rangle = \frac{1}{\sqrt{2}}\left(\left|00\right\rangle + \left|11\right\rangle\right)$ results in

$$(H\otimes X)\left|\Psi\right\rangle = \begin{bmatrix} 0 & \frac{1}{\sqrt{2}} & 0 & \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} & 0 & \frac{1}{\sqrt{2}} & 0 \\ 0 & \frac{1}{\sqrt{2}} & 0 & -\frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} & 0 & -\frac{1}{\sqrt{2}} & 0\end{bmatrix} \begin{bmatrix}\frac{1}{\sqrt{2}} \\ 0 \\ 0 \\ \frac{1}{\sqrt{2}} \end{bmatrix}= \begin{bmatrix} \frac{1}{2} \\ \frac{1}{2} \\ -\frac{1}{2} \\ \frac{1}{2}\end{bmatrix} = \frac{1}{\sqrt{2}}\left( \left|00\right\rangle + \left|01\right\rangle - \left|10\right\rangle + \left|11\right\rangle \right)$$

Trong verifies his multiplication by comparing with the result produced directly using Dirac notations.

$$\frac{1}{\sqrt{2}}\left(\left|00\right\rangle + \left|11\right\rangle\right) \overset{H\otimes I}{\rightarrow} \frac{1}{2}\left( \left|00\right\rangle + \left|10\right\rangle + \left|01\right\rangle - \left|11\right\rangle \right) \overset{I\otimes X}{\rightarrow} \frac{1}{2}\left( \left|01\right\rangle + \left|11\right\rangle + \left|00\right\rangle - \left|10\right\rangle \right) $$

It was proven that any quantum manipulation can be performed by a set of basic quantum gates. These gates are call universal gates and just include one and two-qubit gates. This universality will be discussed in one other post.

Before coming to the end, we’ll go through some nice properties of tensor product. First, the product is an associative operation: $(A \otimes B) \otimes C = A \otimes (B \otimes C)$ so that it makes sense to write a sequence of tensor products straight out without parentheses. Second, operations acting on a same subset of qubit blends their effect altogether with the assumption that the products $AC$ and $BD$ make sense: $$(A \otimes B)(C \otimes D) = (AC \otimes BD)$$ Third, the distributive laws hold for tensor product: $$A \otimes (B+C) = A \otimes B + A \otimes C $$ Finally, a scalar can go anywhere between components of a product: $$(\alpha A) \otimes B = A \otimes (\alpha B) $$

Next time we will expand the concept of quantum operations to explain things like measurement and observable.