# Controlled phase shift gate

How does a controlled R gate look like (matrixwise)? And how to generate CCR, CCCR and so on?

I found the answer and it seems like for a gate

$$U = \begin{bmatrix} x_{00} & x_{10}\\ x_{00} & x_{11} \end{bmatrix}$$

its controlled variant would be: $$CU=\begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & x_{00} & x_{01} \\ 0 & 0 & x_{10} & x_{11} \end{bmatrix}$$

Hence for R, which is $$R(\theta) = \begin{bmatrix} 1 & 0\\ 0 & e^{i \theta} \end{bmatrix}$$

CR would be: $$CR(\theta)=\begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & e^{i \theta} \end{bmatrix}$$

P.S.: Please, correct me if I'm wrong.

• Yes, you are right. Similarly you can get a C...CU gate, $U$ is in the right bottom corner of a C...CU gate, other diagonal elements are ones and other non-diagonal elements are zeros. Dec 8, 2019 at 22:20

The phase shift is a family of single-qubit gates that map the basis states ket(0) to ket(0) and ket(1) to exp(i theta)* ket(1) so by using this we can find matrix of controlled phase shift operator.

• Hi and welcome to Quantum Computing SE. Please use proper formating of maths with Latex. Jun 10, 2022 at 6:13