Quantum computing 2

November 17, 2020 — Support my next blog post, buy me a coffee ☕.

Episode 2 of my series on quantum computing—in this post, I talk about the Schrödinger equation and quantum logic gates, which are the building blocks of quantum circuits and quantum computers.

Schrödinger equation

Let \(\psi\) describe the quantum state of a physical system. As explained in my previous post, \(\psi\) may be a vector or a function. The Schrödinger equation tells us that the time evolution of \(\psi\) is given by $$ i\hbar\frac{\partial}{\partial t}\psi(t) = H\psi(t), $$ where \(H\) is the Hamiltonian operator of the system. If \(H\) is time-independent, then $$ \psi(t) = \exp\left(-\frac{i}{\hbar}tH\right)\psi(0). $$ Note that since \(H\) is a self-adjoint operator, the operator \(\exp\left(-\frac{i}{\hbar}tH\right)\) is a unitary operator.

A consequence of the Schrödinger equation is that starting from a quantum state \(\psi_1\), it is possible to obtain a specific quantum state \(\psi_2\) by evolving the system with the appropriate Hamiltonian for a suitable period of time.

Qubits

In my previous post, I introduced qubits as two-state quantum-mechanical systems and gave the \(y\)-spin of the electron as an example. In practice, qubits actually correspond to the \(z\)-spin of the electron, which I shall quickly review now.

The quantum state \(\psi=(\psi_1,\psi_2)^T\) of an electron, with respect to \(z\)-spin, lives in is the Hilbert space \(\mathbb{C}^2\) of pairs of complex numbers, with inner product $$ \langle\psi,\phi\rangle = \overline{\psi}_1\phi_1 + \overline{\psi}_2\phi_2, $$ and the spin operator along the \(z\)-axis is the Hermitian matrix $$ S_z = \frac{\hbar}{2}\begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}. $$ The eigenvalues are \(\pm\frac{\hbar}{2}\), while the eigenvectors are given by $$ \vert0\rangle=\begin{pmatrix} 1 \\ 0 \end{pmatrix}, \quad \vert1\rangle=\begin{pmatrix} 0 \\ 1 \end{pmatrix}. $$ The quantum state of the electron, with respect to \(z\)-spin, may then be written as $$ \psi = \psi_1\vert0\rangle + \psi_2\vert1\rangle. $$ This is the most general form of a qubit. It includes not only the \(\vert0\rangle\) and \(\vert1\rangle\) qubits, the quantum equivalent of the classical "0" and "1" bits, but also superpositions.

Quantum logic gates

Suppose the electron is in the state \(\vert0\rangle\) and we want to change it to \(\vert1\rangle\). Since the spin Hamiltonian is related to the magnetic field, using the Schrödinger equation, we can obtain \(\vert1\rangle\) from \(\vert0\rangle\) by applying an appropriate magnetic field for a suitable period of time. Mathematically, this means multiplying \(\vert0\rangle\) by an appropriate unitary matrix. This is what quantum logic gates do—these are unitary matrices that act on qubits and correspond to the application of a specific magnetic field for a certain period of time. Quantum logic gates abstract the underlying physics away.

For example, the quantum NOT gate corresponds to the following \(X\) Pauli matrix, $$ X = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}, $$ and has the following NOT-like behavior, $$ X\vert0\rangle = \vert1\rangle, \quad X\vert1\rangle = \vert0\rangle. $$ It is the quantum analog of the classical NOT gate.

The Hadamard gate, which is one of the most important quantum gates, is defined by, $$ H = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 & 1 \\ 1 & - 1 \end{pmatrix}. $$ It has a more sophisticated behavior since it puts the basis states into a superposition, $$ \begin{align} & H\vert0\rangle = \frac{1}{\sqrt{2}}(\vert0\rangle + \vert1\rangle), \\ & H\vert1\rangle = \frac{1}{\sqrt{2}}(\vert0\rangle - \vert1\rangle). \end{align} $$

Tensor products

The quantum states of two electrons, with respect to \(z\)-spin, may be described in the tensor product basis as $$ \begin{align} \psi = \psi_1\vert0\rangle\otimes\vert0\rangle + \psi_2\vert0\rangle\otimes\vert1\rangle + \psi_3\vert1\rangle\otimes\vert0\rangle + \psi_4\vert1\rangle\otimes\vert1\rangle, \end{align} $$ where the tensor product basis vectors are given by $$ \begin{align} & \vert0\rangle\otimes\vert0\rangle=\begin{pmatrix} 1 \\ 0 \\ 0 \\ 0 \end{pmatrix}, \quad \vert0\rangle\otimes\vert1\rangle=\begin{pmatrix} 0 \\ 1 \\ 0 \\ 0 \end{pmatrix}, \\\\ & \vert1\rangle\otimes\vert0\rangle=\begin{pmatrix} 0 \\ 0 \\ 1 \\ 0 \end{pmatrix}, \quad \vert1\rangle\otimes\vert1\rangle=\begin{pmatrix} 0 \\ 0 \\ 0 \\ 1 \end{pmatrix}. \end{align} $$ It is possible to define quantum logic gates for systems of electrons as well. For instance, the qantum controlled NOT gate is given by the following \(C_X\) matrix, $$ C_X = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \end{pmatrix}. $$ Its action on the basis vectors is as follows, $$ \begin{align} & C_X\big(\vert0\rangle\otimes\vert0\rangle\big) = \vert0\rangle\otimes\vert0\rangle, \\[1.5pt] & C_X\big(\vert0\rangle\otimes\vert1\rangle\big) = \vert0\rangle\otimes\vert1\rangle, \\[1.5pt] & C_X\big(\vert1\rangle\otimes\vert0\rangle\big) = \vert1\rangle\otimes\vert1\rangle, \\[1.5pt] & C_X\big(\vert1\rangle\otimes\vert1\rangle\big) = \vert1\rangle\otimes\vert0\rangle. \end{align} $$

There are many more quantum gates, including the Pauli-\(Y\) and Pauli-\(Z\) gates, and the SWAP gate. Quantum gates are then combined into sequences to form quantum circuits.

In the next post, I will talk about using quantum computing for solving nonlinear ordinary differential equations.


Blog posts about quantum computing

2020   Quantum computing 4

2020   Quantum computing 3

2020   Quantum computing 2

2020   Quantum computing 1