I'm following a lesson, and it says that the Hadamard gate can be decomposed to three gates: RZ(pi/2), squared root Z, and RZ(pi/2). However, when I do matrix multiplication of these three matrices, I don't get the same matrix as the Hadamard gate.

Here is the decomposition as in the lesson:

Hand here is my calculation:

What's wrong with my calculation?

• Your calculation is correct and shows that $\sqrt{Z}\sqrt{X}\sqrt{Z}\equiv H$ where $\equiv$ denotes equality up to a scalar factor $e^{i\theta}$ called the global phase. Every observable quantity in quantum mechanics takes the form $\langle\psi|A|\psi\rangle$ for some Hermitian operator $A$. Thus, multiplying $|\psi\rangle$ by a phase factor $e^{i\theta}$ has no observable effects. Therefore, quantum states and quantum gates are only defined up to global phase. The ambiguity introduced by the global phase is a feature of some, but not all, formalizations of quantum mechanics. Commented Jul 12, 2023 at 11:30
• I didn't recognize that, many thanks for the explanation. Commented Jul 12, 2023 at 11:48
• Welcome to the site! Please have a look at quantumcomputing.meta.stackexchange.com/questions/49/… and quantumcomputing.stackexchange.com/help/how-to-ask. Questions here are required to be highly specific and well-contextualized. Feel free to edit the post accordingly. In particular, screenshots/photos of text are generally discouraged here as they hinder searchability.
– glS
Commented Jul 12, 2023 at 18:21

You got the H matrix, up to an unimportant global phase of $$\frac{\left(1-i\right)}{\sqrt2}$$.