# Is it possible to detect the phase $\pi$ or 0 for the single qubit circuit X H P?

I found an answer that shows how to detect the phase in cases like $$0$$, $$\pi/8$$, $$\pi/2$$, $$\pi/4$$ or $$\pi$$ for circuit to prepare state as H P, where P is a phase gate like $$I$$, $$U1(\pi/8)$$, $$S$$, $$T$$ or $$Z$$.

But in my case the circuit to prepare state is $$X H P$$, where $$P$$ is $$X$$ gate (conditionally phase $$\pi$$) or $$ID$$ (conditionally phase 0).

This circuit in Qasm with conditionally phase equal to $$\pi$$:

x q[0];
h q[0];
x q[0];


with conditionally phase equal to $$0$$:

x q[0];
h q[0];
id q[0];


Appending $$H$$ gate (as in the above answer) don't detect a difference for conditionally phase $$\pi$$ and phase $$0$$ (but does detect for phases $$\pi/2$$, $$\pi/4$$, $$\pi/8$$ if $$P$$ is $$S$$, $$T$$, $$U1(\pi/8)$$, respectively).

Is it possible to detect the conditionally phase $$P$$ $$\pi$$ or 0 for this circuit to prepare state?

Your XHP-circuit where P=ID, prepares the state: [0.707+0j,-0.707+0j], where P=X, prepares the state: [-0.707+0j, 0.707+0j]. These states are differ by a global phase $${e}^{i\pi}=-1$$.
But the global phase is undetectable $$|ψ⟩:={e}^{iδ}|ψ⟩$$, also see the answer.
• Your XHP-circuit where P=ID, prepares the state: [0.707+0j,-0.707+0j], where P=X, prepares the state: [-0.707+0j, 0.707+0j]. These states are differ by a global phase ${e}^{i\pi}=-1$. About that a global phase is undetectable ($|ψ⟩:={e}^{iδ}|ψ⟩$), you can read e.g. here. Jul 16 '20 at 14:32