[Physics] Visual interpretation, on the Bloch sphere, when Hadamard gate is applied twice

bloch-spherequantum mechanicsquantum-information

It's known that the Hadamard operation is just a rotation of the sphere about the $\hat{y}$ axis by 90 degrees, followed by a rotation about the $\hat{x}$ axis by 180 degrees.

On the other hand, $H^{2}=I$, where $H$ is the unitary matrix corresponding to the Hadamard gate and $I$ is the identity matrix.

If we do the rotation corresponding to the Hadamard matrix twice, then based on $H^{2}=I$, we would come out to the original situation, right? But, somehow, I can not see that. Could someone shed some light on this problem?

Best Answer

Here I give some additional analysis to Craig Gidneys answer. The Hadamard gate indeed can be subdivided into two individual rotations, as suggested in the initial question. However, every single qubit gate can also be described by a single rotation on the Bloch sphere. For the Hadamard gate, this is a rotation around the axis (rho, elev, azim) = $(1, \frac{\pi}{4}, 0)$. The rotation axis is drawn as a black arrow in the image.

Bloch sphere evolution during two sequentially applied Hadamard gates

Shown is the evolution of the initial state $|0\rangle$ during two sequentially applied Hadamard gates. The red state vectors show the evolution during the first Hadamard gate, transferring state $|0\rangle$ to state $|x\rangle$ (in the image only x). The blue state vectors then show the evolution during the second Hadamard gate, transferring state $|x\rangle$ back to state $|0\rangle$. This geometric representation shows for one exemplary initial state, why $H^2 = I$.

The image can be resimulated with python and the toolbox qutip.

from qutip import *
import numpy as np
import scipy
import matplotlib.colors
import scipy

#the gate
hadamard = qutip.qip.hadamard_transform()
# the hamilton operator describing the evolution during the hadamard gate
hamilton = Qobj(scipy.linalg.logm(hadamard.data.todense()), dims=hadamard.dims) / np.pi * 1.j

#create initial state vector
psi0 = (basis(2, 0)).unit()

# describing the gate as time evolution
def gate(t):
    return (-2*np.pi*1.j*hamilton*t).expm()

# hadamard gate for t = 0.5
# In[1]: gate(0.5)
# Out[3]: 
# Quantum object: dims = [[2], [2]], shape = (2, 2), type = oper, isherm = True
# Qobj data =
# [[ 0.70710678  0.70710678]
#  [ 0.70710678 -0.70710678]]

# evolve the gate
n = 25
psi = [gate(t)*psi0 for t in np.linspace(0, 1., 2*n)]

# plotting the states. State evolution during the first hamadard gate is red. During second hadamard gate is blue
b = Bloch()
b.vector_color = [matplotlib.colors.to_rgba('r', alpha=i) for i in np.arange(n)/float(n)] + [matplotlib.colors.to_rgba('b', alpha=i) for i in np.arange(n)/float(n)]  + ['black']
b.add_states(psi)
b.add_states([(basis(2,0) + (basis(2,0) + basis(2,1)).unit()).unit()])

b.show()