Can someone explain to me what is T gate and tdg like im five?

I'm newbie to quantum computing, i read about these two gates on IBM quantum computing docs, but I can't seem to understand what is t-gate and tdg or t-dagger, can someone give me a simple explanation about these two gates? Also S-gate if that is possible!

Thank you so much.

• That's something you will understand when you'll get older. Now finish your plate Jun 1 at 7:26

tdg is the method used to apply $$T^\dagger$$ (read T dagger). Thus, there are no differences between these two.

For a quantum gate $$U$$, $$U^\dagger$$ is the inverse of $$U$$. That is, if you apply $$U$$ on a given state $$|\psi\rangle$$ and then $$U^\dagger$$, you will be back in the state $$|\psi\rangle$$ again.

So now, what is $$T$$? Or rather, why do we care about $$T$$? You see, there are these gates, $$H$$, $$S$$ and the $$CNOT$$ using which we can do some things. However, we are quite limited with them, there is no way to construct a Toffoli gate (that is, an $$X$$ gate controlled on two qubits) using them for instance. However, if we do allow ourselves to use these gates and the $$T$$ gate, then we can construct any quantum gate we'd like.

The $$S$$ gate is simply the $$T$$ gate applied twice: $$T^2=S$$.

On a more "math" level, the $$T$$ gate is the following matrix: $$\begin{pmatrix}1&0\\0&\mathrm{e}^{\mathrm{i}\frac\pi4}\end{pmatrix}$$ That is, it applies a phase of $$\frac\pi4$$ to the $$|1\rangle$$ state and leaves $$|0\rangle$$ untouched.

I'm not sure that this is a gate you'll have to deal with often. It does appear a lot in the Quantum Circuits you'll build, but I'm not sure that you'll use it directly when defining your own Quantum Gates. For instance, if you use a Toffoli gate in your circuit, under the hood the gates that will be applied to your three qubits are those:

Thus, while you will reason without this $$T$$ gate in most cases, it will be here when decomposing the circuit into the basic gates using which you'll build it.