Q-Computing II

Parth Deshpande
4 min readApr 17, 2020

--

Hi everyone

In this blog, I will cover the theoretical basics of building quantum circuits.

Representative image from Analytics Insight

Matrix Representation

As I have stated in the previous blog, the state of a qubit depends on the choice of basis. Thus here dealing with matrices can be useful. Without loss of generality, we will consider the basis to be Z basis unless otherwise stated. This means, with the analogy of the SG experiment, the magnetic field is in the Z direction. Now the quantum states can be represented in matrix form as follows.

Probability Amplitudes

Probability Amplitude is a very important concept in quantum mechanics. With respect to quantum computing, as stated earlier, a qubit can be expressed as a superposition of its basis states. The probability amplitudes of a qubit are defined as follows.

Measurement of a Qubit

In classical circuits, when a “bit” or a voltage signal is passed through a circuit, at the end, it is measured, say in terms of whether the LED is glowing or not. LED ON →Bit = 1 LED OFF →Bit = 0

Similarly, after a qubit is passed through a quantum circuit, it is important to measure the qubit, to see whether the circuit worked and is doing what it is expected to do. This is the tricky part (or the reason why quantum circuits are interesting). Once a qubit in any superposed state is measured, it falls to either 0 or 1 state with a probability. This means that once a qubit is measured, it loses its superposition characteristic. After the measurement, the qubit is essentially a classical bit with value either 0 or 1.

The qubit takes value 0 or 1 with the probability corresponding to its probability amplitude.

Thus, it is important in any quantum circuit to measure a qubit at an appropriate location. Once it is measured, it can no longer be passed through a quantum circuit (but classical post-processing can be done). I will elaborate on this concept later on with the examples of various circuits, but it is crucial to understand that measurement of a qubit destroys its state and the measured value is either 0 or 1.

Quantum Gates

Gates, in classical computing, are defined as “functions” having at least one input bit and only one output. Similarly, quantum gates have qubits as inputs.

The simplest example of a quantum gate is the NOT gate. It flips the state of a qubit. It is represented by the X symbol.

Representation of NOT gate in Qiskit using Matplotlib

This kind of representation for the action of gates on a qubit in an equation form will be useful for solving and understanding circuits in the future. This is like a classical NOT gate which changes the input bit.

Now the question arises, what if the input qubit is in a superposed state, not just simply 0 or 1 (this is the characteristic of qubits). Here, just apply linearity.

NOT gate on a general qubit

As I have mentioned earlier, matrix representation can be useful in understanding several concepts. Here X-gate can be considered as a 2*2 matrix.

Thus, matrix representation can be helpful in working out the final output of a series of gates. Note how qubit 0 is represented here, in its transposed form. As an exercise, work out the equation X(1) = 0 in matrix form.

There are several other gates in quantum circuits. I will give two more examples and their matrix representations.

Z-gate
Hadamard Gate

Overview

Till now, I have covered the basics of what a qubit is, how it is represented and how gates act on qubits. I essentially built a small quantum circuit using the X-gate. Now it is time to start building circuits using Qiskit. In the next blog, I will go through the installation of Qiskit and we will build our first quantum circuit!

--

--