# tGate

T gate

Since R2023a

Installation Required: This functionality requires MATLAB Support Package for Quantum Computing.

## Description

example

g = tGate(targetQubit) applies a T gate to a single target qubit and returns a quantum.gate.SimpleGate object.

If targetQubit is a vector of qubit indices, tGate returns a column vector of gates, where g(i) represents a T gate applied to a qubit with index targetQubit(i).

Applying this gate is equivalent to applying the R1 gate with a rotation angle of π/4, meaning that tGate(targetQubit) is equivalent to r1Gate(targetQubit,pi/4).

## Examples

collapse all

Create a T gate that acts on a single qubit.

g = tGate(1)
g =

SimpleGate with properties:

Type: "t"
ControlQubits: [1×0 double]
TargetQubits: 1
Angles: [1×0 double]

Get the matrix representation of the gate.

M = getMatrix(g)
M =

1.0000 + 0.0000i   0.0000 + 0.0000i
0.0000 + 0.0000i   0.7071 + 0.7071i

Create an array of T gates that act on qubits with indices 1 to 4.

g = tGate(1:4)
g =

4×1 SimpleGate array with gates:

Id   Gate   Control   Target
1   t                1
2   t                2
3   t                3
4   t                4

## Input Arguments

collapse all

Target qubit of the gate, specified as a positive integer scalar index or vector of qubit indices.

Example: 1

Example: 3:5

collapse all

### Matrix Representation of T Gate

The matrix representation of a T gate applied to a single qubit is

$\left[\begin{array}{cc}1& 0\\ 0& \mathrm{exp}\left(i\text{\hspace{0.17em}}\frac{\pi }{4}\right)\end{array}\right]=\left[\begin{array}{cc}1& 0\\ 0& \frac{1+i}{\sqrt{2}}\end{array}\right].$

Applying this gate is equivalent to applying an R1 gate with a rotation angle of π/4. This gate is also known as the fourth root of Pauli Z gate because applying the T gate four times is equivalent to applying the Pauli Z gate.

## Version History

Introduced in R2023a