|q⟩ Bad Qubits

beginner · Programming · Two Qubits & Tensor Products

Two-Qubit States

A single qubit lives in a two-dimensional space spanned by 0|0\rangle and 1|1\rangle. When you add a second qubit the state space grows: the two-qubit system has four basis states, one for each possible pair of bit values.

The four computational basis states

The basis states are formed by taking the tensor product of the individual qubit states. Writing qubit 0 (the most significant bit) on the left:

00,01,10,11.|00\rangle, \quad |01\rangle, \quad |10\rangle, \quad |11\rangle.

Each label is a two-bit string. 00|00\rangle means the first qubit is 0|0\rangle and the second is 0|0\rangle; 11|11\rangle means both are 1|1\rangle; and so on. These four states are orthonormal — they are mutually orthogonal and each has unit length — so they form a complete basis for the four-dimensional Hilbert space C4\mathbb{C}^4.

As column vectors the convention is to order them by their decimal values: 00|00\rangle sits at index 0, 01|01\rangle at index 1, 10|10\rangle at index 2, and 11|11\rangle at index 3. For example:

00=(1000),01=(0100),10=(0010),11=(0001).|00\rangle = \begin{pmatrix}1\\0\\0\\0\end{pmatrix}, \quad |01\rangle = \begin{pmatrix}0\\1\\0\\0\end{pmatrix}, \quad |10\rangle = \begin{pmatrix}0\\0\\1\\0\end{pmatrix}, \quad |11\rangle = \begin{pmatrix}0\\0\\0\\1\end{pmatrix}.

The tensor product

Each column above is the tensor product of its two single-qubit vectors. For instance:

10=(01)(10)=(01001110)=(0010)=10.|1\rangle \otimes |0\rangle = \begin{pmatrix}0\\1\end{pmatrix} \otimes \begin{pmatrix}1\\0\end{pmatrix} = \begin{pmatrix}0\cdot1\\0\cdot0\\1\cdot1\\1\cdot0\end{pmatrix} = \begin{pmatrix}0\\0\\1\\0\end{pmatrix} = |10\rangle.

The tensor product is just the Kronecker product of the column vectors: you multiply each entry of the first vector by the entire second vector.

Preparing basis states in a circuit

Circuits always start in 00|00\rangle. To reach any of the other three basis states you apply XX (the NOT gate, which swaps 01|0\rangle \leftrightarrow |1\rangle) to the qubits you want to flip:

Try it

Prepare the state 11|11\rangle starting from 00|00\rangle. Press Run to inspect the state vector amplitude, then Check to confirm you have the right basis state.

Run your code to see the quantum state.

The state vector should show a single amplitude of 11 at index 3 (the 11|11\rangle slot) and zeros everywhere else.

Sign in on the full site to ask questions and join the discussion.