# Controlled Z gate using Pauli rotation operators and Z tensor product Z

I am trying to construct a controlled Z gate using elementary gates. This is what I have so far: $$\begin{pmatrix} -i & 0 & 0 & 0\\ 0 & -1 & 0 & 0\\ 0 & 0 & 1 & 0\\ 0 & 0 & 0 & -i \end{pmatrix}$$ can someone help me figure out how to get rid of the unwanted phase shift?

I can use combinations of a single-qubit Hamiltonian $$\hat{H}=\frac{1}{2}\Omega_x\hat{X}+\frac{1}{2}\Omega_y\hat{Y}+\frac{1}{2}\Omega_z\hat{Z}$$ and $$\hat{H}=\frac{1}{2}\Omega_{zz}\hat{Z}\otimes\hat{Z}$$. I can construct the $$\hat{I}\otimes\hat{H}$$ matrix above but I cannot construct the CNOT gate so far.

• Are you looking for ways to make a $CZ$ gate as the evolution under these Hamiltonians? (i.e. $CZ = exp(H_{cons})$ with $H_{cons}$ some constructed Hamiltonian from these two base Hamiltonians? In that case check what is $exp(\frac{1}{2}\Omega_{zz}Z \otimes Z)$ and equate this to the $CZ$ gate; you will find that they are equal for some $\Omega_{zz}$.
– JSdJ
Sep 20 '21 at 9:36
• If you in fact want an identity like $CZ = H_{cons}$ with $H_{cons}$ some constructed Hamiltonian from these two base Hamiltonians, it will be harder to make this, as $CZ$ is a unitary operation, and these wo Hamiltonians are Hermitian, which might give you some problems to construct them.
– JSdJ
Sep 20 '21 at 9:38
• What I'm saying is, you ask how to make the $CZ$ using gates from two base elements, but you provide two Hamiltonians, which are generally speaking not (unitary) gates - they invoke unitary operations through the Schrodinger equation, where $U = exp(H)$.
– JSdJ
Sep 20 '21 at 9:41

It depends on what you mean by "elementary gates". Using only Pauli gates (that is, using only $$X$$, $$Y$$ and $$Z$$ gates), you cannot build a controlled $$Z$$ gate. One way to prove it is simply to show that the controlled $$Z$$ gate cannot be written as $$A\otimes B$$, with $$A$$ and $$B$$ being unitary matrices.

However, if we allow ourselves to use gates from the Clifford group, it is easy to build a controlled $$Z$$ gate using $$I\otimes H$$ gates and a CNOT gate: \begin{align}(I\otimes H)\mathsf{C}X(I\otimes H) &= \frac12\begin{pmatrix}1&1&0&0\\1&-1&0&0\\0&0&1&1\\0&0&1&-1\end{pmatrix}\begin{pmatrix}1&0&0&0\\0&1&0&0\\0&0&0&1\\0&0&1&0\end{pmatrix}\begin{pmatrix}1&1&0&0\\1&-1&0&0\\0&0&1&1\\0&0&1&-1\end{pmatrix}\\&=\frac12\begin{pmatrix}1&1&0&0\\1&-1&0&0\\0&0&1&1\\0&0&-1&1\end{pmatrix}\begin{pmatrix}1&1&0&0\\1&-1&0&0\\0&0&1&1\\0&0&1&-1\end{pmatrix}\\&=\begin{pmatrix}1&0&0&0\\0&1&0&0\\0&0&1&0\\0&0&0&-1\end{pmatrix}\end{align} Note that the circuit we are building is a CNOT applied on the second qubit, controlled by the first one, and surrounded by two $$H$$ gates on the second qubit.

It is however way easier to reason on the basis states. A common relation that may be useful to know is $$HXH=Z$$. Thus, if the first qubit is in state $$|0\rangle$$, we apply on the second qubit $$HH=I$$, but if the first qubit is in state $$|1\rangle$$, we apply $$HXH=Z$$, which is the behavior of a controlled-$$Z$$ gate.

• Thank you for the response Tristan. I am able to use the Pauli gates and a Hamiltonian of the form $\hat{H}=\frac{1}{2}\theta\hat{Z}\otimes\hat{Z}$. I am not sure if I can construct the same matrices in the Clifford group from these. I will give it a try.
– Anne
Sep 19 '21 at 22:37
• Based on what Tristan has said, I wonder if the problem is solvable since all of the matrices are unitary.
– Anne
Sep 19 '21 at 23:26
• @Anne can you develop about how you are allowed to use this Hamiltonian directly in your question? The beginning of my answer supposed that you could only use one-qubit gates (since I thought you were only allowed to use Pauli gates). Sep 19 '21 at 23:43