Book Image

Learn Q# Programming

By : Bhagvan Kommadi, Aneesh K Johny
Book Image

Learn Q# Programming

By: Bhagvan Kommadi, Aneesh K Johny

Overview of this book

<p>This book covers the fundamentals of quantum computing and programming with Microsoft’s Q# language. The reader will learn how to design, test and debug algorithms for different quantum applications.</p> <p>The primary focus of this book will be to give the audience an idea about how to get started with the concepts, different aspects, and theories of quantum computing operations, algorithms etc. Through this book, the developer will get a basic idea about the Microsoft Quantum Tool Kit and how to use the embedded Q# language. This will enable the reader to formalize and convert different real world problems to quantum algorithms and optimize them to use with a future quantum computer.</p> <p>By the end of the book, you would have successfully learned to create quantum programs of your own.</p>
Table of Contents (11 chapters)

Quantum Mechanics of Qubit


Quantum mechanics deals with the smallest elementary particles and their interactions. Quantum computing is utilizes two special quantum mechanical phenomena called superposition and entanglement.

Superposition

The quantum mechanical super position is much like the classical wave superposition. Any two or more quantum sates can be added or superposed together to form a valid quantum states. In other words, a quantum state can be represented by the sum of another two or more different states. This is a property of the solutions of Schrödinger equation (Equation 1). Schrödinger equation is linear in nature and any combination of the solutions of a linear equation is also a solution.

We can observe superposition phenomena in nature, the interference pattern observed from electron double-slit experiment is similar to that of observed by diffraction of classical waves. This pattern is the result of superposition.

Entanglement

This is an exciting phenomenon for physicists. This is attributed to the dependencies of a particle and it's properties on another particle or a set of particle in its spacial proximity.  In an elaborated way we can define that, quantum entanglement is a phenomenon for which the quantum states of two or more particles or quantum objects have to be described with reference to each other. This leads to correlations between observation between physical properties of the system. The physical properties can be position, momentum, spin and polarization.

These aforementioned two phenomenons are the basis for quantum computing.

Quantum Mechanical Representation of Qubit

A quantum mechanical state is generally represented by Dirac notations also known as "bra-ket" notations.  There are infinitely many states are possible for a qubit, but we represent these states by two basis vectors or states. The vectors are

and

, pronounced as "ket-1" and "ket-0". These vectors are called orthonormal basis states,

, together they called computational basis. These vectors are span the two-dimensional linear vector or Hilbert space of qubit.

A pure qubit can be represented by the linear combination of basis states

as

Where 

and 

are the probability amplitude in complex numbers. The probability of outcome "0" is 

and probability of outcome "1" is

and will be constrained by

. We use Bloch sphere to represent a qubit graphically, Fig. 2.

Figure 2: Bloch Sphere representation of qubit

A qubit have four degrees of freedom due to the involvement of complex numbers in probability  amplitudes. This will be reduced to three due to constraint

. Further we reduce the degrees of freedom by using changing the coordinates. Probability amplitudes are rewritten into the following form using coordinate change,

For a single qubit,  due to the  insignificance of

, and we can choose

to be real, the general state is further reduced to,

Where the term

is the physically significant relative phase. On the Bloch sphere, the north and south poles represents the classical bits and any point on the sphere will represent the concurrent state of a qubit. This polar axis is arbitrarily chosen.

Quantum Mechanics to Quantum Logic

We have discussed all the basics related to quantum computing and qubits. For making use of this qubit, we need to form quantum logic circuits. We utilize the basic principles of qubits and its operation to create quantum computing circuits. The circuits are very similar to that of classical computing circuits, called logic gates. These quantum circuits are called quantum logic gates or simply quantum gates. This quantum circuits are built using few qubits, using a single qubit to many numbers of qubits depending upon the complexity and requirements of algorithms. Quantum gates are reversible in nature and using quantum logic gates we can perform classical computing operations.  A typical example can be a CCNOT gate or reversible Toffoli gate. Using this gate we can implement all the Boolean functions.

A detailed representation and mathematical formulation of qubit and its operation is given in chapter 4 :The Fundamentals of Qubit Representation and Computation.