CY gate

The controlled-Y gate: matrix, truth table, the cy() call in Python and JS, and what it becomes on IonQ hardware.

The CY gate applies a Y gate to the target qubit when the control qubit is 1\vert 1 \rangle and leaves it unchanged when the control is 0\vert 0 \rangle. It acts on two qubits and takes no parameters. The Circuit panel draws a dot on the control wire joined to a Y box on the target wire. Measured straight away it flips the target exactly as a CX does; the phases show only once the qubits meet other gates.

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.cy(control, target)
JScircuit.cy(control, target)
Qiskit classCYGate

Matrix

The matrix uses the basis order control  target\vert \text{control}\;\text{target} \rangle, that is 00,01,10,11\vert 00 \rangle, \vert 01 \rangle, \vert 10 \rangle, \vert 11 \rangle.

CY=(10000100000i00i0)CY = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & -i \\ 0 & 0 & i & 0 \end{pmatrix}

Qiskit numbers basis states with qubit 0 as the least significant bit, so Operator(CYGate()) prints the same gate in a different row and column order.

Effect on basis states

InputOutput
00\vert 00 \rangle00\vert 00 \rangle
01\vert 01 \rangle01\vert 01 \rangle
10\vert 10 \ranglei11i\vert 11 \rangle
11\vert 11 \ranglei10-i\vert 10 \rangle

Measured straight away, CY flips the target exactly as CX does; the phases only matter once the qubits meet other gates. With the control in +\vert + \rangle and the target in 0\vert 0 \rangle, CY produces the entangled state 12(00+i11)\tfrac{1}{\sqrt{2}}(\vert 00 \rangle + i\vert 11 \rangle).

Inverse

CY is its own inverse. Two CY gates in a row on the same control and target cancel.

Usage

from qiskit import QuantumCircuit

qc = QuantumCircuit(2, 2)
qc.h(0)
qc.cy(0, 1)
qc.measure([0, 1], [0, 1])
import { QuantumCircuit } from 'qiskit';

const circuit = QuantumCircuit(2, 2);
circuit.h(0);
circuit.cy(0, 1);
circuit.measure([0, 1], [0, 1]);

On a noiseless simulator every shot reads 00 or 11, in close to equal numbers.

On IonQ hardware

CY is not a native gate. It is a CX with an Sdg before it and an S after it on the target, and those two are virtual Z rotations, so CY costs the same as CX: one entangling gate (MS on Aria, ZZ on Forte) plus single-qubit pulses, before IonQ's optimiser runs. 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.