T gate

The T gate, an eighth-turn phase: matrix, effect on the basis states, the t() call in Python and JS, and why it costs nothing on IonQ hardware.

The T gate multiplies the 1\vert 1 \rangle amplitude by eiπ/4e^{i\pi/4}, an eighth turn of phase, and leaves 0\vert 0 \rangle alone. It acts on one qubit and takes no parameters. The Circuit panel draws it as T. On its own it changes nothing a measurement can see; the phase shows once the qubit is in superposition.

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.t(qubit)
JScircuit.t(qubit)
Qiskit classTGate

Matrix

T=(100eiπ/4)T = \begin{pmatrix} 1 & 0 \\ 0 & e^{i\pi/4} \end{pmatrix}

On the Bloch sphere this is an eighth-turn about the Z axis. Two T gates make an S, four make a Z. It is the special case p(π/4) of the P gate.

Effect on basis states

InputOutput
0\vert 0 \rangle0\vert 0 \rangle
1\vert 1 \rangleeiπ/41e^{i\pi/4}\vert 1 \rangle
+\vert + \rangle12(0+eiπ/41)\tfrac{1}{\sqrt{2}}(\vert 0 \rangle + e^{i\pi/4}\vert 1 \rangle)

A measurement straight after T shows no change on 0\vert 0 \rangle or 1\vert 1 \rangle.

Inverse

The inverse of T is Tdg, tdg(qubit).

Usage

from qiskit import QuantumCircuit

qc = QuantumCircuit(1, 1)
qc.h(0)
for _ in range(4):
    qc.t(0)
qc.h(0)
qc.measure(0, 0)
import { QuantumCircuit } from 'qiskit';

const circuit = QuantumCircuit(1, 1);
circuit.h(0);
for (let i = 0; i < 4; i++) circuit.t(0);
circuit.h(0);
circuit.measure(0, 0);

Every shot reads 1: four T gates make a Z, and H Z H is an X.

On IonQ hardware

T is a virtual Z. The compiler folds the eighth-turn into the phase of the next pulse, so it costs no gate and no time on the machine. 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.