The Identity Gate is one of the seemingly un-important Gate in Quantum Computing. Qiskit provides a method for applying Identity Gate on a Qubit. In this chapter of the Qiskit Tutorial, you will learn about Identity Gate and how to apply the Identity Gate on a Qubit in Qiskit.
Identity Gate
The Identity Gate or I Gate acts on a single Qubit. The I Gate does nothing.
It is however used for calculations. For example, in the equations below the I Matrix(equivalent to the application of I Gate) is used for proving that X, Y, Z, and H gates are their own inverse.
Example
For a Qubit in state Ψ = 1/sqrt(3) |0> + sqrt(2/3) |1>
, the application of I Gate will keep the state of the Qubit to
. Therefore, there is no change- neither in the amplitude/ probability nor the phase in the state of the Qubit after applying the I Gate.Ψ = 1/sqrt(3) |0> + sqrt(2/3) |1>
Identity Gate: Bloch Sphere
Since the I Gate does not change the state of a Qubit, the Bloch Sphere representation of the Qubit does not change after the application of I Gate.
Identity Gate: Pauli Matrix
The I Gate in Quantum Computing is represented by the matrix I
which is an identity matrix.
Since the matrix representation of the I Gate is an Identity Matrix. Multiplying the Matrix for I Gate with the vector representing the state of the Qubit will result in the original vector.
Example
In this example, we will apply the I gate to a Qubit, and calculate the resulting state by Multiplying it with the Matrix for I Gate.
Let the state of the Qubit be Ψ = 1/sqrt(3) |0> + sqrt(2/3) |1>
After Applying the I Gate, the resulting state of the Qubit can be calculated by-
Similarly as before, the state of the Qubit does not change after the application of I Gate.
Identity Gate in Qiskit
The I Gate in Qiskit can be applied to any Qubit by calling the i()
method on the Quantum Circuit(an instance of QuantumCircuit
class) and passing it an integer for the Qubit on which I Gate is to be applied.
Example
In this example, we will be applying I Gate on the first Qubit in the Quantum Circuit, which will contain 2 Qubits.
# Creating a Quantum Register with 1 Qubit
qr = qiskit.QuantumRegister(2)
# Creating a Quantum Circuit
circuit = QuantumCircuit(qr)
# Applying I Gate on the first Qubit
circuit.i(0)
# Drawing the Quantum Circuit
circuit.draw()
This will result in the following Quantum Circuit being drawn-
Notice that the I Gate is applied to the first Qubit. Also notice, that Qubits follow a 0 based indexing.