# How to implement the controlled square root of NOT gate on the IBM Q composer?

I already know how to do that for Z, Y, and H gates. How can I make a controlled sqrt-of-NOT gate? I mean the controlled version of the gate described here.

• Hi @Fernando! I flagged your question as a duplicate of quantumcomputing.stackexchange.com/questions/5058/… where you will be able to find the $\sqrt{X}$ gate as $G$. The question I linked is hard to find by searching for the implementation of a "square root of not" gate, I will change the question to make it clearer. Sep 20 '19 at 13:01
• Hi Nelimee, what I need is the controlled version of G. Sep 20 '19 at 18:12
• Oops you are right, I am sorry! Sep 21 '19 at 9:29

Here's one decomposition: It was made by decomposing a controlled S (which is easier to think about because it only phases; it's diagonal) and then converting the basis of the target by conjugating with Hadamards.

It generalizes in-place to any $$\text{CNOT}^{2t}$$: • Thank you, very nice! Sep 20 '19 at 18:26

I cannot add a comment, but I have a little question to the answer, sorry.

Why exactly $$-\pi/2$$ (with minus) is a parameter of the cU1 gate in your circuit? Isn't e.g. $$\pi/2$$ (without minus) appropriate?

• Yes, π/2 (without minus) is appropriate. With this parameter it get another square root of NOT (or X). These roots are the inverse of each other. For hermitian gates such as X, both inverse roots are fine (actually 4 roots, but the remaining 2 differ slightly from these by a common factor of -1). All this also applies to controlled versions of such roots, see e.g. the question in which this is generalized. Aug 5 '20 at 15:05
• In new version of qelib1.inc there is a new function (subroutine) like the decomposition of the Controlled-SqrtX gate given in my answer but with your π/2 (without minus): // controlled-sqrt(X) gate csx a,b { h b; cu1(pi/2) a,b; h b; } Aug 20 '20 at 4:08

If take e.g. this decomposition of the square root of NOT then it's so simple in the IBM Q composer: And although it is unlikely that this circuit form actually consists of 3 elementary gates (I think the cu1 gate is implemented using 5 elementary ones), in my opinion, it looks just easier than others e.g. from here: You can also use functions (subroutines) in the composer (like as csx from qelib1.inc), but unfortunately they do not work well any time or work with restrictions.