# Which phase shift gate form is correct?

I am trying to figure out the matrix for a gate I'm going to be implementing - a mirror, i.e., a $180^{\circ}$ phase shift. Quantiki gives

$$R(\theta)=\begin{bmatrix}1&0\\0&e^{2\pi i\theta}\end{bmatrix}$$

for the phase shift gate; here I assume I would set $\theta = 180$ (unless that's the wrong units or something...)

Wikipedia gives

$$R_\phi = \begin{bmatrix}1&0\\0&e^{i\phi}\end{bmatrix}$$

for the phase shift gate, here I guess I'd set $\phi = 180$?

Here's the problem - they're not the same. My guess would be $\phi = 2\pi\theta$ (perhaps, I don't know). Which is the correct matrix? Or are they the same (and if so, how)?

• Who is Quantiki? – Ryan Unger Jul 23 '17 at 1:15
• @0celoñe7 Quantiki is a combination of forum and wikipedia, dedicated to quantum computing. – heather Jul 23 '17 at 13:51
• What do you mean be "correct"? Where do you get the phase parameter from? – Norbert Schuch Jul 26 '17 at 6:43

If you want to phase the $|1\rangle$ state by 180 degrees (i.e. a half-turn) relative to the $|0\rangle$ state, then the operation you want is:
$$R(\pi) = \begin{bmatrix} 1 & 0 \\ 0 & e^{i \pi} \end{bmatrix} = \begin{bmatrix} 1 & 0 \\ 0 & -1 \end{bmatrix} = Z$$
Because $\pi$ is a half-turn in radians.
Craig Gidney already gave the answer to your main problem. I will answer the second one: What is the relation between the two matrices. You know that cosine and sine are $2\pi$ periodic, meaning $\cos(x+2\pi k) = \cos(x)$ and $\sin(x) = \sin(x+2\pi k)$ for any integer $k$. So the function repeats itself every period, which is in the standard case $2\pi$ long. Further $e^{i\theta}=\cos(\theta)+i\sin(\theta)$. Since both function are $2\pi$ periodic and we only add them, $e^{i\theta}$ is also $2\pi$ periodic. This $e^{2\pi i\theta}=e^{i\theta}$. So the two matrices are equal.