SlideShare a Scribd company logo
Quantum Computing – Notes Ver 1.2
Prepared By: Vijayananda Mohire
Sources: Various open courses, MOOC trainings and self study; no intention for any copyright infringements
Question 1
Design a reversible circuit, using NOT, CNOT, Toffoli, and Fredkin gates,which acts on the four inputs a,b,c,d, to
perform the operation swap243(a,b,c,d) which swaps b and d if a=0, and swaps c and d if a=1. Bit a should be
left unchanged
Answer 1
High level functionwith the circuit
fredkin(a,c,d)
not(a)
fredkin(a,b,d)
not(a)
Question 2
Design a reversible circuit, using NOT, CNOT, Toffoli, and Fredkin gates, which acts on the four inputs
a,b,c,d, to swap c and d only when both a=1 and b=1. You may use a fifth bit e, given as initialized to
e=0, in your circuit; this bit must also end as e=0. C
Answer 2
High level functionwith the circuit
toffoli(a,b,e)
fredkin(e,c,d)
toffoli(a,b,e)
Question 3
Sample RandomNumber using Q#
Answer 3
open Microsoft.Quantum.Arrays;
open Microsoft.Quantum.Measurement;
operation SampleRandomNumber(nQubits : Int) : Result[] {
// We prepare a register of qubits in a uniform
// superposition state, such that when we measure,
// all bitstrings occur with equal probability.
use register = Qubit[nQubits] {
// Set qubits in superposition.
ApplyToEachA(H, register);
// Measure all qubits and return.
return ForEach(MResetZ, register);
}
}
Question 4
Run a basic quantum circuit expressed using the Qiskit library to an IonQ target via the Azure Quantum
service.
Answer 4
First, import the required packages for this sample:
from qiskit import QuantumCircuit
from qiskit.visualization import plot_histogram
from qiskit.tools.monitor import job_monitor
from azure.quantum.qiskit import AzureQuantumProvider
#Connect to backend Azure quantum service, using below function
from azure.quantum.qiskit import AzureQuantumProvider
provider = AzureQuantumProvider ( resource_id = " ", location = " " )
# Create a Quantum Circuit acting on the q register
circuit = QuantumCircuit(3, 3)
circuit.name = "Qiskit Sample - 3-qubit GHZ circuit"
circuit.h(0)
circuit.cx(0, 1)
circuit.cx(1, 2)
circuit.measure([0,1,2], [0, 1, 2])
# Print out the circuit
circuit.draw()
┌───┐ ┌─┐
q_0: ┤ H ├──■───────┤M├──────
└───┘┌─┴─┐ └╥┘┌─┐
q_1: ─────┤ X ├──■───╫─┤M├───
└───┘┌─┴─┐ ║ └╥┘┌─┐
q_2: ──────────┤ X ├─╫──╫─┤M├
└───┘ ║ ║ └╥┘
c: 3/════════════════╩══╩══╩═
0 1 2
#Create a Backend object to connect to the IonQ Simulator back-end:
simulator_backend = provider.get_backend("ionq.simulator")
job = simulator_backend.run(circuit, shots=100)
job_id = job.id()
print("Job id", job_id)
#Create a job monitor object
job_monitor(job)
#To wait until the job is completed and return the results, run:
result = job.result()
qiskit.result.result.Result
print(result)
connect to real hardware (Quantum Processing Unit or QPU)
qpu_backend = provider.get_backend("ionq.qpu")
# Submit the circuit to run on Azure Quantum
qpu_job = qpu_backend.run(circuit, shots=1024)
job_id = qpu_job.id()
print("Job id", job_id)
# Monitor job progress and wait until complete:
job_monitor(qpu_job)
# Get the job results (this method also waits for the Job to complete):
result = qpu_job.result()
print(result)
counts = {format(n, "03b"): 0 for n in range(8)}
counts.update(result.get_counts(circuit))
print(counts)
plot_histogram(counts)
Question 5
Develop Google AI sample Cirq circuit
Answer 5
import cirq
qubits = [cirq.GridQubit(x, y) for x in range(3) for y in range(3)]
print(qubits[0])
# This is an Pauli X gate. It is an object instance.
x_gate = cirq.X
# Applying it to the qubit at location (0, 0) (defined above)
# turns it into an operation.
x_op = x_gate(qubits[0])
print(x_op)
cz = cirq.CZ(qubits[0], qubits[1])
x = cirq.X(qubits[2])
moment = cirq.Moment([x, cz])
x2 = cirq.X(qubits[2])
cz12 = cirq.CZ(qubits[1], qubits[2])
moment0 = cirq.Moment([cz01, x2])
moment1 = cirq.Moment([cz12])
circuit = cirq.Circuit((moment0, moment1))
print(circuit)
Question 6
Design a simple Tensorflow based quantum Colab sample
Answer 6
!pip install tensorflow==2.4.1
!pip install tensorflow-quantum
import tensorflow as tf
import tensorflow_quantum as tfq
import cirq
import sympy
import numpy as np
# visualization tools
%matplotlib inline
import matplotlib.pyplot as plt
from cirq.contrib.svg import SVGCircuit
a, b = sympy.symbols('a b')
# Create two qubits
q0, q1 = cirq.GridQubit.rect(1, 2)
# Create a circuit on these qubits using the parameters you created above.
circuit = cirq.Circuit(
cirq.rx(a).on(q0),
cirq.ry(b).on(q1), cirq.CNOT(control=q0, target=q1))
SVGCircuit(circuit)
# Calculate a state vector with a=0.5 and b=-0.5.
resolver = cirq.ParamResolver({a: 0.5, b: -0.5})
output_state_vector = cirq.Simulator().simulate(circuit, resolver).final_state_vector
output_state_vector
Question 7
Design a simple qubit based quantum circuit using IBMQiskit
Answer 7
import numpy as np
# Importing standard Qiskit libraries
from qiskit import QuantumCircuit, transpile, Aer, IBMQ, assemble
from qiskit.tools.jupyter import *
from qiskit.visualization import *
from ibm_quantum_widgets import *
from math import pi, sqrt
# Loading your IBM Quantum account(s)
provider = IBMQ.load_account()
sim = Aer.get_backend('aer_simulator')
# Let's do an X-gate on a |0> qubit
qc = QuantumCircuit(1)
qc.x(0)
qc.draw()
qc.y(0) # Do Y-gate on qubit 0
qc.z(0) # Do Z-gate on qubit 0
qc.draw()
# Create the X-measurement function:
def x_measurement(qc, qubit, cbit):
"""Measure 'qubit' in the X-basis, and store the result in 'cbit'"""
qc.h(qubit)
qc.measure(qubit, cbit)
return qc
initial_state = [1/sqrt(2), -1/sqrt(2)]
# Initialize our qubit and measure it
qc = QuantumCircuit(1,1)
qc.initialize(initial_state, 0)
x_measurement(qc, 0, 0) # measure qubit 0 to classical bit 0
qc.draw()
Question 8
How to find if matrix is Unitary
Answer 8
Consider a 2*2 Matrix A with different values. We take 2 examples as shown below to prove how these are valid or
not for quantum representation
A =
0 1
𝑖 0
and AT
=
0 𝑖
1 0
Next, A*AT
=
𝑖 0
0 𝑖
= i *
1 0
0 1
which is an Identity matrix I
So this matrix is Unitary and valid for quantum representations
Next example,
A =
1 −1
0 1
and AT
=
1 0
−1 1
Next, A*AT
=
2 0
−1 0
= which isNOT an Identity matrix, as 2 is not correct
So this matrix is NOT unitary and NOT valid for quantum representations
Question 9
Generate the Unitary matrix for the given quantum circuit
Answer 9
First let me get the matricesfor NOT and CNOT gates
NOT =
0 1
1 0
and for CNOT
1 0 0 0
0 1 0 0
0 0 0 1
0 0 1 0
Gate Matrices have to be multiplied. However, when matrix is generated for single qubit ,tensor product with
identity is required.
So getting the I for the NOT gates
0 1
1 0
tensor product
0 1
1 0
=
0 0 1 0
0 0 0 1
1 0 0 0
0 1 0 0
this is the Identity I
Now multiply these as per circuit order
I * CNOT Matrix *I
0 0 1 0
0 0 0 1
1 0 0 0
0 1 0 0
*
0 0 1 0
0 0 0 1
1 0 0 0
0 1 0 0
*
0 0 1 0
0 0 0 1
1 0 0 0
0 1 0 0
=
𝟎 𝟏 𝟎 𝟎
𝟏 𝟎 𝟎 𝟎
𝟎 𝟎 𝟏 𝟎
𝟎 𝟎 𝟎 𝟏
The multiplication can be made easier using online tool like
https://www.dcode.fr/matrix-multiplication
This is based on theory, however this needs to be done using simulator like Qiskit based Composer and get the
Unitary matrix
Question 10: Derive Pauli’s X gate
Answer 10: There are 3 Pauli’s gates namely X, Y and Z that represent the various gate operations on the Bloch
sphere.
Pauli’s X gate offer a NOT type of operation and is represented by bra-ket and matrix notations. Below is anexample
of deriving the X gate
Please note bra is represented by < 0 | and ket by |0 >. Arranging the matricesin proper shape is the key in getting
the proper results. There is also a conjugate transpose required, meaning the cols matrix is transformed to row
matrix and these are then multiplied
I have used a different method to represent the state vector rows and columns; however this is not the best one.
You can use KET based COLS first and BRA based ROWS, and then do the operation. Pauli X is a NOT gate, so the 0->1
and 1>0 are reflectedin the matrices. Please get these things clear first
Question 11: Derive Pauli’s Y gate
Answer 11: In a similar way the Pauli’s X is derived, Pauli’s Y is derived
Question 12: Derive Pauli’s Z gate, Answer 12
Question 13: Show an example of inner product
Answer 13: Inner product of 2 matricesis the dot product and results in a scalar.
Question 14: Show an example of outer product
Answer 14: Outer product of 2 matrices is the tensor product and resultsin a vector matrix.
Question 15: Show an example of outer product using Pauli X & Y with anexample of Trace
Answer 15: Using Pauli’s X & Y matrices
Question 16: Show how Bell State is derived
Answer 16: Bell state preparation uses 3 steps:
1. State initialization
2. Use Hadamard and Identity gate for superposition and getting the Kronecker matrix
3. Use a CNOT to multiply with the Kronecker matrix
Detailsin the following notes below
Quantum Computing Notes Ver 1.2
Question 17: State the types of quantum states
Answer 17: Quantum qubit can have 6 possible states, 2 each for the X, Y and Z directions of the Bloch sphere
Another way to represent these are shown below, |0>, |1>,| +>, |->,| I > and | –I >
Image source: https://andisama.medium.com/qubit-an-intuition-1-first-baby-steps-in-exploring-the-quantum-world-
16f693e456d8
Question 18: Define the notations for the different types of quantum states like plus, minus etc
Answer 18: Quantum qubit state notations are mainly represented in matrix and bra-ket forms with transformation
from one notation to another as required to solve a problem .Below are matrix notations for 0,1, + and – states.
These can be re-written from matrix to state, like col matrix [1 0] can be written as ket notation | 0> as per the need
of the problem to be solved
Question 19: Apply an H gate on the |+> and show the results
Answer 19: First we get the matrix notation for H and |+> states, then we multiply them, details shown below
Question 20: Apply an X gate on the |0> and show the results
Answer 20: First we get the matrix notation for X and |0> states, then we multiply them, as shown below
Question 21: Apply an X gate on the |-> and show the results
Answer 21: First we get the matrix notation for X and |-> states, then we multiply them, details shown below
,results show on Bloch sphere for Question 19 and 20
Question 22: Test the below matrices for the validity of being the bitflip X gate
Answer 22: First we get the matrix notation of the X gate and test it againsteach given matrix that should result in
the NOT operation
Question 23: Given H acting on |0> produces |+> & H|1> = |->, which is the correct H operator
Answer 23: First we get the matrix for H and testeach given matrix that produces the required results
Question 24: Express |+> state in the Z – basis(Hadamard)
Answer 24:
Question 25: Using Matrix and related gates derive Bell states
Answer 25: Please refer images below
Quantum Computing Notes Ver 1.2
Question 26: Show the Eigen vectors and Eigen values for PaulisXYZ
Answer 26: Eigen values in each case are + and –. Eigen vectors are shown below
Question 27: Please test if these states are separable?
Answer 27: Please refer image below
Question 28: Show the probability of finding a qubitin a given state
Answer 28: Please refer image below
Question 29: Show unitary rotation matrices around Pauli XYZ
Answer 29: Please refer image
c
Question 30
Describe how you would represent a large set of particlesin a Fock space rather than the Hilbert space
Answer 30
Fock space is a newerway (Second Quantization) to represent multi-particles in aneasier way unlike in the Hilbert
space. Below is the broad wayin simple terms
ERRATA: Please note that instead of 6 basis states as mentioned, ONLY 5 have been represented in the KET form,
you can add another term here, say a ‘zero to make the complete set of 6 base states
Question 31
Describe in simple words how Fock space uses Hilbert space
Answer 31
Fock space offers newer way of abstracting the state-space representations as previously done in the First
Quantization. This helps iseasier and shorter way in showing the quantum states.
References:
1. MIT OpenCourseWare , https://ocw.mit.edu/
2. IBMQuantum Lab, https://quantum-computing.ibm.com/lab
3. Azure Quantum, https://azure.microsoft.com/en-in/services/quantum/
4. QuTech Academy, https://www.qutube.nl/
5. Andi Sama Blog, https://andisama.medium.com/qubit-an-intuition-1-first-baby-steps-in-exploring-the-
quantum-world-16f693e456d8
6. Einstein Relatively Easy, https://einsteinrelativelyeasy.com/
7. The Web and Google Search
Disclaimer: I have no intention for any copyright infringement, nor I promise that the results are true and right.
Please use your caution to self-check the results against the quantum postulates. I am reachable at
vijaymohire@gmail.com for any clarifications
Ad

More Related Content

What's hot (20)

Graph coloring using backtracking
Graph coloring using backtrackingGraph coloring using backtracking
Graph coloring using backtracking
shashidharPapishetty
 
Constructors in C++.pptx
Constructors in C++.pptxConstructors in C++.pptx
Constructors in C++.pptx
Rassjb
 
object oriented programming(oops)
object oriented programming(oops)object oriented programming(oops)
object oriented programming(oops)
HANISHTHARWANI21BCE1
 
Static Routing
Static RoutingStatic Routing
Static Routing
Kishore Kumar
 
Formal Methods lecture 01
Formal Methods lecture 01Formal Methods lecture 01
Formal Methods lecture 01
Sidra Ashraf
 
Cocomo model
Cocomo modelCocomo model
Cocomo model
Devan Thakur
 
ER model to Relational model mapping
ER model to Relational model mappingER model to Relational model mapping
ER model to Relational model mapping
Shubham Saini
 
CS3251-_PIC
CS3251-_PICCS3251-_PIC
CS3251-_PIC
AALIM MUHAMMED SALEGH COLLEGE OF ENGINEERING
 
Back tracking and branch and bound class 20
Back tracking and branch and bound class 20Back tracking and branch and bound class 20
Back tracking and branch and bound class 20
Kumar
 
N queen problem
N queen problemN queen problem
N queen problem
Ridhima Chowdhury
 
Databases: Normalisation
Databases: NormalisationDatabases: Normalisation
Databases: Normalisation
Damian T. Gordon
 
Functions in c++
Functions in c++Functions in c++
Functions in c++
Rokonuzzaman Rony
 
Pointer in C++
Pointer in C++Pointer in C++
Pointer in C++
Mauryasuraj98
 
Seii unit6 software-testing-techniques
Seii unit6 software-testing-techniquesSeii unit6 software-testing-techniques
Seii unit6 software-testing-techniques
Ahmad sohail Kakar
 
Top down parsing
Top down parsingTop down parsing
Top down parsing
LakshmiSamivel
 
Design and analysis of computer algorithms
Design and analysis of computer algorithmsDesign and analysis of computer algorithms
Design and analysis of computer algorithms
Krishna Chaytaniah
 
FP304 DATABASE SYSTEM PAPER FINAL EXAM AGAIN
FP304 DATABASE SYSTEM  PAPER FINAL EXAM AGAINFP304 DATABASE SYSTEM  PAPER FINAL EXAM AGAIN
FP304 DATABASE SYSTEM PAPER FINAL EXAM AGAIN
Syahriha Ruslan
 
Constructor and desturctor
Constructor and desturctorConstructor and desturctor
Constructor and desturctor
Somnath Kulkarni
 
Cocomo model
Cocomo modelCocomo model
Cocomo model
Sony Elizabeth
 
Decision making and branching in c programming
Decision making and branching in c programmingDecision making and branching in c programming
Decision making and branching in c programming
Priyansh Thakar
 
Constructors in C++.pptx
Constructors in C++.pptxConstructors in C++.pptx
Constructors in C++.pptx
Rassjb
 
Formal Methods lecture 01
Formal Methods lecture 01Formal Methods lecture 01
Formal Methods lecture 01
Sidra Ashraf
 
ER model to Relational model mapping
ER model to Relational model mappingER model to Relational model mapping
ER model to Relational model mapping
Shubham Saini
 
Back tracking and branch and bound class 20
Back tracking and branch and bound class 20Back tracking and branch and bound class 20
Back tracking and branch and bound class 20
Kumar
 
Seii unit6 software-testing-techniques
Seii unit6 software-testing-techniquesSeii unit6 software-testing-techniques
Seii unit6 software-testing-techniques
Ahmad sohail Kakar
 
Design and analysis of computer algorithms
Design and analysis of computer algorithmsDesign and analysis of computer algorithms
Design and analysis of computer algorithms
Krishna Chaytaniah
 
FP304 DATABASE SYSTEM PAPER FINAL EXAM AGAIN
FP304 DATABASE SYSTEM  PAPER FINAL EXAM AGAINFP304 DATABASE SYSTEM  PAPER FINAL EXAM AGAIN
FP304 DATABASE SYSTEM PAPER FINAL EXAM AGAIN
Syahriha Ruslan
 
Constructor and desturctor
Constructor and desturctorConstructor and desturctor
Constructor and desturctor
Somnath Kulkarni
 
Decision making and branching in c programming
Decision making and branching in c programmingDecision making and branching in c programming
Decision making and branching in c programming
Priyansh Thakar
 

Similar to Quantum Computing Notes Ver 1.2 (20)

Quantum Computing Notes Ver1.0
Quantum Computing Notes Ver1.0Quantum Computing Notes Ver1.0
Quantum Computing Notes Ver1.0
Vijayananda Mohire
 
quantumComputers.ppt
quantumComputers.pptquantumComputers.ppt
quantumComputers.ppt
AbhayGill3
 
quantumComputers.ppt
quantumComputers.pptquantumComputers.ppt
quantumComputers.ppt
TassianeNatany
 
quantumComputers.ppt
quantumComputers.pptquantumComputers.ppt
quantumComputers.ppt
ApdirahmanHassan
 
quantumComputers.ppt
quantumComputers.pptquantumComputers.ppt
quantumComputers.ppt
Raja Shekar
 
quantumComputers.ppt
quantumComputers.pptquantumComputers.ppt
quantumComputers.ppt
AjayRaj912848
 
quantumComputers (1).ppt
quantumComputers (1).pptquantumComputers (1).ppt
quantumComputers (1).ppt
harithasahasra
 
quantumComputers.ppt
quantumComputers.pptquantumComputers.ppt
quantumComputers.ppt
Adnan kHAN
 
quantumComputers.pptjhijjkbtyfvhjbvvjvkjlh
quantumComputers.pptjhijjkbtyfvhjbvvjvkjlhquantumComputers.pptjhijjkbtyfvhjbvvjvkjlh
quantumComputers.pptjhijjkbtyfvhjbvvjvkjlh
218r1a05m0
 
quantumComputers in Application of Qunatum Physics.ppt
quantumComputers in Application of Qunatum Physics.pptquantumComputers in Application of Qunatum Physics.ppt
quantumComputers in Application of Qunatum Physics.ppt
RAJASEKARAN G
 
quantumComputers.pptICICI-An HR perspective
quantumComputers.pptICICI-An HR perspectivequantumComputers.pptICICI-An HR perspective
quantumComputers.pptICICI-An HR perspective
BenjinkumarNimmala
 
quantumComputers.ppt
quantumComputers.pptquantumComputers.ppt
quantumComputers.ppt
TrushaKyada
 
quantumComputers.ppt
quantumComputers.pptquantumComputers.ppt
quantumComputers.ppt
raju980973
 
hddhdhdhdhdhdhdhdhdhddhddhdhdhdhddhdhdddhdhdh
hddhdhdhdhdhdhdhdhdhddhddhdhdhdhddhdhdddhdhdhhddhdhdhdhdhdhdhdhdhddhddhdhdhdhddhdhdddhdhdh
hddhdhdhdhdhdhdhdhdhddhddhdhdhdhddhdhdddhdhdh
zoobiarana76
 
full description on quantum computing.ppt
full description on quantum computing.pptfull description on quantum computing.ppt
full description on quantum computing.ppt
libokes622
 
1542 inner products
1542 inner products1542 inner products
1542 inner products
Dr Fereidoun Dejahang
 
Quantum Computing
Quantum ComputingQuantum Computing
Quantum Computing
t0pgun
 
QC-UNIT 2.ppt
QC-UNIT 2.pptQC-UNIT 2.ppt
QC-UNIT 2.ppt
khan188474
 
Bca1040 digital logic
Bca1040  digital logicBca1040  digital logic
Bca1040 digital logic
smumbahelp
 
Report-Implementation of Quantum Gates using Verilog
Report-Implementation of Quantum Gates using VerilogReport-Implementation of Quantum Gates using Verilog
Report-Implementation of Quantum Gates using Verilog
Shashank Kumar
 
Quantum Computing Notes Ver1.0
Quantum Computing Notes Ver1.0Quantum Computing Notes Ver1.0
Quantum Computing Notes Ver1.0
Vijayananda Mohire
 
quantumComputers.ppt
quantumComputers.pptquantumComputers.ppt
quantumComputers.ppt
AbhayGill3
 
quantumComputers.ppt
quantumComputers.pptquantumComputers.ppt
quantumComputers.ppt
Raja Shekar
 
quantumComputers.ppt
quantumComputers.pptquantumComputers.ppt
quantumComputers.ppt
AjayRaj912848
 
quantumComputers (1).ppt
quantumComputers (1).pptquantumComputers (1).ppt
quantumComputers (1).ppt
harithasahasra
 
quantumComputers.ppt
quantumComputers.pptquantumComputers.ppt
quantumComputers.ppt
Adnan kHAN
 
quantumComputers.pptjhijjkbtyfvhjbvvjvkjlh
quantumComputers.pptjhijjkbtyfvhjbvvjvkjlhquantumComputers.pptjhijjkbtyfvhjbvvjvkjlh
quantumComputers.pptjhijjkbtyfvhjbvvjvkjlh
218r1a05m0
 
quantumComputers in Application of Qunatum Physics.ppt
quantumComputers in Application of Qunatum Physics.pptquantumComputers in Application of Qunatum Physics.ppt
quantumComputers in Application of Qunatum Physics.ppt
RAJASEKARAN G
 
quantumComputers.pptICICI-An HR perspective
quantumComputers.pptICICI-An HR perspectivequantumComputers.pptICICI-An HR perspective
quantumComputers.pptICICI-An HR perspective
BenjinkumarNimmala
 
quantumComputers.ppt
quantumComputers.pptquantumComputers.ppt
quantumComputers.ppt
TrushaKyada
 
quantumComputers.ppt
quantumComputers.pptquantumComputers.ppt
quantumComputers.ppt
raju980973
 
hddhdhdhdhdhdhdhdhdhddhddhdhdhdhddhdhdddhdhdh
hddhdhdhdhdhdhdhdhdhddhddhdhdhdhddhdhdddhdhdhhddhdhdhdhdhdhdhdhdhddhddhdhdhdhddhdhdddhdhdh
hddhdhdhdhdhdhdhdhdhddhddhdhdhdhddhdhdddhdhdh
zoobiarana76
 
full description on quantum computing.ppt
full description on quantum computing.pptfull description on quantum computing.ppt
full description on quantum computing.ppt
libokes622
 
Quantum Computing
Quantum ComputingQuantum Computing
Quantum Computing
t0pgun
 
Bca1040 digital logic
Bca1040  digital logicBca1040  digital logic
Bca1040 digital logic
smumbahelp
 
Report-Implementation of Quantum Gates using Verilog
Report-Implementation of Quantum Gates using VerilogReport-Implementation of Quantum Gates using Verilog
Report-Implementation of Quantum Gates using Verilog
Shashank Kumar
 
Ad

More from Vijayananda Mohire (20)

Bhadale QAI Hub - for multicloud, multitechnology platform
Bhadale QAI Hub - for multicloud, multitechnology platformBhadale QAI Hub - for multicloud, multitechnology platform
Bhadale QAI Hub - for multicloud, multitechnology platform
Vijayananda Mohire
 
Practical_Introduction_to_Quantum_Safe_Cryptography
Practical_Introduction_to_Quantum_Safe_CryptographyPractical_Introduction_to_Quantum_Safe_Cryptography
Practical_Introduction_to_Quantum_Safe_Cryptography
Vijayananda Mohire
 
Progress Report- MIT Course 8.371.3x - VD-Mohire
Progress Report- MIT Course 8.371.3x - VD-MohireProgress Report- MIT Course 8.371.3x - VD-Mohire
Progress Report- MIT Course 8.371.3x - VD-Mohire
Vijayananda Mohire
 
Quantum Communications Q&A with Gemini LLM
Quantum Communications Q&A with Gemini LLMQuantum Communications Q&A with Gemini LLM
Quantum Communications Q&A with Gemini LLM
Vijayananda Mohire
 
Peer Review Certificate for Journal of Engg
Peer Review Certificate for Journal of EnggPeer Review Certificate for Journal of Engg
Peer Review Certificate for Journal of Engg
Vijayananda Mohire
 
Quantum Algorithms for Electronics - IEEE Certificate
Quantum Algorithms for Electronics - IEEE CertificateQuantum Algorithms for Electronics - IEEE Certificate
Quantum Algorithms for Electronics - IEEE Certificate
Vijayananda Mohire
 
NexGen Solutions for cloud platforms, powered by GenQAI
NexGen Solutions for cloud platforms, powered by GenQAINexGen Solutions for cloud platforms, powered by GenQAI
NexGen Solutions for cloud platforms, powered by GenQAI
Vijayananda Mohire
 
Certificate- Peer Review of Book Chapter on ML
Certificate- Peer Review of Book Chapter on MLCertificate- Peer Review of Book Chapter on ML
Certificate- Peer Review of Book Chapter on ML
Vijayananda Mohire
 
Key projects Data Science and Engineering
Key projects Data Science and EngineeringKey projects Data Science and Engineering
Key projects Data Science and Engineering
Vijayananda Mohire
 
Key projects Data Science and Engineering
Key projects Data Science and EngineeringKey projects Data Science and Engineering
Key projects Data Science and Engineering
Vijayananda Mohire
 
Bhadale IT Hub-Multi Cloud and Multi QAI
Bhadale IT Hub-Multi Cloud and Multi QAIBhadale IT Hub-Multi Cloud and Multi QAI
Bhadale IT Hub-Multi Cloud and Multi QAI
Vijayananda Mohire
 
My key hands-on projects in Quantum, and QAI
My key hands-on projects in Quantum, and QAIMy key hands-on projects in Quantum, and QAI
My key hands-on projects in Quantum, and QAI
Vijayananda Mohire
 
Azure Quantum Workspace for developing Q# based quantum circuits
Azure Quantum Workspace for developing Q# based quantum circuitsAzure Quantum Workspace for developing Q# based quantum circuits
Azure Quantum Workspace for developing Q# based quantum circuits
Vijayananda Mohire
 
Key projects in AI, ML and Generative AI
Key projects in AI, ML and Generative AIKey projects in AI, ML and Generative AI
Key projects in AI, ML and Generative AI
Vijayananda Mohire
 
My Journey towards Artificial Intelligence
My Journey towards Artificial IntelligenceMy Journey towards Artificial Intelligence
My Journey towards Artificial Intelligence
Vijayananda Mohire
 
Bhadale IT Cloud Solutions for Agriculture
Bhadale IT Cloud Solutions for AgricultureBhadale IT Cloud Solutions for Agriculture
Bhadale IT Cloud Solutions for Agriculture
Vijayananda Mohire
 
Bhadale IT Cloud Solutions for Agriculture
Bhadale IT Cloud Solutions for AgricultureBhadale IT Cloud Solutions for Agriculture
Bhadale IT Cloud Solutions for Agriculture
Vijayananda Mohire
 
Bhadale IT Intel and Azure Cloud Offerings
Bhadale IT Intel and Azure Cloud OfferingsBhadale IT Intel and Azure Cloud Offerings
Bhadale IT Intel and Azure Cloud Offerings
Vijayananda Mohire
 
GitHub Copilot-vijaymohire
GitHub Copilot-vijaymohireGitHub Copilot-vijaymohire
GitHub Copilot-vijaymohire
Vijayananda Mohire
 
Practical ChatGPT From Use Cases to Prompt Engineering & Ethical Implications
Practical ChatGPT From Use Cases to Prompt Engineering & Ethical ImplicationsPractical ChatGPT From Use Cases to Prompt Engineering & Ethical Implications
Practical ChatGPT From Use Cases to Prompt Engineering & Ethical Implications
Vijayananda Mohire
 
Bhadale QAI Hub - for multicloud, multitechnology platform
Bhadale QAI Hub - for multicloud, multitechnology platformBhadale QAI Hub - for multicloud, multitechnology platform
Bhadale QAI Hub - for multicloud, multitechnology platform
Vijayananda Mohire
 
Practical_Introduction_to_Quantum_Safe_Cryptography
Practical_Introduction_to_Quantum_Safe_CryptographyPractical_Introduction_to_Quantum_Safe_Cryptography
Practical_Introduction_to_Quantum_Safe_Cryptography
Vijayananda Mohire
 
Progress Report- MIT Course 8.371.3x - VD-Mohire
Progress Report- MIT Course 8.371.3x - VD-MohireProgress Report- MIT Course 8.371.3x - VD-Mohire
Progress Report- MIT Course 8.371.3x - VD-Mohire
Vijayananda Mohire
 
Quantum Communications Q&A with Gemini LLM
Quantum Communications Q&A with Gemini LLMQuantum Communications Q&A with Gemini LLM
Quantum Communications Q&A with Gemini LLM
Vijayananda Mohire
 
Peer Review Certificate for Journal of Engg
Peer Review Certificate for Journal of EnggPeer Review Certificate for Journal of Engg
Peer Review Certificate for Journal of Engg
Vijayananda Mohire
 
Quantum Algorithms for Electronics - IEEE Certificate
Quantum Algorithms for Electronics - IEEE CertificateQuantum Algorithms for Electronics - IEEE Certificate
Quantum Algorithms for Electronics - IEEE Certificate
Vijayananda Mohire
 
NexGen Solutions for cloud platforms, powered by GenQAI
NexGen Solutions for cloud platforms, powered by GenQAINexGen Solutions for cloud platforms, powered by GenQAI
NexGen Solutions for cloud platforms, powered by GenQAI
Vijayananda Mohire
 
Certificate- Peer Review of Book Chapter on ML
Certificate- Peer Review of Book Chapter on MLCertificate- Peer Review of Book Chapter on ML
Certificate- Peer Review of Book Chapter on ML
Vijayananda Mohire
 
Key projects Data Science and Engineering
Key projects Data Science and EngineeringKey projects Data Science and Engineering
Key projects Data Science and Engineering
Vijayananda Mohire
 
Key projects Data Science and Engineering
Key projects Data Science and EngineeringKey projects Data Science and Engineering
Key projects Data Science and Engineering
Vijayananda Mohire
 
Bhadale IT Hub-Multi Cloud and Multi QAI
Bhadale IT Hub-Multi Cloud and Multi QAIBhadale IT Hub-Multi Cloud and Multi QAI
Bhadale IT Hub-Multi Cloud and Multi QAI
Vijayananda Mohire
 
My key hands-on projects in Quantum, and QAI
My key hands-on projects in Quantum, and QAIMy key hands-on projects in Quantum, and QAI
My key hands-on projects in Quantum, and QAI
Vijayananda Mohire
 
Azure Quantum Workspace for developing Q# based quantum circuits
Azure Quantum Workspace for developing Q# based quantum circuitsAzure Quantum Workspace for developing Q# based quantum circuits
Azure Quantum Workspace for developing Q# based quantum circuits
Vijayananda Mohire
 
Key projects in AI, ML and Generative AI
Key projects in AI, ML and Generative AIKey projects in AI, ML and Generative AI
Key projects in AI, ML and Generative AI
Vijayananda Mohire
 
My Journey towards Artificial Intelligence
My Journey towards Artificial IntelligenceMy Journey towards Artificial Intelligence
My Journey towards Artificial Intelligence
Vijayananda Mohire
 
Bhadale IT Cloud Solutions for Agriculture
Bhadale IT Cloud Solutions for AgricultureBhadale IT Cloud Solutions for Agriculture
Bhadale IT Cloud Solutions for Agriculture
Vijayananda Mohire
 
Bhadale IT Cloud Solutions for Agriculture
Bhadale IT Cloud Solutions for AgricultureBhadale IT Cloud Solutions for Agriculture
Bhadale IT Cloud Solutions for Agriculture
Vijayananda Mohire
 
Bhadale IT Intel and Azure Cloud Offerings
Bhadale IT Intel and Azure Cloud OfferingsBhadale IT Intel and Azure Cloud Offerings
Bhadale IT Intel and Azure Cloud Offerings
Vijayananda Mohire
 
Practical ChatGPT From Use Cases to Prompt Engineering & Ethical Implications
Practical ChatGPT From Use Cases to Prompt Engineering & Ethical ImplicationsPractical ChatGPT From Use Cases to Prompt Engineering & Ethical Implications
Practical ChatGPT From Use Cases to Prompt Engineering & Ethical Implications
Vijayananda Mohire
 
Ad

Recently uploaded (20)

How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
Quantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur MorganQuantum Computing Quick Research Guide by Arthur Morgan
Quantum Computing Quick Research Guide by Arthur Morgan
Arthur Morgan
 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
 
Procurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptxProcurement Insights Cost To Value Guide.pptx
Procurement Insights Cost To Value Guide.pptx
Jon Hansen
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 

Quantum Computing Notes Ver 1.2

  • 1. Quantum Computing – Notes Ver 1.2 Prepared By: Vijayananda Mohire Sources: Various open courses, MOOC trainings and self study; no intention for any copyright infringements Question 1 Design a reversible circuit, using NOT, CNOT, Toffoli, and Fredkin gates,which acts on the four inputs a,b,c,d, to perform the operation swap243(a,b,c,d) which swaps b and d if a=0, and swaps c and d if a=1. Bit a should be left unchanged Answer 1 High level functionwith the circuit fredkin(a,c,d) not(a) fredkin(a,b,d) not(a) Question 2 Design a reversible circuit, using NOT, CNOT, Toffoli, and Fredkin gates, which acts on the four inputs a,b,c,d, to swap c and d only when both a=1 and b=1. You may use a fifth bit e, given as initialized to e=0, in your circuit; this bit must also end as e=0. C Answer 2 High level functionwith the circuit toffoli(a,b,e) fredkin(e,c,d) toffoli(a,b,e)
  • 2. Question 3 Sample RandomNumber using Q# Answer 3 open Microsoft.Quantum.Arrays; open Microsoft.Quantum.Measurement; operation SampleRandomNumber(nQubits : Int) : Result[] { // We prepare a register of qubits in a uniform // superposition state, such that when we measure, // all bitstrings occur with equal probability. use register = Qubit[nQubits] { // Set qubits in superposition. ApplyToEachA(H, register); // Measure all qubits and return. return ForEach(MResetZ, register); } } Question 4 Run a basic quantum circuit expressed using the Qiskit library to an IonQ target via the Azure Quantum service. Answer 4 First, import the required packages for this sample: from qiskit import QuantumCircuit from qiskit.visualization import plot_histogram from qiskit.tools.monitor import job_monitor from azure.quantum.qiskit import AzureQuantumProvider #Connect to backend Azure quantum service, using below function from azure.quantum.qiskit import AzureQuantumProvider provider = AzureQuantumProvider ( resource_id = " ", location = " " ) # Create a Quantum Circuit acting on the q register circuit = QuantumCircuit(3, 3) circuit.name = "Qiskit Sample - 3-qubit GHZ circuit" circuit.h(0) circuit.cx(0, 1) circuit.cx(1, 2) circuit.measure([0,1,2], [0, 1, 2]) # Print out the circuit circuit.draw() ┌───┐ ┌─┐ q_0: ┤ H ├──■───────┤M├────── └───┘┌─┴─┐ └╥┘┌─┐ q_1: ─────┤ X ├──■───╫─┤M├─── └───┘┌─┴─┐ ║ └╥┘┌─┐ q_2: ──────────┤ X ├─╫──╫─┤M├ └───┘ ║ ║ └╥┘ c: 3/════════════════╩══╩══╩═ 0 1 2
  • 3. #Create a Backend object to connect to the IonQ Simulator back-end: simulator_backend = provider.get_backend("ionq.simulator") job = simulator_backend.run(circuit, shots=100) job_id = job.id() print("Job id", job_id) #Create a job monitor object job_monitor(job) #To wait until the job is completed and return the results, run: result = job.result() qiskit.result.result.Result print(result) connect to real hardware (Quantum Processing Unit or QPU) qpu_backend = provider.get_backend("ionq.qpu") # Submit the circuit to run on Azure Quantum qpu_job = qpu_backend.run(circuit, shots=1024) job_id = qpu_job.id() print("Job id", job_id) # Monitor job progress and wait until complete: job_monitor(qpu_job) # Get the job results (this method also waits for the Job to complete): result = qpu_job.result() print(result) counts = {format(n, "03b"): 0 for n in range(8)} counts.update(result.get_counts(circuit)) print(counts) plot_histogram(counts) Question 5 Develop Google AI sample Cirq circuit Answer 5 import cirq qubits = [cirq.GridQubit(x, y) for x in range(3) for y in range(3)] print(qubits[0]) # This is an Pauli X gate. It is an object instance. x_gate = cirq.X # Applying it to the qubit at location (0, 0) (defined above) # turns it into an operation. x_op = x_gate(qubits[0]) print(x_op) cz = cirq.CZ(qubits[0], qubits[1]) x = cirq.X(qubits[2]) moment = cirq.Moment([x, cz]) x2 = cirq.X(qubits[2]) cz12 = cirq.CZ(qubits[1], qubits[2]) moment0 = cirq.Moment([cz01, x2])
  • 4. moment1 = cirq.Moment([cz12]) circuit = cirq.Circuit((moment0, moment1)) print(circuit) Question 6 Design a simple Tensorflow based quantum Colab sample Answer 6 !pip install tensorflow==2.4.1 !pip install tensorflow-quantum import tensorflow as tf import tensorflow_quantum as tfq import cirq import sympy import numpy as np # visualization tools %matplotlib inline import matplotlib.pyplot as plt from cirq.contrib.svg import SVGCircuit a, b = sympy.symbols('a b') # Create two qubits q0, q1 = cirq.GridQubit.rect(1, 2) # Create a circuit on these qubits using the parameters you created above. circuit = cirq.Circuit( cirq.rx(a).on(q0), cirq.ry(b).on(q1), cirq.CNOT(control=q0, target=q1)) SVGCircuit(circuit) # Calculate a state vector with a=0.5 and b=-0.5. resolver = cirq.ParamResolver({a: 0.5, b: -0.5}) output_state_vector = cirq.Simulator().simulate(circuit, resolver).final_state_vector output_state_vector
  • 5. Question 7 Design a simple qubit based quantum circuit using IBMQiskit Answer 7 import numpy as np # Importing standard Qiskit libraries from qiskit import QuantumCircuit, transpile, Aer, IBMQ, assemble from qiskit.tools.jupyter import * from qiskit.visualization import * from ibm_quantum_widgets import * from math import pi, sqrt # Loading your IBM Quantum account(s) provider = IBMQ.load_account() sim = Aer.get_backend('aer_simulator') # Let's do an X-gate on a |0> qubit qc = QuantumCircuit(1) qc.x(0) qc.draw() qc.y(0) # Do Y-gate on qubit 0 qc.z(0) # Do Z-gate on qubit 0 qc.draw() # Create the X-measurement function: def x_measurement(qc, qubit, cbit): """Measure 'qubit' in the X-basis, and store the result in 'cbit'""" qc.h(qubit) qc.measure(qubit, cbit) return qc initial_state = [1/sqrt(2), -1/sqrt(2)] # Initialize our qubit and measure it qc = QuantumCircuit(1,1) qc.initialize(initial_state, 0) x_measurement(qc, 0, 0) # measure qubit 0 to classical bit 0 qc.draw()
  • 6. Question 8 How to find if matrix is Unitary Answer 8 Consider a 2*2 Matrix A with different values. We take 2 examples as shown below to prove how these are valid or not for quantum representation A = 0 1 𝑖 0 and AT = 0 𝑖 1 0 Next, A*AT = 𝑖 0 0 𝑖 = i * 1 0 0 1 which is an Identity matrix I So this matrix is Unitary and valid for quantum representations Next example, A = 1 −1 0 1 and AT = 1 0 −1 1 Next, A*AT = 2 0 −1 0 = which isNOT an Identity matrix, as 2 is not correct So this matrix is NOT unitary and NOT valid for quantum representations Question 9 Generate the Unitary matrix for the given quantum circuit Answer 9 First let me get the matricesfor NOT and CNOT gates NOT = 0 1 1 0 and for CNOT 1 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0 Gate Matrices have to be multiplied. However, when matrix is generated for single qubit ,tensor product with identity is required. So getting the I for the NOT gates
  • 7. 0 1 1 0 tensor product 0 1 1 0 = 0 0 1 0 0 0 0 1 1 0 0 0 0 1 0 0 this is the Identity I Now multiply these as per circuit order I * CNOT Matrix *I 0 0 1 0 0 0 0 1 1 0 0 0 0 1 0 0 * 0 0 1 0 0 0 0 1 1 0 0 0 0 1 0 0 * 0 0 1 0 0 0 0 1 1 0 0 0 0 1 0 0 = 𝟎 𝟏 𝟎 𝟎 𝟏 𝟎 𝟎 𝟎 𝟎 𝟎 𝟏 𝟎 𝟎 𝟎 𝟎 𝟏 The multiplication can be made easier using online tool like https://www.dcode.fr/matrix-multiplication This is based on theory, however this needs to be done using simulator like Qiskit based Composer and get the Unitary matrix Question 10: Derive Pauli’s X gate Answer 10: There are 3 Pauli’s gates namely X, Y and Z that represent the various gate operations on the Bloch sphere. Pauli’s X gate offer a NOT type of operation and is represented by bra-ket and matrix notations. Below is anexample of deriving the X gate Please note bra is represented by < 0 | and ket by |0 >. Arranging the matricesin proper shape is the key in getting the proper results. There is also a conjugate transpose required, meaning the cols matrix is transformed to row matrix and these are then multiplied I have used a different method to represent the state vector rows and columns; however this is not the best one. You can use KET based COLS first and BRA based ROWS, and then do the operation. Pauli X is a NOT gate, so the 0->1 and 1>0 are reflectedin the matrices. Please get these things clear first
  • 8. Question 11: Derive Pauli’s Y gate Answer 11: In a similar way the Pauli’s X is derived, Pauli’s Y is derived
  • 9. Question 12: Derive Pauli’s Z gate, Answer 12
  • 10. Question 13: Show an example of inner product Answer 13: Inner product of 2 matricesis the dot product and results in a scalar. Question 14: Show an example of outer product Answer 14: Outer product of 2 matrices is the tensor product and resultsin a vector matrix.
  • 11. Question 15: Show an example of outer product using Pauli X & Y with anexample of Trace Answer 15: Using Pauli’s X & Y matrices Question 16: Show how Bell State is derived Answer 16: Bell state preparation uses 3 steps: 1. State initialization 2. Use Hadamard and Identity gate for superposition and getting the Kronecker matrix 3. Use a CNOT to multiply with the Kronecker matrix Detailsin the following notes below
  • 13. Question 17: State the types of quantum states Answer 17: Quantum qubit can have 6 possible states, 2 each for the X, Y and Z directions of the Bloch sphere Another way to represent these are shown below, |0>, |1>,| +>, |->,| I > and | –I > Image source: https://andisama.medium.com/qubit-an-intuition-1-first-baby-steps-in-exploring-the-quantum-world- 16f693e456d8
  • 14. Question 18: Define the notations for the different types of quantum states like plus, minus etc Answer 18: Quantum qubit state notations are mainly represented in matrix and bra-ket forms with transformation from one notation to another as required to solve a problem .Below are matrix notations for 0,1, + and – states. These can be re-written from matrix to state, like col matrix [1 0] can be written as ket notation | 0> as per the need of the problem to be solved Question 19: Apply an H gate on the |+> and show the results Answer 19: First we get the matrix notation for H and |+> states, then we multiply them, details shown below
  • 15. Question 20: Apply an X gate on the |0> and show the results Answer 20: First we get the matrix notation for X and |0> states, then we multiply them, as shown below Question 21: Apply an X gate on the |-> and show the results Answer 21: First we get the matrix notation for X and |-> states, then we multiply them, details shown below ,results show on Bloch sphere for Question 19 and 20 Question 22: Test the below matrices for the validity of being the bitflip X gate Answer 22: First we get the matrix notation of the X gate and test it againsteach given matrix that should result in the NOT operation
  • 16. Question 23: Given H acting on |0> produces |+> & H|1> = |->, which is the correct H operator Answer 23: First we get the matrix for H and testeach given matrix that produces the required results Question 24: Express |+> state in the Z – basis(Hadamard) Answer 24:
  • 17. Question 25: Using Matrix and related gates derive Bell states Answer 25: Please refer images below
  • 19. Question 26: Show the Eigen vectors and Eigen values for PaulisXYZ Answer 26: Eigen values in each case are + and –. Eigen vectors are shown below Question 27: Please test if these states are separable? Answer 27: Please refer image below
  • 20. Question 28: Show the probability of finding a qubitin a given state Answer 28: Please refer image below Question 29: Show unitary rotation matrices around Pauli XYZ Answer 29: Please refer image c
  • 21. Question 30 Describe how you would represent a large set of particlesin a Fock space rather than the Hilbert space Answer 30 Fock space is a newerway (Second Quantization) to represent multi-particles in aneasier way unlike in the Hilbert space. Below is the broad wayin simple terms ERRATA: Please note that instead of 6 basis states as mentioned, ONLY 5 have been represented in the KET form, you can add another term here, say a ‘zero to make the complete set of 6 base states Question 31 Describe in simple words how Fock space uses Hilbert space Answer 31 Fock space offers newer way of abstracting the state-space representations as previously done in the First Quantization. This helps iseasier and shorter way in showing the quantum states.
  • 22. References: 1. MIT OpenCourseWare , https://ocw.mit.edu/ 2. IBMQuantum Lab, https://quantum-computing.ibm.com/lab 3. Azure Quantum, https://azure.microsoft.com/en-in/services/quantum/ 4. QuTech Academy, https://www.qutube.nl/ 5. Andi Sama Blog, https://andisama.medium.com/qubit-an-intuition-1-first-baby-steps-in-exploring-the- quantum-world-16f693e456d8 6. Einstein Relatively Easy, https://einsteinrelativelyeasy.com/ 7. The Web and Google Search Disclaimer: I have no intention for any copyright infringement, nor I promise that the results are true and right. Please use your caution to self-check the results against the quantum postulates. I am reachable at [email protected] for any clarifications