4.1. Pure states#

Quantum computers store information in a two-dimensional Hilbert space called a qubit. In this section, I will introduce mathematical description of a single qubit.

4.1.1. Pure states#

In ideal situations, the state of a qubit is specified by a single ket vector in a two-dimensional Hilbert space. We call the ket state vector and the ideal state pure state. Unless otherwise is specified, the state vectors are assumed to be normalized. That is \(\langle \psi | \psi \rangle = 1\) (See Section 2.1). In less ideal situations, a qubit is in a mix state involving multiple pure states, which will be discussed in a later chapter. In this chapter, we focus on pure states.

Any qubit state can be written as

(4.1)#\[ | \psi \rangle = c_0 | 0 \rangle + c_1 | 1 \rangle \]

where \(| 0 \rangle \) and \(| 1 \rangle\) are orthonormal basis vectors satisfying \(\langle 0 | 0 \rangle = \langle 1 | 1 \rangle = 1\) and \(\langle 0 | 1 \rangle = \langle 1 | 0 \rangle = 0\). The coefficients \(c_0\) and \(c_1\) are complex numbers. The normalization requirement is satisfied if \(|c_0|^2 + |c_1|^2 = 1\).

This orthonormal complete basis set \(\{|0\rangle, |1\rangle\}\) is known as computational basis which is the default basis in quantum computing. However, this basis set do not represent any particular physical basis set. In real quantum computers, a qubit can be realized, for example, by an electron spin, \(|0\rangle \equiv | \uparrow \rangle\) and \(|1\rangle \equiv |\downarrow \rangle\) or the polarization of a photon, \(|0\rangle \equiv | H \rangle\) (horizontal polarization) and \(|1\rangle \equiv | V \rangle\) (vertical polarization). By using the computational basis set, we don’t have to worry about what type of hardware is used. The mathematical expression based on the computational basis can be applied to all of qubit-based quantum computers.

4.1.2. Standard Basis sets#

In addition to the computational basis (also known as z-basis) \(\{|0\rangle,|1\rangle\}\), we often use other orthonormal basis set, namely x-basis \(\{|+\rangle, |-\rangle\}\) and y-basis \(\{|L\rangle,|R\rangle\}\). They are related to the computational basis as follows:

(4.2)#\[ |+\rangle = \frac{1}{\sqrt{2}}\left(|0\rangle + |1\rangle\right), \quad |-\rangle = \frac{1}{\sqrt{2}}\left(|0\rangle - |1\rangle\right) \]
(4.3)#\[ |L\rangle = \frac{1}{\sqrt{2}}\left(|0\rangle + i |1\rangle\right), \quad |R\rangle = \frac{1}{\sqrt{2}}\left(|0\rangle - i |1\rangle\right) \]

Exercise 4.1.1   Assuming that the computational basis is orthonormal, show that the x-basis and the y-basis are orthonormal.


4.1.3. The basis sets in Qiskit#

In Qiskit, the computatioal basis kets \(\{|0\rangle, |1\rangle\}\) and x-basis kets \(\{|+\rangle, |-\rangle\}\) are predefined. See the following Qiskit note.

Qiskit note: Computational Basis

The qiskit.quantum_info library provides us with basic tools to describe quantum mechanics using expressions very similar to the original methematical expressions. Here are the correspondence between mathematical expressions and qiskit expressions.

from qiskit.quantum_info import Statevector

\(|0\rangle \quad \Rightarrow \quad\) Statevector.from_label("0")
\(|1\rangle \quad \Rightarrow \quad\) Statevector.from_label("1")
\(|+\rangle \quad \Rightarrow \quad\) Statevector.from_label("+")
\(|-\rangle \quad \Rightarrow \quad\) Statevector.from_label("-")

In this note, we use the following convention:

Zero = Statevector.from_label("0")
One = Statevector.from_label("1")
Plus = Statevector.from_label("+")
Minus = Statevector.from_label("-")
L = Statevector.from_label("l")
R = Statevector.from_label("r")

The vector with “.adjoint()” indicates bra. For example,

\(\langle 0| \quad \Rightarrow \quad\) Zero.adjoint()

The regular addition works.

\(|0\rangle + |1\rangle \quad \Rightarrow \quad\) Zero + One

The operator for inner product is “@”.

\(\langle 0 | + \rangle \quad \Rightarrow \quad\) Zero.adjoint() @ Plus


Qiskit Example 4.1.1   Let us check the orthonormality of the computational basis set in Qiskit.

# Import numpy (for sqrt)
import numpy as np
from qiskit import *
from qiskit.quantum_info import Statevector, Operator

Zero = Statevector.from_label("0")
One = Statevector.from_label("1")
Plus = Statevector.from_label("+")
Minus = Statevector.from_label("-")
L = Statevector.from_label("l")
R = Statevector.from_label("r")

# Inner product <psi|phi> = psi.inner(phi)
Norm_of_Zero = np.sqrt(Zero.inner(Zero))
Norm_of_One  = np.sqrt(One.inner(One))
Inner_Product = Zero.inner(One)

print("Norm of |0> =", Norm_of_Zero)
print("Norm of |1> =", Norm_of_One)
print("<0|1> =", Inner_Product)
Norm of |0> = (1+0j)
Norm of |1> = (1+0j)
<0|1> = 0j

Qiskit Example 4.1.2   Let us construct another orthonormal basis set \(|L\rangle = \frac{1}{\sqrt{2}}\left(|0\rangle + i |1\rangle\right)\) and \(|R\rangle = \frac{1}{\sqrt{2}}\left(|0\rangle - i |1\rangle\right)\). Notice the complex unit \(i\) on \(|1\rangle\).

print( "<L|L> =",L.inner(L))
print( "<R|R> =",R.inner(R))
print( "<L|R> =",L.inner(R))
<L|L> = (0.9999999999999998+0j)
<R|R> = (0.9999999999999998+0j)
<L|R> = 0j

Python note: Complex numbers

In python, a complex number is expressed as \(2 + 3j\). Note that symbol \(j\) is used instead of \(i\). The imaginary unit \(i\) is \(1j\). Notice \(1\) in from of \(j\). \(j\) must be used with a regular number. \(j\) alone causes an error.


Exercise 4.1.2  

  1. Confirm that base vectors Plus and Minus are orthonormal using Qiskit.

  2. Calculate the inner product between One and Minus by hand and confirm your answer using Qiskit.


Exercise 4.1.2   In the previous example, change the order of rotations to rx, rz, ry. Does it come back to the initial state?


Last modified: 08/31/2022