# Quantum Computing – Playing with Gates

In the previous Quantum Computing Tutorial, we learned how to get started with the IBM Cloud and get started with some basic concepts. Today, we are going to play with more gates. Please study the previous tutorial in order to understand the current tutorial.

## Controlled NOT Gate – CNOT

The CNOT Gate operates on Quantum Register consisting of 2 Qubits. The CNOT gate flips the second Qubit iff the first Qubit is | 1 >

The ‘+’ is the Target and ‘.’ is the Control. Now, to understand it better let us start composing.

### Case 1 : Control – | 0 > and Target – | 0 >

If both the Control and Target are | 0 > , they will remain | 0 > after the CNOT Gate is applied.

Now , we stimulate it.

Thus, we see that the final values of the two Qubits remains | 0 > .

### Case 2 : Control – | 0 > and Target – | 1 >

In this case, we will again see that the Control remains | 0 > and Target remains | 1 > .

Now , we stimulate it.

### Case 3 : Control – | 1 > and Target – | 0 >

Since the Control is | 1 > in this case so the target will be flipped to | 1 > .

After stimulating it,

Thus, we see that the Control remains the same and the Target is flipped.

### Case 4 : Control – | 1 > and Target – | 1 >

Now, when the Control is | 1 > , the target will be  again flipped but this time to | 0 > .

Again stimulating it,

Thus, the target is flipped again.

## A Random Experiment

I want you to look at the following circuit and analyze the output.

The final output is 10 at Q1Q2. This is because when Control Q2 was initially | 1 > , the Target Q1 flipped to | 0 > with Q2 retaining | 1 > . Then, Pauli Gate was applied which again changed the value of Q1 to | 1 > . Now when CNOT gate was applied when both Control and Target were | 1 > , it resulted in 10 at Q1Q2.

To get good hands on the gates try playing around with it and see how the output are related.

## Bloch Sphere

This is a short description of the Bloch Sphere. It is a geometrical representation of the pure state of the Qubit. What is a pure state ?

A Pure Sate is the quantum state of an isolated quantum system.

Pure State = Superposition of | 0 > and |1 > .  Not touching the Mathematics part of it because I face a lot of difficulty in the same.

Here comes the interesting part, before the measurement forced it to choose, the Qubit was in both states at once.

H was applied on state | 0 > which was (1 ; 0)  and | 1 > which was (0 ; 1). It entangles 0 and 1 bit.

Now, we stimulate it.

There you see that the Qubit Q2 spends 50% time in | 0 > and 50% time in | 1 >.