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?

  • $\begingroup$ It should both be 90 degrees (about the y and x axis), right? $\endgroup$
    – Felix B.
    Apr 6, 2020 at 18:18
  • $\begingroup$ hadamard = qt.qip.hadamard_transform() $\endgroup$
    – Sriman .B
    Sep 25, 2021 at 6:46

4 Answers 4


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([(basis(2,0) + (basis(2,0) + basis(2,1)).unit()).unit()])


The Hadamard operation is a 180 degree rotation around the diagonal X+Z axis of the Bloch sphere.

A 180-degree rotation around X+Z swaps points on the X axis to the Z axis (and vice versa), and negates points on the Y axis. The same thing is true of rotating 90 degrees around Y then 180 degrees around X.

Note that quantum operations have a global phase in addition to the rotation part, so whether you get an exact equality between the operation matrices will depend on that. For example, $X \cdot Y^{1/2} = H \cdot \sqrt{i}$ instead of just $H$. Global phase only matters if you start applying the operation conditional on other qubits.


It can be nice to represent things geometrically. We can represent qubits using vectors, as I'm sure you know. So let's start with a qubit in the $|0\rangle$ state, or in the state $\begin{bmatrix}1\\0\end{bmatrix}$. We can graph this as

enter image description here

(That blue there is the vector representing the qubit.) So, now that we have our initial state, let's apply the Hadamard gate to it. The Hadamard gate is represented by $\frac{1}{\sqrt{2}}\begin{bmatrix}1&1\\1&-1\end{bmatrix}$. When we multiply the vector $\begin{bmatrix}1\\0\end{bmatrix}$ and the above matrix, we get the Hadamard gate applied to the zero state, or $\begin{bmatrix}\frac{1}{\sqrt{2}}\\\frac{1}{\sqrt{2}}\end{bmatrix}$. Graphing that, we get

enter image description here

Now, let's apply the Hadamard gate again. We have our vector $\begin{bmatrix}\frac{1}{\sqrt{2}}\\\frac{1}{\sqrt{2}}\end{bmatrix}$ and the matrix representing the Hadamard gate, which we can rewrite as $\begin{bmatrix}\frac{1}{\sqrt{2}}&\frac{1}{\sqrt{2}}\\\frac{1}{\sqrt{2}}&-\frac{1}{\sqrt{2}}\end{bmatrix}$ for simplicity. Now to multiply the two, of course, we do $\frac{1}{\sqrt{2}}\cdot\begin{bmatrix}\frac{1}{\sqrt{2}}\\\frac{1}{\sqrt{2}}\end{bmatrix}+\frac{1}{\sqrt{2}}\cdot\begin{bmatrix}\frac{1}{\sqrt{2}}\\-\frac{1}{\sqrt{2}}\end{bmatrix}$. $\sqrt{2}^2$ is of course $2$, so we get $\begin{bmatrix}\frac{1}{2}\\\frac{1}{2}\end{bmatrix}+\begin{bmatrix}\frac{1}{2}\\-\frac{1}{2}\end{bmatrix}$. This comes out to $\begin{bmatrix}1\\0\end{bmatrix}$, and the graph at the beginning. We're back where we started!

Hopefully this helps; if it doesn't, let me know and I'll try to think up another way to picture it.

  • $\begingroup$ thank you for your explanation. I understand that $H^{2}=I$. My question is more related to the Bloch sphere representation of the Hadamard matrix. I do not understand that why do the Hadamard-matrix- rotation twice (rotate the sphere about the y axis by 90 degree, then about the x axis by 180 degree, then about the y axis by 90 degree, and then in the end, about the x axis by 180 degree), would return the sphere to the original position? Thank you a lot. $\endgroup$
    – study
    Feb 27, 2017 at 22:38

Before starting I should mention I am using Craig Gidney's tool and some screenshots from it, quirk, which is definitely worths to be checked as himself also has left an answer here, now here is my understanding:

Lets start with some initial state on quirk so we can have an illustrative perception on whats going on:


This is just some random qubit state I've made using combination of three gates. What happens if we apply Hadamard to this?


Well this is combination of "rotation of the sphere about the $\hat{y}$ axis by 90 degrees, followed by a rotation about the $\hat{x}$ axis by 180 degrees" but lets tears this apart using available simpler gates and the definition your are interested:


Identical to applying Hadamard gate itself, we applied $Y^½$ then X. It may not be obvious how we reached from our input to this, so have at look at Y rotation animation and X rotation at quirk. Before continuing having look at these also would be useful I guess:

X rotationY rotationZ rotation

   X rotation      Y rotation      Z rotation

Now I guess here is the interesting part, if we apply $Y^½$ again we will reach to this:

enter image description here

But what does this mean? This is equal to X rotation of the input state:

enter image description here

With all these preparations I guess this is the point, if you rotate a sphere 180 degree just by an axis, equal rotations on other axises before and after first rotation will cancel each out and all you need to reach to the initial state is to apply the first axis 180 degree rotation again, just like double applying Hadamard.

In a sense it is like doing rotation against an actual mirror, on the global coordination the real rotation is different from the rotation happening on the mirror (in here $Y^½$ gate) but there is only one reality. Trying rotating an actual ball against a mirror can help to the understanding :)

And of course this is after applying two Hadamard consequently which is equal to the our initial state:



Here is the quirk's model I've prepared for this answer and can be used and tweaked for getting better understanding.

At the end, I should mention that Hadamard itself can be written as a one step 3d rotation, something like rotate(pi/2, 0, pi) but one step 3d rotations are less intuitive I guess and two step one axis rotation are easier to understand that's why you've found that quote and it is perhaps better to describe it in this way.


Not the answer you're looking for? Browse other questions tagged or ask your own question.