# What is the square root of the NOT gate? [duplicate]

I have encountered different matrix of operator "the Square Root of NOT gate".

For example, the matrix is specified here: $$\sqrt {NOT} = \frac{1}{2}\left( {\begin{array}{*{20}{c}} {1 + i}&{1 - i}\\ {1 - i}&{1 + i} \end{array}} \right)$$

And here a completely different matrix is given: $$\sqrt {NOT} = \frac{1}{{\sqrt 2 }}\left( {\begin{array}{*{20}{c}} 1&{ - i}\\ { - i}&1 \end{array}} \right)$$

Applying them to the vector $$\left| 0 \right\rangle = \left( {\begin{array}{*{20}{c}} 1\\ 0 \end{array}} \right)$$, we get different results:

$$\sqrt {NOT} \left| 0 \right\rangle = \frac{1}{2}\left( {\begin{array}{*{20}{c}} {1 + i}&{1 - i}\\ {1 - i}&{1 + i} \end{array}} \right)\left( {\begin{array}{*{20}{c}} 1\\ 0 \end{array}} \right) = \frac{1}{2}\left( {\begin{array}{*{20}{c}} {1 + i}\\ {1 - i} \end{array}} \right)$$

$$\sqrt {NOT} \left| 0 \right\rangle = \frac{1}{{\sqrt 2 }}\left( {\begin{array}{*{20}{c}} 1&{ - i}\\ { - i}&1 \end{array}} \right)\left( {\begin{array}{*{20}{c}} 1\\ 0 \end{array}} \right) = \frac{1}{{\sqrt 2 }}\left( {\begin{array}{*{20}{c}} 1\\ { - i} \end{array}} \right)$$

Where is the correct matrix of the operator $$\sqrt {NOT}$$ specified?

They are the same up to a global phase.

Note that $$1 + i = \sqrt 2 e^{i\pi / 4}$$. That means \begin{align*} \frac{1}{2}\left( {\begin{array}{*{20}{c}} {1 + i}&{1 - i}\\ {1 - i}&{1 + i} \end{array}} \right) &= \frac{1}{2}\left( {\begin{array}{*{20}{c}} \sqrt 2 e^{i\pi / 4}&\sqrt 2 e^{-i\pi / 4}\\ \sqrt 2 e^{-i\pi / 4}&\sqrt 2 e^{i\pi / 4} \end{array}} \right) \\ &= e^{i\pi / 4}.\frac{1}{{\sqrt 2 }}\left( {\begin{array}{*{20}{c}} 1 &e^{-i\pi / 2}\\ e^{-i\pi / 2}&1 \end{array}} \right) \\ &= e^{i\pi / 4}.\frac{1}{{\sqrt 2 }}\left( {\begin{array}{*{20}{c}} 1 &-i\\ -i&1 \end{array}} \right). \end{align*}

• Thanks! But what do you mean by "global phase"? May 13, 2021 at 21:35
• You can find a good explanation for this phrase here: quantumcomputing.stackexchange.com/q/5125/9474 May 13, 2021 at 21:53

As mentioned already, both of those unitaries are the same up to a global phase. It might be useful to think about how you can actually arrive at one of these definitions in terms of the "Not gate" $$X$$. Recall that because $$X^2=I$$ that you can express the exponential of $$X$$ using something very similar to Euler's formula:

\begin{align} \exp\left(-i\theta X\right) = \cos\theta I -i \sin\theta X \end{align} So if we substitute $$\theta = \frac{\pi}{2}$$ we compute $$\exp\left(-i\frac{\pi}{2} X\right)$$ as

\begin{align} X = i \exp\left(-i\frac{\pi}{2} X\right) &= \exp\left(i\frac{\pi}{2}\right)\exp\left(-i\frac{\pi}{2} X\right) \end{align}

Note that the choice of a minus sign is actually important, since it describes which direction you rotate around the x-axis of the Bloch sphere to realize an $$X$$ gate which becomes relevant once you want to compute the square root of that operation. This suggests a possible definition \begin{align} \sqrt{X} &= \sqrt{\exp\left(i\frac{\pi}{2}\right)\exp\left(-i\frac{\pi}{2} X\right)} \\ &= \exp\left(i\frac{\pi}{4}\right)\exp\left(-i\frac{\pi}{4} X\right)\\ &= \frac{(1 + i)}{\sqrt{2}} \left( \cos\frac{\pi}{4}I -i \sin\frac{\pi}{4} X \right) \\ &= \frac{(1 + i)}{\sqrt{2}} \left( \frac{1}{\sqrt{2}} \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix} + \frac{1}{\sqrt{2}} \begin{pmatrix} 0 & -i \\ -i & 0 \end{pmatrix} \right) \\ &= \frac{1}{2}\begin{pmatrix} 1+i & 1-i \\ 1-i & 1+i \end{pmatrix} \end{align}

and so you can at least see how the first definition might have been derived, even if both gates are practically equivalent and therefore "correct".

• This is a great addition to the first answer. It was interesting to see it. Thanks! May 14, 2021 at 9:21