RX gate
The RX gate, a rotation about X by any angle: matrix, effect on the basis states, the rx() call in Python and JS, and its IonQ native-gate form.
The RX gate rotates a qubit about the X axis of the Bloch sphere by an angle . It acts on one qubit and takes one parameter, in radians. The Circuit panel draws it as Rx(θ) with the angle shown as a multiple of π. Measured straight after it, a qubit that started as 0 reads 1 with probability : never at , half the time at , always at .
Kets such as name the basis states and rotations are described on the Bloch sphere; the qubits lesson introduces both.
Call
| Where | Call |
|---|---|
| Python | qc.rx(θ, qubit) |
| JS | circuit.rx(θ, qubit) |
| Qiskit class | RXGate |
| Controlled form | crx(θ, control, target) |
Matrix
rx(π) is an X gate and rx(π/2) is a √X gate, both up to a global phase.
Effect on basis states
| Input | Output |
|---|---|
Measured straight after rx(θ), a qubit that started in reads 1 with probability : 0 at , one half at , certainty at .
Inverse
The inverse of rx(θ) is rx(-θ).
Usage
from math import pi
from qiskit import QuantumCircuit
qc = QuantumCircuit(1, 1)
qc.rx(pi / 3, 0)
qc.measure(0, 0)
import { QuantumCircuit } from 'qiskit';
const circuit = QuantumCircuit(1, 1);
circuit.rx(Math.PI / 3, 0);
circuit.measure(0, 0);
Over many shots about a quarter of them read 1: .
On IonQ hardware
RX is not a native gate for a general angle, because the native pulses GPi and GPi2 have fixed angles of π and π/2. An arbitrary rx(θ) compiles to two GPi2 pulses with a virtual Z of angle θ between them. The special angles are cheaper: rx(±π/2) is a single GPi2 and rx(π) is a single GPi. See How your circuit is compiled.
Related
Stay in the loop.
Get the latest tutorials, demos, and project showcases straight to your inbox. No noise, just the good stuff.
Gates