The Tensor Product
When a quantum computer holds two qubits, its full state lives in a vector space that is the tensor product of the individual qubit spaces. If the first qubit is in state and the second is in state , the joint state is written
or often just or for short.
How to compute a tensor product
The tensor product of two column vectors is formed by scaling the second vector by each entry of the first and stacking the results. For two-dimensional vectors:
= \begin{pmatrix} a\,c \\ a\,d \\ b\,c \\ b\,d \end{pmatrix}.$$ The output has $2 \times 2 = 4$ components — one for every pair of basis outcomes. As a concrete example, take $|{+}\rangle = \tfrac{1}{\sqrt{2}}\bigl(|0\rangle + |1\rangle\bigr)$ for the first qubit and $|1\rangle$ for the second: $$|{+}\rangle \otimes |1\rangle = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 \\ 1 \end{pmatrix} \otimes \begin{pmatrix} 0 \\ 1 \end{pmatrix} = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 \cdot 0 \\ 1 \cdot 1 \\ 1 \cdot 0 \\ 1 \cdot 1 \end{pmatrix} = \frac{1}{\sqrt{2}}\begin{pmatrix} 0 \\ 1 \\ 0 \\ 1 \end{pmatrix}.$$ In the computational basis ordered as $|00\rangle, |01\rangle, |10\rangle, |11\rangle$, this state has amplitude $\tfrac{1}{\sqrt{2}}$ on $|01\rangle$ and $|11\rangle$, and zero elsewhere. Measuring qubit 1 always yields `1` (as expected, since it was prepared in $|1\rangle$), while qubit 0 gives `0` or `1` each with probability $\tfrac{1}{2}$. <Callout type="tip"> When two qubits are **independent** — each prepared in its own state — the joint state is always a tensor product. Such states are called **product states**. Not every two-qubit state can be written this way; those that cannot are **entangled**. You will encounter entanglement in a later module. </Callout> ## Gates on product states A gate that acts only on one qubit of a product state produces another product state. Applying Hadamard to qubit 0 of $|00\rangle$ gives $|{+}\rangle \otimes |0\rangle$; applying X to qubit 1 flips it to $|1\rangle$. The two operations are completely independent and can be applied in either order. In circuit notation the resulting state after $H_0$ and $X_1$ is $$\bigl(H|0\rangle\bigr) \otimes \bigl(X|0\rangle\bigr) = |{+}\rangle \otimes |1\rangle.$$ ## Try it Build the product state $|{+}\rangle \otimes |1\rangle$. The grader checks the full state vector, so a do-nothing circuit will not pass. <RunnableExample /> After running, look at the **State** tab: you should see equal amplitudes on $|01\rangle$ and $|11\rangle$, confirming that qubit 0 is in superposition and qubit 1 is in $|1\rangle$.Sign in on the full site to ask questions and join the discussion.