# How to write a code to made envelope function equal to $\pi$ to result in an X gate?

$$\hat U_d = \exp\Big( -i\underbrace{\frac{Q}{2}\int_0^T A(t^\prime)\mathop{dt^\prime}}_{\Theta(t)} \hat\sigma_x \Big)$$

This equation is a Unitary transformation applied to a qubit from time $$t = 0$$ to time $$t=T$$. I want the underlined envelope function $$\Theta(t)$$ to equal $$\pi$$ to result in an $$X$$ gate. What code should I write to accomplish this? Should I do frequency sweeps of multiple parameters? I know that a Gaussian pulse should be involved.

• What do you mean by ...to equal π to result in an X gate...? Oct 13 at 17:26
• I want to get the underlined part to be equal to pi. If this happens, then the result will be an X gate. Oct 14 at 2:13
• Sorry but I still do not understand. How the result could be a gate? I would expect a quantum state to be the result. Oct 14 at 6:21
• Maybe the result is a quantum state that had an X gate performed on it. Oct 14 at 14:41

Let's firstly rewrite it as $$U_d = \mathrm{exp}(-i\Theta(t)\sigma_x)$$ or $$U_d = \mathrm{exp}(-i\Theta(t)X)$$ (i.e. I replaced the notation $$\sigma_x$$ for Pauli $$X$$ gate by symbol $$X$$).
This means that $$U_d$$ is in fact $$x$$ rotation given by formula $$Rx(\theta)= \mathrm{exp}\Big(-i\frac{\theta}{2}X\Big)= \begin{pmatrix} \cos(\theta/2) & -i\sin(\theta/2)\\ -i\sin(\theta/2) & \cos(\theta/2) \end{pmatrix}.$$ Setting $$\theta/2 = \pi/2$$ (or $$\theta = \pi$$) we get $$Rx(\pi) = \begin{pmatrix} \cos(\pi/2) & -i\sin(\pi/2)\\ -i\sin(\pi/2) & \cos(\pi/2) \end{pmatrix} = \begin{pmatrix} 0 & -i\\ -i & 0 \end{pmatrix} = -iX,$$ or in other words $$x$$ rotation with the rotation angle equal to $$\pi$$ is equivalent to Pauli $$X$$ gate up to global phase $$-i$$.
So, if you are able to compute your definite integral $$\Theta(t)$$, then the operation $$U_d$$ is simply $$Rx(\theta)$$ gate with the angle $$\theta = 2\Theta(t)$$. If $$2\Theta(t) = \pi$$ then you will get $$X$$ gate up to global phase $$-i$$.