Codebook: Universal Gate Sets

Ask here about the “Universal Gate Sets” Codebook topic from the “Single-Qubit Gates” module.

A question for codercise I.7.1 - Universality of Rotations, why is it that when all angles (phi, theta, omega) are equal to pi/2 that have the correct solution yet when printing the result of hadamard_with_rz_rx() it results in

[1.11022302e-16-0.70710678j 0.00000000e+00-0.70710678j]
which isn’t the same as

\hat{H} | 0 \rangle = \frac{1}{\sqrt{2}} \pmatrix{1 \\ 1}.
Shouldn’t the correct result in using Rx and Rz rotations result in only real values for the resultant state?

Hi!
It is nice that you point this out. However, if we look closely to the output state, we can see that these states are equivalent.
Factor out the minus sign and the imaginary factor to obtain |\psi\rangle=\frac{-i}{\sqrt2}(|0\rangle+|1\rangle) which is equivalent to \frac{1}{\sqrt2}(|0\rangle+|1\rangle) since that global phase doesn’t affect the outcomes of any measurements you perform on that quantum state.

To know more, you can read about global and relative phases in quantum mechanics. Hope this helped.

1 Like

Oh I see, the modulus of the coefficients are identical despite the change from real to imaginary.
Thank you for clarifying!