8
$\begingroup$

When I look at most circuits (admittedly small sample as I'm a beginner), the Hadamard gate is used a lot to prepare a superposition from say the $\mid0\rangle$ state.
But upon a little reflection, we can prepare a superposition using a $\dfrac{\pi}{2}$ rotation about the X axis.

I do know that a successive application of the Hadamard gate yields the initial state back (for any state).
If we have one of $\mid0\rangle$ or $\mid1\rangle$, we can recover them using a succession of said rotation followed by a NOT gate (Pauli-X).

So why is the Hadamard gate preferred to create superpositions when it uses more gates (rotation about Z then rotation about X then rotation about Z again)?
If it is because the Hadamard gate allows recovery of any initial state, why is that property so important? (Even when not actually used when I look at the examples I see.)

$\endgroup$
3
  • 1
    $\begingroup$ Why are you talking about $\pi/2$ rotations about the $X$ basis? What you want is a $\pi/2$ rotation about the $Y$ axis, which indeed acts almost like a Hadamard, as it also maps between X and Z eigenstates. $\endgroup$ Aug 6, 2018 at 9:53
  • $\begingroup$ @NorbertSchuch Thank you. I just checked and it you are right. Do you mind writing an answer where you talk about the comparison between Hadamard and $\frac{\pi}{2}$ rotation about $Y$? $\endgroup$
    – Ntwali B.
    Aug 6, 2018 at 14:52
  • $\begingroup$ I don't see how this would make sense. On the one hand, this is not the question. On the other hand, take the answer of DaftWullie and strip the part about $\sqrt{X}$ not being real, and you probably get what I would write. $\endgroup$ Aug 6, 2018 at 22:18

3 Answers 3

8
$\begingroup$

It's mostly about simplicity and adopted convention. In the end, this is basically the same question as "why should I pick a universal set of gates A rather than a universal set B?" (see here). Experimentalists would pick the universal set they have available. Theorists just pick something that they like to work with, and eventually a convention is adopted. But it doesn't matter which convention they adopt because any universal set is easily converted into any other universal set, and it is (or should be) understood that the quantum circuits describing algorithms are not what you actually want to run on a quantum computer: you need to recompile them for the available gate set and optimise based on the available architecture (and this process is unique to each architecture).

You could use operations such as $\sqrt{X}$, but they are a little bit more fiddly because of all the imaginary numbers that appear. Or there's $\sqrt{Y}$ which gives an even more direct comparison to $H$, avoiding imaginary numbers.

One of the main purposes of $H$ in a quantum circuit is to prepare uniform superpositions: $H|0\rangle=(|0\rangle+|1\rangle)/\sqrt{2}$. But $\sqrt{Y}$ also does this: $\sqrt{Y}|1\rangle=(|0\rangle+|1\rangle)/\sqrt{2}$. When you start combining multiple Hadamards on unknown input states (i.e. the Hadamard transform), it has a particularly convenient structure $$ H^{\otimes n}=\frac{1}{\sqrt{2^n}}\sum_{x,y\in\{0,1\}^n}(-1)^{x\cdot y}|x\rangle\langle y|. $$

The Hadamard gives you some very nice inter-relations (reflecting basis changes between pairs of mutually unbiased bases), $$ HZH=X\qquad HXH=Z \qquad HYH=-Y. $$ It also enables relations between controlled-not and controlled phase, and between controlled-not in two different directions (swapping control and target). There are similar relations for $\sqrt{Y}$: $$ \sqrt{Y}Z\sqrt{Y}^\dagger=YZ=iX \qquad \sqrt{Y}X\sqrt{Y}^\dagger=YX=-iZ\qquad \sqrt{Y}Y\sqrt{Y}^\dagger=Y $$ Part of this looking (slightly) nicer is because, as stated in the question, $H^2=\mathbb{I}$.

One way that many courses introduce the basic idea of quantum computation, and interference, is to use the Mach-Zehnder interferometer. This consists of two beam splitters which, mathematically, should be described by $\sqrt{X}$ (or $\sqrt{Y}$ would do). Indeed, this is important for a first demonstration because of course these operations are "square root of not", which you can prove is logically impossible classically. However, once that initial introduction is over, theorists will often substitute the beam splitter operation for Hadamard, just because it makes everything slightly easier.

$\endgroup$
15
  • $\begingroup$ I see. And coming from computer science, I'm always looking at what is optimal ($i.e.$ minimum number of gates) so I was wondering what the hell are physicists are up to. Thanks for your answer. $\endgroup$
    – Ntwali B.
    Aug 6, 2018 at 7:19
  • $\begingroup$ @DaftWullie It would be more fair to compare to $\sqrt{Y}$, which is real and accomplishes the same effect as $H$ on the computational basis. (I agree that's not what the OP asked.) $\endgroup$ Aug 6, 2018 at 9:35
  • 1
    $\begingroup$ @NorbertSchuch I considered that while writing the answer, but was concerned that it only confused the issue more because there's even less to pick between them. $\endgroup$
    – DaftWullie
    Aug 6, 2018 at 9:54
  • $\begingroup$ Fair point. But then again, the case where there's least to pick between them is where the "real" differences between pi/2 rotations and Hadamard become most clear. $\endgroup$ Aug 6, 2018 at 10:07
  • $\begingroup$ more than the imaginary numbers in the matrix, I would argue that what is nice about $H$ is the simplicity of its spectrum. $H$ is the gate that switches between the eigenbases of $Z$ and $X$. The matrix that does the same between, say, $X$ and $Y$, contains imaginary numbers but arguably works exactly the same, provided we use eigenbases of $X$ and $Y$ as "standard" instead of those of $Z$ and $X$ as it's commonly done. In other words, what is "simple" about $H$ (or one thing that is) is the fact that it represents a change of basis between two mutually unbiased bases. $\endgroup$
    – glS
    Aug 6, 2018 at 10:07
6
$\begingroup$

I think the major advantages of the Hadamard gate are "usability" stuff, as opposed to fundamental mathematical stuff. It's just easier to remember and simpler to apply.

  1. The Hadamard gate's marix is real and symmetric. Makes it easy to remember.
  2. Hadamard is its own inverse. Makes it easy to optimize in circuits. Any two Hs that meet cancel out; whereas $\sqrt{X}$ tends to meet $\sqrt{X}$ as often as $\sqrt{X}^{-1}$ leaving behind $X$ operations.
  3. Hadamard's effect on operators is easy to remember: swap X for Z. Whereas for $\sqrt{X}$ style operations you need to remember a right hand rule. If you pass a hadamard over a CZ, it turns into a CNOT. If you pass a $\sqrt{Y}$ over a CZ, whether you get a CNOT or a CNOT+Z depends on whether you went left-to-right or right-to-left.
  4. In the surface code you need twist defects or distilled states to do $\sqrt{X}$ gates. Hadamard operations need neither (though the twists are more efficient...).
  5. The Hadamard is unique. There are two values $M$ such that $M^2 = X$, and so you need an agreed upon convention for which one $\sqrt{X}$ is.

PS: it would be better to compare a Hadamard to a 90 degree rotation about the Y axis, not the X axis, because the Hadamard operation is equivalent $\sqrt{Y}$ up to Pauli operations ($H \propto Z \cdot \sqrt{Y}$).

$\endgroup$
4
$\begingroup$

Any Hermitian quantum gate $U$ is "self-recovering". This is because $U$ is unitary, and $$UU^{\dagger}=U^{\dagger}U=I$$ If $U$ is also Hermitian, then $U=U^{\dagger}$ and $$UU=I$$

Hadamard gate prepares $\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$ superposition from $|0\rangle$ state. If you need this superposition, you use Hadamard. If you need a different superposition, $\alpha|0\rangle + \beta|1\rangle$ with some $\alpha$ and $\beta$, you need a different gate or a sequence of gates; Hadamard gate has no advantage here.

$\endgroup$
6
  • $\begingroup$ You certainly answer the question and thanks for that. Though would you mind elaborating why one would specifically need $\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$ over say $\frac{1}{\sqrt{2}}(|0\rangle - i |1\rangle)$? I believe elaborating on that will shed more light to aid my understanding. $\endgroup$
    – Ntwali B.
    Aug 6, 2018 at 7:12
  • $\begingroup$ @NtwaliB. Suppose you need just a superposition with 50% chances being $|0\rangle$ and 50% chances being $|1\rangle$; both $\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$ and $\frac{1}{\sqrt{2}}(|0\rangle - i |1\rangle)$ are equally good for you, but what would you choose? $\endgroup$
    – kludg
    Aug 6, 2018 at 7:19
  • $\begingroup$ I would choose the one that makes the computer do the least amount of work. If a Hadamard gate is implemented in terms of rotations, I will use a rotation about X as it saves me the use of two additional gates. If Hadamard is a native gate, I will use Hadamard since most people are used to it. Note: Hadamard generates $\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$ while $R_x(\frac{\pi}{2})$ generates $\frac{1}{\sqrt{2}}(|0\rangle - i|1\rangle)$ $\endgroup$
    – Ntwali B.
    Aug 6, 2018 at 7:24
  • 1
    $\begingroup$ @kludg Why would $U=U^\dagger$ for real $U$?? This is completely wrong. Try e.g. [1 -1;1 1] (normalized) - a pi/2 rotation about Y - which doesn't square to the identity. (Indeed, a Y rotation by pi/2 prepares the same superpositions as H starting from the computational basis.) $\endgroup$ Aug 6, 2018 at 9:31
  • 1
    $\begingroup$ @kludg this is not true as written. Did you mean to write hermitian instead of real? $\endgroup$
    – glS
    Aug 6, 2018 at 9:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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