# RZZ calculation: Why does the equation and the circuit correspond?

i found this tutorial about MaxCut and QAOA from pennylane and i do not understand how the equation and the circuit should be equal.

When i do the math i come to this conclusion:

(result of CNOT - RZ - CNOT)

and this

(result of e^{...} - equation)

When i change the equation to

So if I remove the identity matrix and the minus sign, I get the result of the circuit, but is that correct? And if so, why?

Thanks for your help!

• The matrix only has to be equal up to a scalar factor for the operation to be correct. Unless you are going to be applying operation modifiers such as controlling the two qubit gate with a third qubit, in which case the scalar factor becomes relevant. Sep 14, 2021 at 17:00
• Just adding to what @Craig said, divide the first matrix by $e^{-it/2}$ and you’ll see how they are equal up to a global phase Sep 14, 2021 at 17:40
• please note that you can use mathjax to add equations to the post. See e.g. quantumcomputing.meta.stackexchange.com/questions/49
– glS
Sep 15, 2021 at 10:24
• As others have already said, one of the major differences is a global phase. There's also a sign difference in your phases. This may be due to however you're defining the $R_z$ function - some sources take $R_z(\theta)=e^{i Z\theta/2}$, others take $R_z(\theta)=e^{-i Z\theta/2}$. That difference would be enough of fix it. Sep 15, 2021 at 10:28