# How to Implement a noisy identity gate on qiskit?

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 .

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

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)

print(idle_identity.draw())
#      ┌─────────────────┐
# 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)

cancelling_gates_identity.x(0)
cancelling_gates_identity.barrier([0])
cancelling_gates_identity.x(0)

print(cancelling_gates_identity.draw())
#      ┌───┐ ░ ┌───┐
# 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.