Advantange of Hadamard gate over rotation about the X axis for creating superpositions

6

3

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.)

Ntwali B.

Posted 2018-08-06T06:15:11.103

Reputation: 371

1Why 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. – Norbert Schuch – 2018-08-06T09:53:39.943

@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$? – Ntwali B. – 2018-08-06T14:52:03.123

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. – Norbert Schuch – 2018-08-06T22:18:53.947

Answers

4

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.

DaftWullie

Posted 2018-08-06T06:15:11.103

Reputation: 35 722

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. – Ntwali B. – 2018-08-06T07:19:06.363

@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.) – Norbert Schuch – 2018-08-06T09:35:27.820

1@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. – DaftWullie – 2018-08-06T09:54:26.510

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. – Norbert Schuch – 2018-08-06T10:07:10.240

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. – glS – 2018-08-06T10:07:29.183

@glS The change in basis property is conveyed in the first equation of my answer. The second equation conveys that $\sqrt{X}$ also performs a basis change. Although as Norbert points out, the more direct comparison is $\sqrt{Y}$. – DaftWullie – 2018-08-06T10:51:35.007

I've always heard beam splitters are probabalistic gates, not deterministic quantum gates. But your answer doesn't mention this "defect" – Steven Sagona – 2018-08-06T12:58:27.717

@StevenSagona That's because they're not probabilistic! Are you perhaps thinking of the case where you're trying to use a non-linear crystal to make an entangled pair? – DaftWullie – 2018-08-06T13:00:51.310

Yes, the type of work in "linear quantum computing": https://journals.aps.org/pra/abstract/10.1103/PhysRevA.64.062311

– Steven Sagona – 2018-08-06T15:16:55.467

@StevenSagona That's something quite different. The beam splitter is deterministic. But you can use it in a non-deterministic way to perform operations that you wouldn't otherwise be able to in linear optics (because linear optics cannot create all unitary operations). It's irrelevant to the present context. – DaftWullie – 2018-08-06T15:27:38.847

Everyone, I'm learning a lot and grateful for that. @DaftWullie Can you point me to a pdf (lecture note, book, etc) that explains in more details interference? And gates in general? Every book I'm reading just gloss over these important details. – Ntwali B. – 2018-08-06T15:29:00.313

@NorbertSchuch I know I already asked above but for completeness sake, if you wrote an answer where you show said difference between rotation about $Y$ and Hadamard, it would be nice. I can update the question if you wish. – Ntwali B. – 2018-08-06T15:30:04.140

@glS Thanks for the additional insight. I'm "hunting" for lecture notes/books that go into more details about gates. I want to understand them as deeply as possible. Can you point me to additional resources? – Ntwali B. – 2018-08-06T15:31:23.013

@NtwaliB. the standard reference on the basics of quantum computation and information is Nielsen and Chuang. Note that "understanding quantum gates" is really understanding the basics of quantum mechanics/information/computation. In this regard, you might find this post useful.

– glS – 2018-08-06T15:59:33.927

@NtwaliB.If you email me (look at my profile, follow the link to my website, and get my contact details) I can send you some lecture notes I have on the subject, which you may find useful. – DaftWullie – 2018-08-07T07:46:23.973

3

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.

kludg

Posted 2018-08-06T06:15:11.103

Reputation: 2 447

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. – Ntwali B. – 2018-08-06T07:12:08.993

@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? – kludg – 2018-08-06T07:19:02.313

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)$ – Ntwali B. – 2018-08-06T07:24:15.837

@NtwaliB. Ok; but most people would not overcomplicate things and just use $\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$ because it looks simpler. – kludg – 2018-08-06T07:29:14.813

1@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.) – Norbert Schuch – 2018-08-06T09:31:51.897

1@kludg this is not true as written. Did you mean to write hermitian instead of real? – glS – 2018-08-06T09:32:21.807

3

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}$).

Craig Gidney

Posted 2018-08-06T06:15:11.103

Reputation: 11 207