Table of Contents
Gate composition
Gate composition combines gates into circuits. The order matters: composing gates then gives the combined gate (right-to-left matrix multiplication).
Sequential composition
Applying gates in sequence multiplies matrices (right-to-left):
The combined unitary is:
Parallel composition
Gates on different qubits commute and can be applied simultaneously:
Parallelization reduces circuit depth (execution time).
Circuit optimization
Gate cancellation: adjacent inverse gates cancel, :
Before: ├─H─┤ ├─H─┤
└───┘ └───┘
After: ├─────┤
└─────┘
Commutation: gates on different qubits commute (reorder without changing result):
Before: ├─H─┤ ├─X─┤
├─X─┤ ├─H─┤
After: ├─X─┤ ├─H─┤
├─H─┤ ├─X─┤
Merge single-qubit gates: consecutive single-qubit gates on the same qubit can be merged:
for appropriate .
Circuit depth
The depth of a circuit is the longest chain of sequential gates on any qubit. Depth determines execution time on quantum hardware. Minimize depth to reduce decoherence errors.
Example: Bell state circuit has depth 2 (H on qubit 0, then CNOT, then measurement).
