Operations glossary¶
Overview¶
This page is a reference that defines the various classical and quantum operations you can use to manipulate qubits in a quantum circuit. Quantum operations include quantum gates, such as the Hadamard gate, as well as operations that are not quantum gates, such as the measurement operation.
Each entry below provides details and the OpenQASM reference for each operation. See the topic on Build your circuit with OpenQASM code in the IBM Quantum Composer docs for more information.
The q-sphere image in each gate entry below shows the state after the gate operates on the initial equal superposition state , where is the number of qubits needed to support the gate. See the q-sphere topic in the Quantum Composer docs for more information on this visualization.
You can define a custom operation to use in IBM Quantum Composer. For instructions, see the Create a custom operation in OpenQASM topic in the Quantum Composer docs.
To learn more about using operations to create quantum algorithms, see the single- and multi-qubit gates chapter of the Qiskit textbook, Learn Quantum Computation using Qiskit.
Note
The gate colors are slightly different in the light and dark themes. The colors from the light theme are shown here.
Click a quantum operation below to view its definition. Operations no longer used in Circuit Composer are listed in the Obsolete operations section as a historical reference.
Classical gates




Phase gates







Non-unitary operators and modifiers





Hadamard gate

Quantum gates










Classical gates¶
NOT gate¶
The NOT gate, also known as the Pauli X gate, flips the state to , and vice versa. The NOT gate is equivalent to RX for the angle or to ‘HZH’.
For more information about the NOT gate, see XGate in the Qiskit Circuit Library.
Composer reference |
OpenQASM reference |
Note about q-sphere representations |
|
---|---|---|---|
|
The q-sphere representation shows the state after the gate operates on the initial equal superposition state where is the number of qubits needed to support the gate. |
CNOT gate¶
The controlled-NOT gate, also known as the controlled-x (CX) gate, acts on a pair of qubits, with one acting as ‘control’ and the other as ‘target’. It performs a NOT on the target whenever the control is in state . If the control qubit is in a superposition, this gate creates entanglement.
All unitary circuits can be decomposed into single qubit gates and CNOT gates. Because the two-qubit CNOT gate costs much more time to execute on real hardware than single qubit gates, circuit cost is sometimes measured in the number of CNOT gates.
For more information about the CNOT gate, see CXGate in the Qiskit Circuit Library.
Composer reference |
OpenQASM reference |
Note about q-sphere representations |
|
---|---|---|---|
|
The q-sphere representation shows the state after the gate operates on the initial equal superposition state where is the number of qubits needed to support the gate. |
Toffoli gate¶
The Toffoli gate, also known as the double controlled-NOT gate (CCX), has two control qubits and one target. It applies a NOT to the target only when both controls are in state .
The Toffoli gate with the Hadamard gate is a universal gate set for quantum computing.
For more information about the Toffoli gate, see CCXGate in the Qiskit Circuit Library.
Composer reference |
OpenQASM reference |
Note about q-sphere representations |
|
---|---|---|---|
|
The q-sphere representation shows the state after the gate operates on the initial equal superposition state where is the number of qubits needed to support the gate. |
SWAP gate¶
The SWAP gate swaps the states of two qubits.
For more information about the SWAP gate, see SwapGate in the Qiskit Circuit Library.
Composer reference |
OpenQASM reference |
Note about q-sphere representations |
|
---|---|---|---|
|
The q-sphere representation shows the state after the gate operates on the initial equal superposition state where is the number of qubits needed to support the gate. |
Identity gate¶
The identity gate (sometimes called the Id or the I gate) is actually the absence of a gate. It ensures that nothing is applied to a qubit for one unit of gate time.
Composer reference |
Qasm reference |
---|---|
|
Phase gates¶
T gate¶
The T gate is equivalent to RZ for the angle . Fault-tolerant quantum computers will compile all quantum programs down to just the T gate and its inverse, as well as the Clifford gates.
For more information about the T gate, see TGate in the Qiskit Circuit Library.
Composer reference |
OpenQASM reference |
Note about q-sphere representations |
|
---|---|---|---|
|
The q-sphere representation shows the state after the gate operates on the initial equal superposition state where is the number of qubits needed to support the gate. |
S gate¶
The S gate applies a phase of to the state. It is equivalent to RZ for the angle . Note that S=P().
For more information about the S gate, see SGate in the Qiskit Circuit Library.
Composer reference |
OpenQASM reference |
Note about q-sphere representations |
|
---|---|---|---|
|
The q-sphere representation shows the state after the gate operates on the initial equal superposition state where is the number of qubits needed to support the gate. |
Z gate¶
The Pauli Z gate acts as identity on the state and multiplies the sign of the state by -1. It therefore flips the and states. In the +/- basis, it plays the same role as the NOT gate in the / basis.
For more information about the Z gate, see ZGate in the Qiskit Circuit Library.
Composer reference |
OpenQASM reference |
Note about q-sphere representations |
|
---|---|---|---|
|
The q-sphere representation shows the state after the gate operates on the initial equal superposition state where is the number of qubits needed to support the gate. |
T gate¶
Also known as the Tdg or T-dagger gate.
The inverse of the T gate.
For more information about the T gate, see TdgGate in the Qiskit Circuit Library.
Composer reference |
OpenQASM reference |
Note about q-sphere representations |
|
---|---|---|---|
|
The q-sphere representation shows the state after the gate operates on the initial equal superposition state where is the number of qubits needed to support the gate. |
S gate¶
Also known as the Sdg or S-dagger gate.
The inverse of the S gate.
For more information about the S gate, see SdgGate in the Qiskit Circuit Library.
Composer reference |
OpenQASM reference |
Note about q-sphere representations |
|
---|---|---|---|
|
The q-sphere representation shows the state after the gate operates on the initial equal superposition state where is the number of qubits needed to support the gate. |
Phase gate¶
The Phase gate (previously called the U1 gate) applies a phase of to the state. For certain values of , it is equivalent to other gates. For example, P()=Z, P(/)=S, and P()=T. Up to a global phase of , it is equivalent to RZ().
For more information about the Phase gate, see PhaseGate in the Qiskit Circuit Library.
Composer reference |
OpenQASM reference |
Note about q-sphere representations |
|
---|---|---|---|
|
The q-sphere representation shows the state after the gate operates on the initial equal superposition state where is the number of qubits needed to support the gate. |
In IBM Quantum Composer, the default value for theta
is .
RZ gate¶
The RZ gate implements . On the Bloch sphere, this gate corresponds to rotating the qubit state around the z axis by the given angle.
For more information about the RZ gate, see RZGate in the Qiskit Circuit Library.
Composer reference |
OpenQASM reference |
Note about q-sphere representations |
|
---|---|---|---|
|
The q-sphere representation shows the state after the gate operates on the initial equal superposition state where is the number of qubits needed to support the gate. |
In IBM Quantum Composer, the default value for angle
is . Therefore, this is the angle used in the q-sphere visualization.
Non-unitary operators and modifiers¶
Reset operation¶
The reset operation returns a qubit to state , irrespective of its state before the operation was applied. It is not a reversible operation.
Composer reference |
OpenQASM reference |
---|---|
|
Measurement¶
Measurement in the standard basis, also known as the z basis or computational basis. Can be used to implement any kind of measurement when combined with gates. It is not a reversible operation.
Composer reference |
OpenQASM reference |
---|---|
|
Control modifier¶
A control modifier yields a gate whose original operation is now contingent on the state of the control qubit. When the control is in the state, the target qubit(s) undergo the specified unitary evolution. In contrast, no operation is performed if the control is in the state. If the control is in a superposition state, then the resulting operation follows from linearity.
Drag the control modifier to a gate in order to add a control to it. Dots will appear above and below the gate, on the qubit wires that can be targets that control; click one or more dots to assign the target to one or more qubits. You can also assign a control by right-clicking a gate.
To remove a control, right-click the gate and select the option to remove control.
Composer reference |
OpenQASM reference |
---|---|
|
IF operation¶
The IF operation allows quantum gates to be conditionally applied, depending on the state of a classical register.
Composer reference |
OpenQASM reference |
---|---|
|
Barrier operation¶
To make your quantum program more efficient, the compiler will try to combine gates. The barrier is an instruction to the compiler to prevent these combinations being made. Additionally, it is useful for visualizations.
For more information about the Barrier instruction, see Barrier in the Qiskit Circuit Library.
Composer reference |
OpenQASM reference |
---|---|
|
Hadamard gate¶
H gate¶
The H, or Hadamard, gate rotates the states and to and , respectively. It is useful for making superpositions. If you have a universal gate set on a classical computer and add the Hadamard gate, it becomes a universal gate set on a quantum computer.
For more information about the H gate, see HGate in the Qiskit Circuit Library.
Composer reference |
OpenQASM reference |
Note about q-sphere representations |
|
---|---|---|---|
|
The q-sphere representation shows the state after the gate operates on the initial equal superposition state where is the number of qubits needed to support the gate. |
Quantum gates¶
gate¶
Also known as the square-root NOT gate.
This gate implements the square-root of X, . Applying this gate twice in a row produces the standard Pauli-X gate (NOT gate). Like the Hadamard gate, creates an equal superposition state if the qubit is in the state , but with a different relative phase. On some hardwares, it is a native gate that can be implemented with a or X90 pulse.
For more information about the gate, see SXGate in the Qiskit Circuit Library.
Composer reference |
OpenQASM reference |
Note about q-sphere representations |
|
---|---|---|---|
|
The q-sphere representation shows the state after the gate operates on the initial equal superposition state where is the number of qubits needed to support the gate. |
gate¶
Also known as the SXdg or square-root NOT-dagger gate.
This is the inverse of the gate. Applying it twice in a row produces the Pauli-X gate (NOT gate), since the NOT gate is its own inverse. Like the gate, this gate can be used to create an equal superposition state, and it too is natively implemented on some hardwares using an X90 pulse.
For more information about the gate, see SXdgGate in the Qiskit Circuit Library.
Composer reference |
OpenQASM reference |
Note about q-sphere representations |
|
---|---|---|---|
|
The q-sphere representation shows the state after the gate operates on the initial equal superposition state where is the number of qubits needed to support the gate. |
Y gate¶
The Pauli Y gate is equivalent to Ry for the angle . It is equivalent to applying X and Z, up to a global phase factor.
For more information about the Y gate, see YGate in the Qiskit Circuit Library.
Composer reference |
OpenQASM reference |
Note about q-sphere representations |
|
---|---|---|---|
|
The q-sphere representation shows the state after the gate operates on the initial equal superposition state where is the number of qubits needed to support the gate. |
RX gate¶
The RX gate implements . On the Bloch sphere, this gate corresponds to rotating the qubit state around the x axis by the given angle.
For more information about the RX gate, see RXGate in the Qiskit Circuit Library.
Composer reference |
OpenQASM reference |
Note about q-sphere representations |
|
---|---|---|---|
|
The q-sphere representation shows the state after the gate operates on the initial equal superposition state where is the number of qubits needed to support the gate. |
In IBM Quantum Composer, the default value for angle
is . Therefore, this is the angle used in the q-sphere visualization.
RY gate¶
The RY gate implements . On the Bloch sphere, this gate corresponds to rotating the qubit state around the y axis by the given angle and does not introduce complex amplitudes.
For more information about the RY gate, see RYGate in the Qiskit Circuit Library.
Composer reference |
OpenQASM reference |
Note about q-sphere representations |
|
---|---|---|---|
|
The q-sphere representation shows the state after the gate operates on the initial equal superposition state where is the number of qubits needed to support the gate. |
In IBM Quantum Composer, the default value for angle
is . Therefore, this is the angle used in the q-sphere visualization below.
RXX gate¶
The RXX gate implements . The Mølmer–Sørensen gate, the native gate on ion-trap systems, can be expressed as a sum of RXX gates.
For more information about the RXX gate, see RXXGate in the Qiskit Circuit Library.
Composer reference |
OpenQASM reference |
Note about q-sphere representations |
|
---|---|---|---|
|
The q-sphere representation shows the state after the gate operates on the initial equal superposition state where is the number of qubits needed to support the gate. |
In IBM Quantum Composer, the default value for angle
is .
RZZ gate¶
The RZZ gate requires a single parameter: an angle expressed in radians. This gate is symmetric; swapping the two qubits it acts on doesn’t change anything.
For more information about the RZZ gate, see RZZGate in the Qiskit Circuit Library.
Composer reference |
OpenQASM reference |
Note about q-sphere representations |
|
---|---|---|---|
|
The q-sphere representation shows the state after the gate operates on the initial equal superposition state where is the number of qubits needed to support the gate. |
In IBM Quantum Composer, the default value for angle
is .
U gate¶
(Previously called the U3 gate) The three parameters allow the construction of any single-qubit gate. Has a duration of one unit of gate time.
For more information about the U gate, see UGate in the Qiskit Circuit Library.
Composer reference |
OpenQASM reference |
Note about q-sphere representations |
|
---|---|---|---|
|
The q-sphere representation shows the state after the gate operates on the initial equal superposition state where is the number of qubits needed to support the gate. |
In IBM Quantum Composer, the default value for angle
is .
RCCX gate¶
The simplified Toffoli gate, also referred to as Margolus gate.
The simplified Toffoli gate implements the Toffoli gate up to relative phases. This implementation requires three CX gates, which is the minimal amount possible, as shown in https://arxiv.org/abs/quant-ph/0312225. Note that the simplified Toffoli is not equivalent to the Toffoli, but can be used in places where the Toffoli gate is uncomputed again.
For more information about the RCCX gate, see RCCXGate in the Qiskit Circuit Library.
Composer reference |
OpenQASM reference |
Note about q-sphere representations |
|
---|---|---|---|
|
The q-sphere representation shows the state after the gate operates on the initial equal superposition state where is the number of qubits needed to support the gate. |
RC3X gate¶
The simplified 3-controlled Toffoli gate.
The simplified Toffoli gate implements the Toffoli gate up to relative phases. Note that the simplified Toffoli is not equivalent to the Toffoli, but can be used in places where the Toffoli gate is uncomputed again.
For more information about the RC3X gate, see RC3XGate in the Qiskit Circuit Library.
Composer reference |
OpenQASM reference |
Note about q-sphere representations |
|
---|---|---|---|
|
The q-sphere representation shows the state after the gate operates on the initial equal superposition state where is the number of qubits needed to support the gate. |
Obsolete operations¶
These operations are no longer used in IBM Quantum Composer; we list them here for historical purposes.
CSWAP gate¶
Composer reference |
OpenQASM reference |
---|---|
|
U1 gate¶
The U1 gate has been renamed the phase gate.
Composer reference |
OpenQASM reference |
---|---|
|
U3 gate¶
The U3 gate has been renamed the U gate.
Composer reference |
OpenQASM reference |
---|---|
|
U2 gate¶
Composer reference |
OpenQASM reference |
---|---|
|
CU1 gate¶
To recreate this gate, add the control modifier to the phase gate (formerly the U1 gate).
Composer reference |
OpenQASM reference |
---|---|
|
CU3 gate¶
To recreate this gate, add the control modifier to the U gate (formerly the U3 gate).
Composer reference |
OpenQASM reference |
---|---|
|
CH gate¶
Composer reference |
OpenQASM reference |
---|---|
|
CY gate¶
Composer reference |
OpenQASM reference |
---|---|
|
CZ gate¶
Composer reference |
OpenQASM reference |
---|---|
|
CRX gate¶
Composer reference |
OpenQASM reference |
---|---|
|
CRY gate¶
Composer reference |
OpenQASM reference |
---|---|
|
CRZ gate¶
Composer reference |
OpenQASM reference |
---|---|
|