# IBM Qiskit QAOA gate implementation question

In section $$5.2$$ of the QAOA chapter in Qiskit textbook, section $$5.2$$, state preparation uses the gate $$U_{k,l}(\gamma) = e^{\frac{i \gamma}{2} (1-Z_k Z_l)}$$. Later, in section $$5.3$$, this gate is given in terms of basic gates as $$U_{k,l}(\gamma)=C_{u1}(−2 \gamma)_{k,l}u_1(\gamma)_k u_1(\gamma)_l$$. Why is this the correct implementation?

Qiskit gates $$u_1$$ and $$C_{u1}$$ are

$$u_1(\theta) = \begin{pmatrix} 1 & 0 \\ 0 & e^{i\theta} \end{pmatrix} \,\,\, C_{u1}(\theta) = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & e^{i\theta} \end{pmatrix}$$

see here and here. Exponential of a normal matrix $$A$$ is the matrix $$e^A$$ with the same eigenbasis as $$A$$ and eigenvalues that are exponentials of the eigenvalues of $$A$$. Therefore, $$u_1(\theta) = e^{\frac{i\theta}{2}(I-Z)}$$. Also, note that

$$I - Z_1 - Z_2 + Z_1Z_2 = \begin{pmatrix} 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 4 \end{pmatrix},$$

so $$C_{u1}(\theta) = e^{\frac{i\theta}{4}(I - Z_1 - Z_2 + Z_1Z_2)}$$. Finally, diagonal matrices commute, so

$$U_{k,l}(\gamma) = e^{\frac{i \gamma}{2}(I-Z_k Z_l)} = e^{-\frac{i\gamma}{2}(I-Z_k-Z_l+Z_k Z_l)}e^{\frac{i\gamma}{2}(I-Z_k)}e^{\frac{i\gamma}{2}(I-Z_l)} = C_{u1}(-2\gamma)_{k,l} u_1(\gamma)_k u_1(\gamma)_l.$$

• Hi Adam, thanks for a very clear explanation. Feb 21 at 17:09