# What is the purpose of the TDG gate in QISKit?

The QISKIT documentation doesn't explain what a TDG gate does and I can't find it anywhere else online.

According to the QISKit documentation, tdg(q) applies the Tdg gate to a qubit.

$T$ is the basically the $\pi/8$ phase shift gate whose matrix representation considering standard (computational) basis is:

$$\left(\begin{matrix}1 & 0 \\ 0 & e^{i\pi/4}\end{matrix}\right)$$

Tdg is simply the conjugate transpose of the matrix $T$ i.e. $T^{\dagger}$, which is:

$$\left(\begin{matrix}1 & 0 \\ 0 & e^{-i\pi/4}\end{matrix}\right)$$

Thus, the $T$ gate would map the basis vectors (of a qubit) $|0\rangle$ to $|0\rangle$ itself and $|1\rangle$ to $e^{i\pi/4}|1\rangle$, whereas $T^{\dagger}$ would map $|0\rangle$ to $|0\rangle$ itself and $|1\rangle$ to $e^{-i\pi/4}|1\rangle$.

P.S: In case you're wondering what dg means in tdg, it is simply an abbreviation for "dagger" i.e. in the sense of $T^{\dagger}$ (pronounced as $T$ - dagger).