1. Conceptual Framework: Anatomy of a Circuit Diagram
A quantum circuit is a chronological visual representation of a quantum algorithm. Time flows from left to right on horizontal lines, where each line is a qubit register.
Standard multi-qubit circuit architecture includes four primary components:
- Quantum Register: Qubit lines that store quantum information, often initialized to a basis state such as $|0\rangle$.
- Quantum Gates: Unitary operators that intentionally transform qubit states.
- Measurement Gates: Operations that collapse superposition into classical outcomes.
- Classical Register: Classical lines that collect and process measured bit values.
2. Linear Algebra of Operations: Unitary Matrices
Every physical quantum gate is a linear transformation between input and output state vectors. For physical realizability, this transformation must be unitary.
Defining Unitary Conditions
$$U^\dagger U = I$$
Where:
- $U^\dagger$ is the conjugate transpose.
- $I$ is the identity matrix.
Unitary evolution preserves vector norm, guaranteeing total probability remains normalized to $1$ after any sequence of gate operations.
3. Calculating Full Circuit Matrices
Parallel operations on different qubit lines are combined with tensor products, not ordinary matrix multiplication.
Example 1: $X \otimes I$
Apply Pauli-X on qubit 0 and identity on qubit 1:
$$U = X \otimes I = \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix} \otimes \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}$$
$$U = \begin{bmatrix}
0 \cdot \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} & 1 \cdot \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} \\
1 \cdot \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} & 0 \cdot \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}
\end{bmatrix}
= \begin{bmatrix}
0 & 0 & 1 & 0 \\
0 & 0 & 0 & 1 \\
1 & 0 & 0 & 0 \\
0 & 1 & 0 & 0
\end{bmatrix}$$
For initial state $|00\rangle$:
$$U|00\rangle = \begin{bmatrix}
0 & 0 & 1 & 0 \\
0 & 0 & 0 & 1 \\
1 & 0 & 0 & 0 \\
0 & 1 & 0 & 0
\end{bmatrix}
\begin{bmatrix} 1 \\ 0 \\ 0 \\ 0 \end{bmatrix}
= \begin{bmatrix} 0 \\ 0 \\ 1 \\ 0 \end{bmatrix} = |10\rangle$$
Example 2: $I \otimes X$
Apply identity on qubit 0 and Pauli-X on qubit 1:
$$U = I \otimes X = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} \otimes \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix}$$
$$U = \begin{bmatrix}
1 \cdot \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix} & 0 \cdot \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix} \\
0 \cdot \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix} & 1 \cdot \begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix}
\end{bmatrix}
= \begin{bmatrix}
0 & 1 & 0 & 0 \\
1 & 0 & 0 & 0 \\
0 & 0 & 0 & 1 \\
0 & 0 & 1 & 0
\end{bmatrix}$$
For the same initial state $|00\rangle$:
$$U|00\rangle = \begin{bmatrix}
0 & 1 & 0 & 0 \\
1 & 0 & 0 & 0 \\
0 & 0 & 0 & 1 \\
0 & 0 & 1 & 0
\end{bmatrix}
\begin{bmatrix} 1 \\ 0 \\ 0 \\ 0 \end{bmatrix}
= \begin{bmatrix} 0 \\ 1 \\ 0 \\ 0 \end{bmatrix} = |01\rangle$$
4. Summary Matrix: Direct Structural Differences
| System Operator Layout |
Initial Vector |
Circuit Unitary Matrix $U$ |
Output State Vector |
| $X \otimes I$ (gate on qubit 0, identity on qubit 1) |
$\begin{bmatrix}1 \\ 0 \\ 0 \\ 0\end{bmatrix} = |00\rangle$ |
$\begin{bmatrix}0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0\end{bmatrix}$ |
$\begin{bmatrix}0 \\ 0 \\ 1 \\ 0\end{bmatrix} = |10\rangle$ |
| $I \otimes X$ (identity on qubit 0, gate on qubit 1) |
$\begin{bmatrix}1 \\ 0 \\ 0 \\ 0\end{bmatrix} = |00\rangle$ |
$\begin{bmatrix}0 & 1 & 0 & 0 \\ 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0\end{bmatrix}$ |
$\begin{bmatrix}0 \\ 1 \\ 0 \\ 0\end{bmatrix} = |01\rangle$ |
Operational warning: Matrix order is critical. Since matrix/tensor operations are non-commutative in ordering effects ($A \otimes B \neq B \otimes A$ for placement semantics), swapping track order changes amplitudes and can invalidate downstream behavior.