# What are theta, phi and lambda in cu1(theta, ctl, tgt) and cu3(theta, phi, lam, ctl, tgt)? What are the rotation matrices being used?

I was reading the documentation for qiskit.QuantumCircuit and came across the functions cu1(theta, ctl, tgt) and cu3(theta, phi, lam, ctl, tgt). Looking at the names they seem to be controlled rotations. ctrl represents the controlled qubit and tgt represents the target qubit. However, what are theta, lambda and phi? They're rotations about which axes? Also, which rotation matrices are being used for cu1 and cu3?

From IBM Q Documentation (the link is hard to find) here is the definition of the generic gate: $$U(\theta, \phi, \lambda) = \begin{pmatrix} \cos\left(\frac{\theta}{2}\right) & -e^{i\lambda} \sin\left(\frac{\theta}{2}\right) \\ e^{i\phi} \sin\left(\frac{\theta}{2}\right) & e^{i(\lambda + \phi)} \cos\left(\frac{\theta}{2}\right) \end{pmatrix}$$

With this gate, they define the following gates: $$\begin{split} U_1(\lambda) &= U(0, 0, \lambda) = \begin{pmatrix} 1 & 0 \\ 0 & e^{i\lambda} \end{pmatrix} \\ U_2(\phi, \lambda) &= U\left(\frac{\pi}{2}, \psi, \lambda\right) = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 & -e^{i\lambda} \\ e^{i\phi} & e^{i(\lambda+\phi)} \end{pmatrix} \\ U_3(\theta, \phi, \lambda) &= U(\theta, \phi, \lambda) = \text{see above} \end{split}$$

These gates are the basis (with CX) of the IBM Q online backends (i.e. the real chips).

The cu1 and cu3 are the controlled operations associated with the matrices above.

In response to your 1st question:

The $$\theta$$, $$\phi$$, and $$\lambda$$ are just different representations here, to show that they are independent, just the angle $$\theta$$ that we study in the rotation gates. $$R_x(\theta)$$, $$R_y(\theta)$$, and $$R_z(\theta)$$

You can understand it by decomposing this U gate $$\begin{equation} U3(\theta, \phi, \lambda) = R_z(\phi)R_y(\theta)R_z(\lambda)\\ U1(\theta) = R_z(\theta) \end{equation}$$

Finally, convert them to control gates. Here, I am just explaining, what are $$\theta$$, $$\phi$$, and $$\lambda$$?

Now, In response to your 2nd question:

U is a gate with parameters so until unless you provide parameters there is no specific axis of rotation.

Finally,

$$\begin{equation} U1(\lambda) = U3(0,0,\lambda)\\ cU1 = |0\rangle\langle0| \otimes I + |1\rangle\langle1| \otimes U1 \end{equation}$$

Similar for U3.