# Can a Hadamard gate be realized with perfect precision?

This is my first question on the Physics Stack Exchange; I hope it is not be a duplicate… :-|

I am not really a physicist (I am actually a professional mathematician), but I have already read quite a few things about quantum computation. And there is a problem that puzzles me: in quantum algorithms, it is assumed that you apply certain quantum gates like, say, the Hadamard gate:

$$H = \frac{1}{\sqrt{2}} \begin{pmatrix}1 & 1\\ 1 & -1\end{pmatrix}.$$

My point is: I do not doubt that you can apply some quantum transformations that are very close to the Hadamard gate, say

$$\tilde{H} = \frac{1}{1.414215} \begin{pmatrix}0.999999 & 1.000001\\ 1.000001 & -1.000002\end{pmatrix};$$

but getting a perfectly precise Hadamard gate seems as impossible to me as, say, building a corner reflector with perfectly right angles between the three mirrors (note that even defining what the angles are worth is meaningless below a certain precision level!). Moreover, as far as I understand it, certain quantum algorithms (including the Shor factorization) require so many successive applications of the Hadamard gate that even a $$10^{-100}$$ error in building such a gate would ruin the result of the algorithm…

The fact that surprises me most is that I have never read anywhere considerations on that issue of the precision of operators!—I have found much stuff devoted to the problem of interactions with the outside and decoherence, but nothing about the problem that I am concerned with…

Can anyone help me? Am I missing some fact which makes the precision problem actually irrelevant? Or, if that problem is relevant, are there some references about this issue? Maybe a classification of how much different algorithms would be sensitive to that matter…?

• have you heard of quantum error correction? – user2723984 Dec 15 '19 at 16:09
• @user2723984 Yes, I have already heard of quantum error correction; but what I have read about that topic seems to tackle only “the problem of interactions with the outside and decoherence” [quoting my own post], and this issue seems of a completely different nature from the question of operator precision… (Also, as far as I understand them, the “error correction methods” seem to only deal with a handful of very specific types of errors…). Anyway, in my question I assume that the system can be perfectly insulated from the outside; only the slight inaccuracies in operators interet me. – Rémi Peyre Dec 15 '19 at 16:33
• I'm far from an expert, but I would guess that since a faulty gate is still a valid evolution, you can see it as a perfect gate followed by errors, which can then be corrected through QEC. – user2723984 Dec 15 '19 at 17:34
• The point is that a quantum computer is neither a digital nor an analog classical computer. Like an analog computer, there can be continuous errors. But like a digital computer, these errors can be completely corrected by discrete operations. This cannot be explained in classical terms, because it isn't classical. – knzhou Dec 16 '19 at 21:21

I will write a brief introduction to quantum error correction (QEC), as it relates to your question.

First, the operations I,X,Y,Z form a complete set, so that any transformation of a single qubit can be written in terms of them. This makes it sufficient to correct errors of these forms, in order to correct general errors. For a proof see early papers by Shor or myself, or a textbook such as Nielsen and Chuang.

Next, a physical system might wander out of the Hilbert space used for computing. In this case it can be corrected by detecting whether or not it has so wandered, returning it if it has, and then applying QEC.

A faulty logic gate is equivalent to a perfect gate followed by an error or errors.

To correct such errors, there are two approaches. First, there are a number of tricks, many of them developed for nuclear magnetic resonance experiments, such that a sequence of well-chosen operations can cancel out common systematic errors. After employing such tricks, what remains are random errors, and QEC is well-designed to cope with those. It works in some respects similarly to error correction in classical information theory, but there are some subtle points regarding correcting in two different bases simultaneously, and in extracting diagnostic information about noise without also extracting information about the logical state. I won't describe all that here but refer you to the (wide) literature.

Finally, QEC itself requires logic gates, and these will be faulty. This brings us to the set of ideas called fault-tolerance. They rely on the use of error-correcting networks which are carefully designed to avoid routes whereby errors can propagate and multiply. They also make use of some interesting features of quantum physics, whereby errors of different types (X, Z) propagate differently, so that the overall correction can go in two stages, neither of which overwhelms the other with noise.

You are correct to discover that large quantum algorithms require high precision of the operations, but it is not as bad as you guess, and this is important. We only require precision at the level $$1/Q$$ where $$Q$$ is the number of steps in the algorithm. This $$Q$$ could be large, say $$10^9$$, but this is (obviously) a lot different from $$10^{100}$$. Memory errors meanwhile need to be at the level $$1/(NQ)$$ where $$N$$ is the number of logical qubits. QEC achieves this degree of precision. A $$t$$-error-correcting protocol reduces the failure probability from $$O(p)$$ to $$O(p^{t+1})$$ where $$p$$ is some basic noise level. If we take $$p=0.01$$ and $$t=5$$ then we get $$\sim 10^{-12}$$ which is good enough for many powerful algorithms.

Some tutorials and other introductory material can be found at:

https://users.physics.ox.ac.uk/~Steane/qec/QECtute.html

• Many thanks dear Andrew Steane for that very nice answer :-) There is still something that is not completely clear for me. When I read Wikipedia on error correction, I read that the Shor QEC code, for instance, is able to correct when one single qubit undergoes a bit flip or a sign flip. But this seems to me a rather different issue than the fact of all qubits undergoing andom, small rotations… Is the Shor QEC code efficient for that too? Or is it something different? (in which case I guess it pertainins to the keword “fault-tolerance”…). (to be continued). – Rémi Peyre Dec 16 '19 at 20:09
• (continued from previous comment). In particular, when you say “a $t$-error correcting code reduces the failure probability from $\mathrm{O}(p)$ to $\mathrm{O}(p^{t + 1})$”, it seems to me that one is referring to specific errors which may or may not occur, not to some noise in the precision of operations… Would you be so kind as to enlighten me on this point too?… – Rémi Peyre Dec 16 '19 at 20:11
• @RémiPeyre The main point for this is that a rotation through $\theta$ can be written $R(\theta) = cos(\theta/2) I + i sin(\theta/2) X$; thus a combination of identity ($I$) and $X$ error. A measurement of the error syndrome subsequently collapses the state so that it corresponds either to the one with $I$ acting (i.e. no error) or to the one with $X$ acting (i.e. 'bit flip' error), the probabilities of the two outcomes going as $\cos^2(\theta/2)$ and $\sin^2(\theta/2)$. I added a link to my answer where you can explore further. – Andrew Steane Dec 16 '19 at 21:21
• @RémiPeyre Your argument is correct for analog classical computing. This decomposition of an imperfect operation into a perfect one and a discrete error is a uniquely quantum thing. – knzhou Dec 16 '19 at 21:22
• @AndrewSteane does this argument depend on the Hadamard error being random? If the Hadamard is systematically under-rotating, then the Syndrome measurements don’t detect an error, correct? – Jahan Claes Dec 16 '19 at 21:47

All gates are imperfect. In the QC business, error rates are usually divided into those for single-qubit gates, such as the Hadamard, and those of two-qubit gates. Often the error from all single-qubit gates can be made small and comparable, while two-qubit gates may be more trouble.

Any complete description of an experimental system will include enumeration of these errors. For example, from the recent Google demonstration of quantum supremacy (1), this comes in Fig. 2:

So the error of a Hadamard gate in their system is on the order of 0.16%.

As seen in this example, single qubit errors are often among the smallest error sources and also relatively uncorrelated, both of which make them good candidates for error correction. So they get talked about less because they generally matter the least, both for current devices and anticipated future ones.

As an interesting sidenote, the error of a one-qubit operation from over-rotation or under-rotation can also be made arbitrarily small, in principle, by use of carefully designed composite pulses (2).