Qubit, An Intuition #4 — Unitary Matrices for Quantum Computation

Andi Sama
5 min readOct 1, 2021

--

The beauty of Quantum Mechanics for Quantum Computation, featuring IBM Quantum

Andi Sama CIO, Sinergi Wahana Gemilang with Cahyati S. Sangaji

TL;DR; 
Unitary matrices, with examples and their implementation in IBM quantum.
Please refer to the previous articles:
Qubit, An Intuition #1 — First Baby Steps in Exploring the Quantum World” for a discussion on a single qubit as a computing unit for quantum computation.
- "Qubit, An Intuition #2 - Inner Product, Outer Product, and Tensor Product" for a discussion on two-qubits operations.
- "Qubit, An Intuition #3 - Quantum Measurement, Full and Partial Qubits" for examples on full and partial quantum measurements.

For an introductory helicopter view of the overall six articles in the series, please visit this link “Embarking on a Journey to Quantum Computing — Without Physics Degree.”

To do the quantum computation, we need to have reversible transformations, meaning that input can be reconstructed from the output after a series of transformations to transform a quantum state.

Mathematically, reversible transformations are performed by unitary matrices.

Unitary Matrices for Quantum Computation

Matrices for X (NOT, to do bit-flip), H (Hadamard, to bring the qubit to superposition state), and Z gates (to do phase-flip), and CNOT (if the first qubit is 1, then flip the second qubit) for example, are unitary.

Unitary matrices for X (NOT), H (Hadamard), Z, and CNOT gates.

We can define X (NOT), H (Hadamard), Z, and CNOT gates in IBM Quantum on IBM Cloud easily by just doing drag-and-drop from available gates. In this example, all initial states for each qubit are set to |0>.

A unitary matrix U is a n x n matrix that has complex numbers as its elements.

A matrix U is unitary if U times U conjugate transpose is equal to identity (matrix I).

U conjugate transpose is acting like inverse matrix.

Example 1 — Verify that H is a unitary matrix

Let’s take a few examples, starting to verify that a Hadamard matrix is unitary. Given matrix for H as follows:

Let’s verify whether:

Conclusion: H is a unitary matrix.

Example 2 — Verify that U is a unitary matrix

Given matrix for U as follows:

Let’s verify whether:

Conclusion: U is a unitary matrix.

X, H, Z, and CNOT Gates in IBM Quantum

The X (NOT), H (Hadamard), Z, and CNOT gates in IBM Quantum on IBM Cloud.

X-gate

The X-gate brings the quantum state |0> to |1> and |1> to |0>.

H-gate

The H-gate brings the quantum state to superposition. The qubit has a 50%:50% chance to be measured as |0> and |1>.

An H gate brings the quantum state to be in superposition.

Z-gate

The Z-gate brings the quantum state |0> to |0> and |1> to |-1>.

CNOT-gate

The CNOT-gate flips the second qubit (target qubit) state (from |0> to |1> or |1> to |0>) if the first qubit (control qubit) is |1>.

The illustration shows by having the control qubit (q₀) set to |1> (by doing X-gate to the initial state |0>), the CNOT-gate flips the target qubit (q₁) with the initial state |0> to |1>.

Moving Forward

Next in the “Qubit, An Intuition #5” article, we will discuss reversible operations in quantum circuits with examples and their implementation in IBM quantum. The discussion will include Reversible Transformations in Quantum Circuit, Quantum Circuit written as Unitary Matrix, and The Execution of the Quantum Circuit on IBM Quantum.

References

--

--