5. Sequence of Pauli gates

Basic Quantum Circuits

Simplify the following sequence of Pauli gates $$ U = XYXXZXXXYXXXXZXXXXXY. $$

Think about what the result of n Pauli X gates in series is. Also what is the result of XY?

By inspection we have
$$ XX = \begin{pmatrix} 0 & 1 \
1 & 0 \end{pmatrix} \begin{pmatrix} 0 & 1 \ 1 & 0 \end{pmatrix} = \begin{pmatrix} 1 & 0 \ 0 & 1 \end{pmatrix} = I
$$ Therefore, $XXX = X(XX) = X I = X$. So for n Pauli X gates where n is odd we end up with a single X gate and when n is even we end up with identity I. Same goes for Y gates and Z gates.

Moreover, we have $$ XY = \begin{pmatrix} 0 & 1 \ 1 & 0 \end{pmatrix} \begin{pmatrix} 0 & -i \ i & 0 \end{pmatrix} = \begin{pmatrix} i & 0 \ 0 & -i \end{pmatrix} = i Z $$

Therefore, $$ U = XYXXZXXXYXXXXZXXXXXY = (iZ)^5 = i Z $$