Toolbox

T1: Basics on Quantum Computing

Reminder: This post contains 3894 words · 12 min read · by Xianbin

If you know matrix theory, it is easy to master quantum computing.

After reading this post, you will know the basic of quantum computing.

0. Why is so?

You will see some strange notations like \(\vert 0\rangle\), and not that math operations. The reason is that quantum computing is from physics. Those physicists like to express their ideas easily without showing off their math.

1. Qubit

Quantum particle is in two states simultaneously.

A Qubit is in superposition if it is both in \(\vert 0\rangle\) and \(\vert 1\rangle\) where

\[\vert 0\rangle = (1; 0)\] \[\vert 1\rangle = (0;1)\] \[\vert \phi\rangle = \alpha \vert 0 \rangle + \beta \vert 1 \rangle\]

2. Quantum Collapsing

When we measure a quantum system, it will collapse from superposition (many possibilities) into one measured state.

Just recall the famous thought experiment: Schrödinger’s cat.

3. Probability of measuring

\[|\phi\rangle = \alpha \vert 0 \rangle + \beta \vert 1 \rangle\]

The probability of measuring \(\vert 0\rangle\) is \(\lvert \alpha \rvert ^2\). Note that \(\alpha\) can be a complex number.

4. The Strange Notation

\[\vert\phi\rangle = \alpha \vert 0 \rangle + \beta \vert 1 \rangle\]

We call the RHS Dirac Notation. This is so called ket vectors that represent a quantum state.

Bloch Sphere

\[\vert \phi \rangle = cos \frac{\theta}{2} + sin \frac{\theta}{2} e^{i\phi} \vert 1 \rangle\]

where \(\theta\) is the angle between the vector and z-axis and \(\phi\) is the angle between the vector and x-axis.

5. Quantum Circuits

X, Y, Z Gates:

\(X (Y, Z)\) flip the qubit \(\pi\) radians around x(y, z)-axis.

\[X = (1, 0; 0,1), Y = (0 , -i; i , 0), Z = (1, 0; 0, -1)\]

Hadamard Gates

\[H = \frac{1}{\sqrt{2}}(1, 1;1, -1)\]

Apply \(H\), we have

\[\vert 0 \rangle \to \vert + \rangle \to \vert 0 \rangle\] \[\vert 1 \rangle \to \vert -\rangle \to \vert 1\rangle\]

where \(\vert + \rangle = \frac{1}{\sqrt{2}} (\vert 0 \rangle + \vert 1 \rangle)\)

\[\vert -\rangle = \frac{1}{\sqrt{2}} (\vert 0 \rangle - \vert 1 \rangle)\]

CNOT/ Controlled X Gate

CNOT Quantum Circuit:

q0 ───●──── (Control qubit)

q1 ───⊕──── (Target qubit: flips if q0 = 1)

Look at the following relationship:

\[\vert 0 0 \rangle \to \vert 0 0\rangle\] \[\vert 0 1 \rangle \to \vert 0 1\rangle\] \[\vert 1 0 \rangle \to \vert 1 1\rangle\] \[\vert 1 1 \rangle \to \vert 1 0\rangle\]

6. No-Cloning Theorem

This theorem says that we cannot an exact quantum state.

7. Tensor Product

Tensor product is one of the most important tools in quantum computing. We use tensor product to assemble different quantum systems into one system.

\[\left( a; b \right) \otimes (c; d) = (ac; ad; bc; bd).\]

1. Linearity

For vectors \(( \mathbf{v}_1, \mathbf{v}_2, \mathbf{w}_1, \mathbf{w}_2 ) \text { and scalars } ( a, b )\):

\[(a\mathbf{v}_1 + b\mathbf{v}_2) \otimes \mathbf{w} = a (\mathbf{v}_1 \otimes \mathbf{w}) + b (\mathbf{v}_2 \otimes \mathbf{w})\] \[\mathbf{v} \otimes (a\mathbf{w}_1 + b\mathbf{w}_2) = a (\mathbf{v} \otimes \mathbf{w}_1) + b (\mathbf{v} \otimes \mathbf{w}_2)\]

2. Associativity

For three vectors \(( \mathbf{u}, \mathbf{v}, \mathbf{w} )\):

\[(\mathbf{u} \otimes \mathbf{v}) \otimes \mathbf{w} = \mathbf{u} \otimes (\mathbf{v} \otimes \mathbf{w})\]

This allows us to write the tensor product without parentheses.

3. Distributivity with Kronecker Products

For matrices ( A, B, C, D ):

\[(A \otimes B) (C \otimes D) = (AC) \otimes (BD)\]

This is useful for composing quantum gates that act on multi-qubit systems.

4. Outer Product and Basis Expansion

If \(( \mathbf{v} = \sum_i \alpha_i \mathbf{e}_i ) \text{ and } ( \mathbf{w} = \sum_j \beta_j \mathbf{f}_j )\), then:

\[\mathbf{v} \otimes \mathbf{w} = \sum_{i,j} \alpha_i \beta_j (\mathbf{e}_i \otimes \mathbf{f}_j)\]

This shows how tensor products expand in terms of basis states.

5. Tensor Product of Operators

For two linear operators \((A )\) and \(( B )\):

\[(A \otimes B)(\mathbf{v} \otimes \mathbf{w}) = (A\mathbf{v}) \otimes (B\mathbf{w})\]

which describes how multi-qubit gates act on quantum states.

6. Identity and Swap Property

For the identity matrix \(I\):

\[I \otimes A = A \otimes I\]

Swapping the order of qubits can be expressed as a swap matrix \(( S )\) such that:

\[S (\mathbf{v} \otimes \mathbf{w}) = (\mathbf{w} \otimes \mathbf{v})\]

7. Tensor Product and Entanglement

A state \(( \vert \psi\rangle \in \mathbb{C}^m \otimes \mathbb{C}^n )\) is separable if it can be written as

\[|\psi\rangle = |\psi_1\rangle \otimes |\psi_2\rangle\]

Otherwise, it is entangled.

References

[1]. Yanofsky, N.S. and Mannucci, M.A., 2008. Quantum computing for computer scientists. Cambridge University Press.