# Quantum Phase Estimation on the X gate

So I'm trying to perform QPE on the X-gate in IBM quantum but I'm not 100% sure that my implementation is correct. I've been able to do this for the T, S, and Z gates by using P gates with different phases. However the X gate does something fundamentally different from all of those gates, so I'm not sure how I should modify my circuit.

Here is my implementation for the T gate, which I know is correct: What should I change here to perform QPE on the X gate instead?

If you wanted to figure this out on your own, the way to go about it would probably be to first note the degrees of freedom in the standard QPE algorithm: the size of register to be measured (the more qubits, the higher the accuracy), the gate to find the phase factor of, and the eigenvector. You probably don't really need to worry about the register since you are just trying to run the algorithm instead of making it particularly accurate. The gate we're using is just $$X$$. Then you would pick the one of two eigenvectors of the $$X$$ gate (which are very simple; you probably know them). Then from there it's really just filling in the blanks of the circuit, i.e. prepare the eigenvector, apply the controlled $$X^{2^k}$$ gates for each qubit, etc.
I'll write the solution itself here too, in case you want it (spoilers). $$\newcommand{\ket}[1]{|#1\rangle}$$The eigenvectors of the $$X$$ gate are $$\ket{+}$$ and $$\ket{-}$$, with eigenvalues $$1$$ and $$-1$$ respectively, so you would start by choosing one of those. Their angles would respectively be $$0$$ and $$\pi$$.
We choose $$X$$ to be our gate. Then, we have to implement $$X^{2^k}$$ for arbitrary $$k$$. There are different ways you could do this.
• The simplest way is to just apply the controlled $$X$$ gate multiple times.
• You could apply a controlled $$R_X$$ gate to perform the $$X$$ gate multiple times in a row in just one gate.
• At least in the case of the $$X$$ gate, basically every qubit past the first is going to not be significant since for every $$k \ge 2$$, it is the case that $$X^{2^k} = I$$. Therefore you could simply apply only the CNOT gate from the first qubit without any problems.