1

1

I am trying to understand the CRZ and CRY gates functions : what do they actually used for ? why we require a certain angle rotation around z or y Axis on a Qubit ? and what does it yield ?

Application : performing a CNX with Qiskit.

```
def cnx(qc, *qubits):
if len(qubits) >= 3:
last = qubits[-1]
#What's the goal of the next two lines ?
qc.crz(np.pi/2, qubits[-2], qubits[-1])
qc.cry(np.pi/2, 0, 0, qubits[-2],qubits[-1])
#Is this a recursive call to cnx ?
cnx(qc,*qubits[:-2],qubits[-1])
#what there's this flip too ?
qc.cry(-np.pi/2, 0, 0, qubits[-2], qubits[-1])
#what about this line ?
cnx(qc,*qubits[:-2],qubits[-1])
#what about this line too?
qc.crz(-np.pi/2,qubits[-2],qubits[-1])
```

Please explain inline questions, in the context of the initial question.

Thanks !

1Controlled rotations of a qubit around axes are workhorses in quantum algorithms; for example, consider the controlled rotation of the marked state in Grover's algorithm. Unlike, say, the $\mathsf{CNOT}$ or $\mathsf{CSWAP}$ gates, there is no classical analog of a controlled rotation. Can you provide more clarity in what you know and what you are looking to learn? Otherwise it's a little broad - like asking what the purpose of a $\mathsf{NAND}$ gate is in classical computing. – Mark S – 2019-07-05T13:31:36.500

What i know is that it performs a certain angle flip of the target Qubit on the Bloch sphere following the Z -axis for the CRZ and Y - axis for the CRY if the control bit is at state 1. Now why we want to do this, in the first place ? what is it useful in, a flip ? and how the target qubit will look like (e.g an example) at the end ? how could CRZ be more useful in some calculations ? thx – user1319236 – 2019-07-05T13:55:26.690

It seems like you are having specific questions about a snippet of code in Qiskit, and not so much about how controlled Pauli operations are used. It's hard to answer such "moving-target" questions and I don't know how to help further. Maybe someone else can; however, in the future refrain from changing the context of a question and asking XY questions.

– Mark S – 2019-07-05T17:53:01.757Yes it was a double phased question but i commented on your previous answer with an additional question about what your wrote ! – user1319236 – 2019-07-05T18:45:13.120