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.

a68d72e9e5ab474c805694893f6e5e05

1.3 IBM Quantum Composer

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

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

91114aacb8984afc8b6c0d361b869d7b

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

c9f441c2955649bd94619b4cc1692cfb

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.

07307200421c4b4983850668fab3cba5

2.3 IBM Quantum Composer

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

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

2a9ca0469dfd42ea8b51ef4d6be4ca09

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

ff14290355374ee49ae0c0b285e23335

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.

1c1022478fd44ea6b8dddbb54acdbb11

3.3 IBM Quantum Composer

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

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

b0b18b087a184f2eb38dc5f7711a5257

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

4e2314eb785e47b58ffe9d83cbe19b70

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.

b719fa302f3349a3b31f5c637e381187

4.3 IBM Quantum Composer

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

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

401aad00abd44e76b62db593b53e770e

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

0c7dcd9c09a045268c174e429a767b27

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.

ef593c6743bb42fcbf554a719e2e60ce

5.3 IBM Quantum Composer

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

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

0811bdf843fb425d9e8b746e9d3d2a0a

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

804f9d1ed6c2467293482fd3d790e318

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.

b6d452121467450f9398a473f7f39ddc

6.3 IBM Quantum Composer

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

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

5d00989261d745ab92600549b907576c

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

92d5005833f04013a52550519cd84bb2

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.

b3ed0c13ccf34e189adc48db017b1ab7

7.3 IBM Quantum Composer

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

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

3a3e46e421fa43cabf4f659fd6b2a1ce

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

52516a7b9c224423adb29a14208cdc50

8. Summary

02f0eacd2046475eb6b19f501be0dacf

9. More Quantum Computing Gate Notes

f9ba603ad3d042b6bae48df4b0216f2b