# Quantum instruction glossary¶

This page is a reference that defines the various quantum instructions you can use to manipulate qubits in a quantum circuit. Quantum instructions include quantum gates, such as the Hadamard gate, as well as operations that are not quantum gates, such as the measurement instruction.

To learn more about using quantum gates to create quantum algorithms, see the single- and multi-qubit gates chapter of the IBM textbook, Learn Quantum Computation using Qiskit.

Click on a quantum instruction below to view its definition.

## H gate¶

The H or Hadamard gate rotates the states and to and , respectively. It is useful for making superpositions. As a Clifford gate, it is useful for moving information between the x and z bases.

Composer reference

OpenQASM reference

Bloch sphere rotation

h q[0];

## CX gate¶

The controlled-X gate is also known as the controlled-NOT. It acts on a pair of qubits, with one acting as ‘control’ and the other as ‘target’. It performs an X on the target whenever the control is in state . If the control qubit is in a superposition, this gate creates entanglement.

Composer reference

OpenQASM reference

cx q[0], q[1];

## Id gate¶

The identity 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

OpenQASM reference

id q[0];

## Rx gate¶

The Rx gate requires a single parameter: an angle expressed in radians. On the Bloch sphere, this gate corresponds to rotating the qubit state around the x axis by the given angle.

Composer reference

OpenQASM reference

Bloch sphere rotation

rx(pi/2) q[0];

## Ry gate¶

The Ry gate requires a single parameter: an angle expressed in radians. On the Bloch sphere, this gate corresponds to rotating the qubit state around the y axis by the given angle.

Composer reference

OpenQASM reference

Bloch sphere rotation

ry(pi/2) q[0];

## Rz gate¶

The Rz gate requires a single parameter: an angle expressed in radians. On the Bloch sphere, this gate corresponds to rotating the qubit state around the z axis by the given angle.

Composer reference

OpenQASM reference

Bloch sphere rotation

rz(pi/2) q[0];

## X gate¶

The Pauli X gate has the property of flipping the state to , and vice versa. It is equivalent to Rx for the angle .

Composer reference

OpenQASM reference

Bloch sphere rotation

x q[0];

## Y gate¶

The Pauli Y gate is equivalent to Ry for the angle . It is also equivalent to the combined effect of X and Z.

Composer reference

OpenQASM reference

Bloch sphere rotation

y q[0];

## Z gate¶

The Pauli Z gate has the property of flipping the to , and vice versa. It is equivalent to Rz for the angle .

Composer reference

OpenQASM reference

Bloch sphere rotation

z q[0];

## S gate¶

The S gate is equivalent to Rz for the angle . As a Clifford gate, it is useful for moving information between the x and y bases.

Composer reference

OpenQASM reference

Bloch sphere rotation

s q[0];

## Sdg gate¶

The inverse of the S gate. Equivalent to Rz for the angle . As a Clifford gate, it is useful for moving information between the x and y bases.

Composer reference

OpenQASM reference

Bloch sphere rotation

sdg q[0];

## 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.

Composer reference

OpenQASM reference

Bloch sphere rotation

t q[0];

## Tdg gate¶

The inverse of the T gate, which 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.

Composer reference

OpenQASM reference

Bloch sphere rotation

tdg q[0];

## cH gate¶

The controlled-Hadamard gate, like the controlled-NOT, acts on a control and target qubit. It performs an H on the target whenever the control is in state .

Composer reference

OpenQASM reference

ch q[0], q[1];

## cZ gate¶

The controlled-Z gate, like the controlled-NOT, acts on a control and target qubit. It performs a Z on the target whenever the control is in state .

Composer reference

OpenQASM reference

cz q[0], q[1];

## cRz gate¶

The controlled-Rz gate, like the controlled-NOT, acts on a control and target qubit. It performs a Rz rotation on the target whenever the control is in state .

Composer reference

OpenQASM reference

crz(pi/2) q[0], q[1];

## ccX gate¶

The ccX gate, commonly known as the Toffoli, has two control qubits and one target. At applies an X to the target only when both controls are in state .

Composer reference

OpenQASM reference

ccx q[0], q[1], q[2];

## SWAP gate¶

The SWAP gate simply swaps the states of two qubits.

Composer reference

OpenQASM reference

swap q[0], q[1];

## 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.

Composer reference

OpenQASM reference

barrier q;

## \left|0\right\rangle 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

reset q[0];

## IF operation¶

The IF operation allows quantum gates to be conditionally applied, depending on the state of a classical register.

Composer reference

OpenQASM reference

if (c==0) x q[0];

## z 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

measure q[0];

## U3 gate¶

The three parameters allow the construction of any single-qubit gate. Has a duration of one unit of gate time.

Composer reference

OpenQASM reference

Bloch sphere rotation

u3(pi/2,pi/2,pi/2) q[0];

## U2 gate¶

The two parameters control two different rotations within the gate. Has a duration of one unit of gate time.

Composer reference

OpenQASM reference

Bloch sphere rotation

u2(pi/2,pi/2) q[0];

## U1 gate¶

Equivalent to Rz. This can be implemented by the control software, requiring no actual manipulation of the qubits, and so effectively has a duration of zero.

Composer reference

OpenQASM reference

Bloch sphere rotation

u1(pi/2) q[0];