Common Quantum Gates

In this notebook, we’ll introduce some of the most commonly used quantum gates, such as the Identity \(I\), Pauli (\(X\), \(Y\), \(Z\)), Hadamard \(H\), \(S\), and \(T\) gates. We also show how to use them in IBM Quantum Composer.

  1. Identity I Gate

  2. Pauli X Gate

  3. Pauli Y Gate

  4. Pauli Z Gate

  5. Hadamard H Gate

  6. S Gate

  7. T Gate

  8. Summary

  9. More Gates

IBM Quantum Composer: https://quantum.ibm.com/composer/

1. Identity I Gate

1.1 Definition and Matrix Representation

The Identity \(I\) gate, often referred to as a “do-nothing” gate, leaves the qubit unchanged. It turns \(\ket{0}\) into \(\ket{0}\) and \(\ket{1}\) into \(\ket{1}\):

\[I \ket{0} = \ket{0}\]
\[I \ket{1} = \ket{1}\]

The Identity gate is represented by the matrix:

\[\begin{split}I = \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}\end{split}\]

1.2 Bloch Sphere Effect

Since the Identity gate does not change the qubit state, it does not alter the position on the Bloch sphere.

aaa6ff8761944460a78e5eefdc1a82b2

1.3 IBM Quantum Composer

Using IBM Quantum Composer, we apply the Identity gate on:

\(\underline{\ket{0}}\)

64dbe1a652f34c278b1b8ad0e53108c0

\(\underline{\ket{1}}\)

7655102b87834867a7b4817352a3f468

2. Pauli X Gate

2.1 Definition and Matrix Representation

The \(X\) gate, also known as the \(NOT\) gate, flips the state of the qubit. It turns \(\ket{0}\) into \(\ket{1}\) and \(\ket{1}\) into \(\ket{0}\):

\[X \ket{0} = \ket{1}\]
\[X \ket{1} = \ket{0}\]

The Pauli \(X\) gate is represented by the matrix:

\[\begin{split}X = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}\end{split}\]

2.2 Bloch Sphere Effect

The \(X\) gate performs a rotation about the \(x\)-axis by 180\(^\circ\) or \(\pi\) radians on the Bloch sphere. Visually, this is represented by a flip along the \(x\)-axis.

71996592ae9a49d2afe3cb489216c1a7

2.3 IBM Quantum Composer

Using IBM Quantum Composer, we apply the \(X\) gate on:

\(\underline{\ket{0}}\)

b1407197733e4afda872ae780599d2b8

\(\underline{\ket{1}}\)

8dac01d335be41758b3c82ca51e650f7

3. Pauli Y Gate

3.1 Definition and Matrix Representation

The \(Y\) gate turns \(\ket{0}\) into \(i\ket{1}\) and \(\ket{1}\) into \(-i\ket{0}\):

\[Y \ket{0} = i\ket{i}\]
\[Y \ket{1} = -i\ket{0}\]

The Pauli \(Y\) gate is represented by the matrix:

\[\begin{split}Y = \begin{pmatrix} 0 & -i \\ i & 0 \end{pmatrix}\end{split}\]

3.2 Bloch Sphere Effect

The \(Y\) gate performs a rotation about the \(y\)-axis by 180\(^\circ\) or \(\pi\) radians on the Bloch sphere.

20fe3a593bf54f3f9129dd0b4df2be66

3.3 IBM Quantum Composer

Using IBM Quantum Composer, we apply the \(Y\) gate on:

\(\underline{\ket{0}}\)

5d4ae195795f44beb6c5e8fd5ce6bce4

\(\underline{\ket{1}}\)

85b44e7e356344b6ab72cde9f45c7b92

4. Pauli Z Gate

4.1 Definition and Matrix Representation

The \(Z\) gate, also known as the “phase-flip” gate, turns \(\ket{0}\) into \(\ket{0}\) and \(\ket{1}\) into \(-\ket{1}\):

\[Z \ket{0} = \ket{0}\]
\[Z \ket{1} = -\ket{1}\]

The Pauli \(Z\) gate is represented by the matrix:

\[\begin{split}Z = \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}\end{split}\]

4.2 Bloch Sphere Effect

The Z gate performs a rotation about the \(z\)-axis by 180\(^\circ\) or \(\pi\) radians on the Bloch sphere.

6c3621dc0e624a879d38283c89a32662

4.3 IBM Quantum Composer

Using IBM Quantum Composer, we apply the \(Z\) gate on:

\(\underline{\ket{0}}\)

2e9ca558dfeb4e2cb8e3f493ff7771a1

\(\underline{\ket{1}}\)

f6a0dd027e78489889cb8d501c0b0b98

5. Hadamard H Gate

5.1 Definition and Matrix Representation

The Hadamard \(H\) gate turns \(\ket{0}\) into \(\ket{+}\) and \(\ket{1}\) into \(\ket{-}\):

\[H\ket{0} = \frac{1}{\sqrt{2}} (\ket{0} + \ket{1}) = \ket{+}\]
\[H\ket{1} = \frac{1}{\sqrt{2}} (\ket{0} - \ket{1}) = \ket{-}\]

The Hadamard gate is represented by the matrix:

\[\begin{split}H = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}\end{split}\]

5.2 Bloch Sphere Effect

The H gate performs a rotation about the \(x+z\)-axis by 180\(^\circ\) or \(\pi\) radians on the Bloch sphere.

13b776cd148c41779bf5e920fb422b18

5.3 IBM Quantum Composer

Using IBM Quantum Composer, we apply the Hadamard gate on:

\(\underline{\ket{0}}\)

206f9952c83d45b7ae5bae167e066aa2

\(\underline{\ket{1}}\)

6b4e676d600d49cb8535b814cce533b1

6. S Gate

6.1 Definition and Matrix Representation

The \(S\) gate, also known as the Phase gate, is the square root of the \(Z\) gate (i.e. \(S^2 = Z\)):

\[S \ket{0} = \ket{0}\]
\[S \ket{1} = i\ket{1}\]

The S gate is represented by the matrix:

\[\begin{split}S = \begin{pmatrix} 1 & 0 \\ 0 & i \end{pmatrix}\end{split}\]

6.2 Bloch Sphere Effect

The S gate performs a rotation about the \(z\)-axis by 90\(^\circ\) or \(\frac{\pi}{2}\) on the Bloch sphere.

f5e4c63c97f74c3ea6c8000f9421fe32

6.3 IBM Quantum Composer

Using IBM Quantum Composer, we apply the \(S\) gate on:

\(\underline{\ket{0}}\)

e0557ee74f744b14ab4d94cfc24a3ca4

\(\underline{\ket{1}}\)

ed0e25f821d7494aaf7dec92fb4af09d

7. T Gate

7.1 Definition and Matrix Representation

The \(T\) gate, also called the \(\frac{\pi}{8}\) gate, is the square root of the \(S\) gate (i.e. \(T^2 = S\)) or fourth root of the \(Z\) gate. It turns \(\ket{0}\) into \(\ket{0}\) and \(\ket{1}\) into \(e^{\frac{i\pi}{4}}\ket{1}\):

\[T \ket{0} = \ket{0}\]
\[T \ket{1} = e^{\frac{i\pi}{4}}\ket{1}\]

The T gate is represented by the matrix:

\[\begin{split}T = \begin{pmatrix} 1 & 0 \\ 0 & e^{\frac{i\pi}{4}} \end{pmatrix} = \begin{pmatrix} 1 & 0 \\ 0 & \frac{i+1}{\sqrt{2}} \end{pmatrix}\end{split}\]

7.2 Bloch Sphere Effect

The T gate performs a rotation about the \(z\)-axis by 45\(^\circ\) or \(\frac{\pi}{4}\) on the Bloch sphere.

032bf516949d451188dc0e6c5316cdb0

7.3 IBM Quantum Composer

Using IBM Quantum Composer, we apply the \(T\) gate on:

\(\underline{\ket{0}}\)

d7a2ff3115224a14904f1e8e1396d34c

\(\underline{\ket{1}}\)

c90919d501164167aa0124f7b66ed953

8. Summary

29c7e972b1e54b41aac6e4200c55a8b5

9. More Quantum Computing Gate Notes

a36fbfe326e1418e867a668ec2c0ebde