# In Qiskit quantum teleportation protocol, why they use CZ and CX gate at the end?

I understand the simple quantum teleportation protocol and why it uses X and Z gate at the end of the circuit.

I was researching about the Qiskit and I came across this video

which uses the following algorithm for quantum teleportation.

I don't understand why they use CX and CZ gate with qubits $$q_0$$ and $$q_1$$ as controls and qubit $$q_2$$ as the target at the end.

Please try to explain why they're using CZ and CX gate at the end of the circuit.

• Which part exactly don't you understand? In the top example they also use cx and cz gates at the end of the circuit – met927 May 19 at 19:23

The bottom circuit uses quantum version of controlled X and Z gates - gates that are conditioned on the state of another qubit. Since each of the control qubits have been measured before applying CX and CZ gates, their state matches exactly the measurement results: measurement result 1 (which would lead to gates applied in the top circuit) corresponds to qubit state $$|1\rangle$$ (which leads to gates applied in the bottom circuit).