I can successfully implement the U gate (single qubit) on qiskit, but when I am trying for the identity operation it is not showing any differences with the ideal one .

  • 1
    $\begingroup$ It'd be great if you included that you used to implement $U$ and the one you're using to implement $I$ $\endgroup$
    – epelaez
    Jul 23, 2021 at 13:26
  • 2
    $\begingroup$ Try putting barriers in between to be sure that the transpiler is not skipping every identity gate $\endgroup$
    – Mauricio
    Jul 23, 2021 at 13:50
  • $\begingroup$ @epelaaez I have tried with noisy U(0,0 ,0) it gives same result with the ideal identity gate $\endgroup$ Jul 24, 2021 at 14:48
  • 2
    $\begingroup$ Try setting optimization_level to 0. Also it will help if you include your code. $\endgroup$ Jul 25, 2021 at 4:57

2 Answers 2


It depend what you mean by "noisy"! Here are 2 methods to implement a noisy indentity gate that will likely not experience the same type of noise.

Using delays

You can implement the identity operation by... doing nothing. When doing nothing, qubits will experience decoherence, and so you end up applying a "noisy identity gate".

from qiskit import QuantumCircuit

idle_identity = QuantumCircuit(1)
# Take a delay that is a multiple of 16 dt, it will prevent some issues.
idle_identity.delay(300 * 16, 0)

#      ┌─────────────────┐
# q_0: ┤ Delay(4800[dt]) ├
#      └─────────────────┘

Using cancelling sequences of gates

If you want another type of noise, you might want to use sequences of gates that simplify to the identity. In this case you will have to either add barriers between each gate or use optimization_level=0 to prevent the transpiler simplifying the sequence.

from qiskit import QuantumCircuit

cancelling_gates_identity = QuantumCircuit(1)


#      ┌───┐ ░ ┌───┐
# q_0: ┤ X ├─░─┤ X ├
#      └───┘ ░ └───┘

If you want more noise, just increase the number of gates.


If you use from qiskit.providers.aer.noise import NoiseModel to add noise in your U gate operation. Then it won't behave like an ideal gate, https://qiskit.org/documentation/tutorials/simulators/4_custom_gate_noise.html here you can get more information.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.