√X gate

The √X gate, half of an X: matrix, effect on the basis states, the sx() call in Python and JS, and its IonQ native-gate form.

The √X gate, SX, is half of an X gate: two of them in a row make one X. It acts on one qubit and takes no parameters. The Circuit panel draws it as √X. Measured straight after it, a qubit that started as 0 reads 0 or 1 with equal probability.

Kets such as 0\vert 0 \rangle name the basis states and rotations are described on the Bloch sphere; the qubits lesson introduces both.

Call

WhereCall
Pythonqc.sx(qubit)
JScircuit.sx(qubit)
Qiskit classSXGate
Controlled formcsx(control, target)

Matrix

X=12(1+i1i1i1+i)\sqrt{X} = \frac{1}{2} \begin{pmatrix} 1 + i & 1 - i \\ 1 - i & 1 + i \end{pmatrix}

On the Bloch sphere this is a quarter-turn about the X axis. It is the same operation as rx(π/2) up to a global phase.

Effect on basis states

InputOutput
0\vert 0 \rangle12((1+i)0+(1i)1)\tfrac{1}{2}\big((1 + i)\vert 0 \rangle + (1 - i)\vert 1 \rangle\big)
1\vert 1 \rangle12((1i)0+(1+i)1)\tfrac{1}{2}\big((1 - i)\vert 0 \rangle + (1 + i)\vert 1 \rangle\big)

Measured straight after √X, a qubit that started in 0\vert 0 \rangle or 1\vert 1 \rangle reads 0 or 1 with equal probability, the same split as after an H gate but with different phases.

Inverse

The inverse of √X is √X†, sxdg(qubit). √X is not its own inverse: two of them make an X.

Usage

from qiskit import QuantumCircuit

qc = QuantumCircuit(1, 1)
qc.sx(0)
qc.sx(0)
qc.measure(0, 0)
import { QuantumCircuit } from 'qiskit';

const circuit = QuantumCircuit(1, 1);
circuit.sx(0);
circuit.sx(0);
circuit.measure(0, 0);

Every shot reads 1: the two half-flips make one full flip.

On IonQ hardware

√X is GPi2(0) up to a global phase, a native gate, so it costs one physical pulse. See How your circuit is compiled.

Stay in the loop.

Get the latest tutorials, demos, and project showcases straight to your inbox. No noise, just the good stuff.