RY gate

The RY gate, a rotation about Y by any angle: matrix, effect on the basis states, the ry() call in Python and JS, and its IonQ native-gate form.

The RY gate rotates a qubit about the Y axis of the Bloch sphere by an angle θ\theta. It acts on one qubit and takes one parameter, θ\theta in radians. The Circuit panel draws it as Ry(θ) with the angle shown as a multiple of π. Measured straight after it, a qubit that started as 0 reads 1 with probability sin2(θ/2)\sin^2(\theta/2): never at θ=0\theta = 0, half the time at θ=π/2\theta = \pi/2, always at θ=π\theta = \pi.

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.ry(θ, qubit)
JScircuit.ry(θ, qubit)
Qiskit classRYGate
Controlled formcry(θ, control, target)

Matrix

RY(θ)=(cosθ2sinθ2sinθ2cosθ2)RY(\theta) = \begin{pmatrix} \cos\frac{\theta}{2} & -\sin\frac{\theta}{2} \\ \sin\frac{\theta}{2} & \cos\frac{\theta}{2} \end{pmatrix}

The matrix is real, so RY never introduces complex phases. ry(π) is a Y gate up to a global phase, and ry(π/2) takes 0\vert 0 \rangle to +\vert + \rangle, the same state an H gate produces from 0\vert 0 \rangle.

Effect on basis states

InputOutput
0\vert 0 \ranglecosθ20+sinθ21\cos\frac{\theta}{2}\vert 0 \rangle + \sin\frac{\theta}{2}\vert 1 \rangle
1\vert 1 \ranglesinθ20+cosθ21-\sin\frac{\theta}{2}\vert 0 \rangle + \cos\frac{\theta}{2}\vert 1 \rangle

Measured straight after ry(θ), a qubit that started in 0\vert 0 \rangle reads 1 with probability sin2(θ/2)\sin^2(\theta/2): 0 at θ=0\theta = 0, one half at θ=π/2\theta = \pi/2, certainty at θ=π\theta = \pi.

Inverse

The inverse of ry(θ) is ry(-θ).

Usage

from math import pi
from qiskit import QuantumCircuit

qc = QuantumCircuit(1, 1)
qc.ry(pi / 3, 0)
qc.measure(0, 0)
import { QuantumCircuit } from 'qiskit';

const circuit = QuantumCircuit(1, 1);
circuit.ry(Math.PI / 3, 0);
circuit.measure(0, 0);

Over many shots about a quarter of them read 1: sin2(π/6)=0.25\sin^2(\pi/6) = 0.25.

On IonQ hardware

RY is not a native gate for a general angle. An arbitrary ry(θ) compiles to two GPi2 pulses with a virtual Z of angle θ between them. The special angles are cheaper: ry(π/2) is exactly GPi2(0.25), a single pulse, and ry(π) is a single GPi. 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.