0% found this document useful (0 votes)
15 views50 pages

Session 4

Uploaded by

Animesh Sahu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views50 pages

Session 4

Uploaded by

Animesh Sahu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 50

Session 4 : Single / Multiple

Qubit Gates
Agenda
Classical Logic Gates
Quantum Bit (Qubit)
Quantum Gates
• Single Qubit
• Multi Qubit
Classical Logic Gates

• NOT, AND, and OR Gates


• NAND and NOR Gates
• DeMorgan’s Theorem
• Exclusive-OR (XOR) Gate
• Multiple-input Gates
NOT Gate -- Inverter

NOT X Y
X Y 0 1
1 0
Y = ~X
NOT

X ~X ~~X = X

X ~X ~~X
0 1 0
1 0 1
AND Gate
AND
X Y Z
X 0 0 0
0 1 0
Z
1 0 0
Y 1 1 1

Z = X & Y
OR Gate
OR
X Y Z
X 0 0 0
Z 0 1 1
Y 1 0 1
1 1 1
Z = X | Y
Basic Logic Gates

• NOT, AND, and OR Gates


• NAND and NOR Gates
• DeMorgan’s Theorem
• Exclusive-OR (XOR) Gate
• Multiple-input Gates
NAND Gate
NOT-AND
X Y W Z
X 0 0 0 1
W 0 1 0 1
Z
1 0 0 1
Y 1 1 1 0

W = X & Y

Z = ~W = ~(X & Y)
NAND Gate
NAND
X Y Z
X 0 0 1
0 1 1
Z
1 0 1
Y 1 1 0

Z = ~(X & Y)
nand(Z,X,Y)
NOR Gate
NOT-OR
X Y W Z
X 0 0 0 1
W Z 0 1 1 0
Y 1 0 1 0
1 1 1 0
W = X | Y

Z = ~W = ~(X | Y)
NOR Gate
NOR
X Y Z
X 0 0 1
Z 0 1 0
Y 1 0 0
1 1 0
Z = ~(X | Y)
nor(Z,X,Y)
Universal Gate
• Small well-defined sets of universal gate
types exist ,
e.g. {NAND}, {OR, NOT}
Basic Logic Gates

• NOT, AND, and OR Gates


• NAND and NOR Gates
• DeMorgan’s Theorem
• Exclusive-OR (XOR) Gate
• Multiple-input Gates
De Morgan’s Theorem
NAND Gate

X Z X Z
=
Y Y

Z = ~(X & Y) Z = ~X | ~Y

X Y W Z X Y ~X ~Y Z
0 0 0 1 0 0 1 1 1
0 1 0 1 0 1 1 0 1
1 0 0 1 1 0 0 1 1
1 1 1 0 1 1 0 0 0
~(X & Y) = ~X | ~Y
The negation of a disjunction is the conjunction of the negations.
De Morgan’s Theorem
NOR Gate

X X
Z Z
Y Y

Z = ~(X | Y) Z = ~X & ~Y

X Y Z X Y ~X ~Y Z
0 0 1 0 0 1 1 1
0 1 0 0 1 1 0 0
1 0 0 1 0 0 1 0
1 1 0 1 1 0 0 0
~(X | Y) = ~X & ~Y
The negation of a conjunction is the disjunction of the negations.
De Morgan’s Theorem
• NOT all variables
• Change & to | and | to &
• NOT the result
--------------------------------------------
• ~X | ~Y = ~(~~X & ~~Y) = ~(X & Y)
• ~(X & Y) = ~~(~X | ~Y) = ~X | ~Y
• ~X & !Y = ~(~~X | ~~Y) = ~(X | Y)
• ~(X | Y) = ~~(~X & ~Y) = ~X & ~Y
Basic Logic Gates

• NOT, AND, and OR Gates


• NAND and NOR Gates
• DeMorgan’s Theorem
• Exclusive-OR (XOR) Gate
• Multiple-input Gates
Exclusive-OR Gate

XOR X Y Z
X
Z 0 0 0
Y
0 1 1
Z = X ^ Y 1 0 1
xor(Z,X,Y)
1 1 0
Writing XOR using AND/ OR/ NOT
_ _ x y xy
• xyxy+xy 1 1 0
____
1 0 1
• x  y  (x + y)(xy) 0 1 1
0 0 0

x x+y (x+y)(xy)
y
xy xy
Exclusive-NOR Gate

XNOR X Y Z
X
Z 0 0 1
Y
0 1 0
Z = ~(X ^ Y) 1 0 0
Z = X ~^ Y 1 1 1
xnor(Z,X,Y)
Basic Logic Gates

• NOT, AND, and OR Gates


• NAND and NOR Gates
• DeMorgan’s Theorem
• Exclusive-OR (XOR) Gate
• Multiple-input Gates
Multiple-input Gates

Z1 Z2

Z3 Z4
Multiple-input AND Gate

Z1

Output Z1 is HIGH only if all inputs are HIGH


Multiple-input OR Gate

Z2

Output Z 2 is LOW only if all inputs are LOW


Multiple-input NAND Gate

Z3

Output Z 3 is LOW only if all inputs are HIGH


Multiple-input NOR Gate

Z4

Output Z 4 is HIGH only if all inputs are LOW


Agenda
Classical Logic Gates
Quantum Bit (Qubit)
Quantum Gates
• Single Qubit
• Multi Qubit
Definitions
What is a quantum computer?
A quantum computer is a device able to manipulate delicate
quantum states in a controlled fashion, not dissimilar to the way
an ordinary computer manipulates its bits.

What is a qubit?
A qubit (pronounced “cue-bit” and short for quantum bit) is the
physical carrier of quantum information. It is the quantum
version of a bit, and its quantum state can take values of |0⟩, |1⟩,
or the linear combination of both, which is a phenomenon
known as superposition.
e.g. |ψ> = α|0> + β|1>
What is a quantum gate?
A quantum gate is an operation applied to a qubit to change
Bloch Sphere

|ψ> = α|0> + β|1> where |α|2 + |β|2 = 1,


or
|ψ> = cosθ/2 |0> + eiφsinθ/2 |1>
Bits to Qubits……..A Quantum Leap
• Classical Computers operate with bits
• 0 or 1, OFF or ON
Bit vs Quantum Bit (Qubit) • One state at a time
• Only Two possibilities

• Quantum Computers operate with


Qubits!
• Simultaneously all possibilities
from 0 to 1 ( on Bloch’s
Sphere)
Operational equivalence
1 Qubit  2 Bits
Superposition 2 Qubits  4 Bits
10 Qubits  1024 Bits
N Qubits  2N Bits
Multiple qubits

• Two bits with states 0 and 1 form four


definite states 00, 01, 10, and 11.
• Two qubits: can be in superposition
of four computational basis set states.

   00   01   10   11
2 qubits 4 amplitudes
3 qubits 8 amplitudes
10 qubits 1024 amplitudes
20 qubits 1 048 576 amplitudes
30 qubits 1 073 741 824 amplitudes
500 qubits More amplitudes than our estimate of
number of atoms in the Universe!!!
Quantum Gates
Quantum Gates are used to manipulate qubits
Single Qubit Gates Multiple Qubit Gates
Pauli X ( NOT ) CNOT (Controlled Not)
Pauli Y CCNOT (Controlled Controlled Not) /
TOFFOLI
Pauli Z SWAP
Hadamard CSWAP (Controlled SWAP) / Fredkin
Phase Shift CZ
S
T
Single qubit gates
Pauli X Gate (NOT Gate)
Pauli X Gate (NOT Gate)
Pauli X Gate (NOT Gate)

Dirac notation Matrix representation Circuit representation


Phase Shift Gate
Matrix representation Circuit representation
Phase Shift Gate
Hadamard Gate
Acts on a single Qubit
Dirac notation Unitary matrix Circuit representation
Hadamard Gate
Multiple qubit gates
CNOT gate
• Controlled NOT gate
• Acts on two qubits
Matrix representation Circuit representation

b b

a b a

– Gate operation
CNOT gate
– Example of acting on a superposition

CNOT

- CNOT Self Inverse


CNOT
Toffoli gate
• Also called Controlled Controlled NOT
• Acts on three qubits
Matrix representation Circuit representation
Toffoli gate
• Also called Controlled Controlled NOT
• Acts on three qubits
Matrix representation Circuit representation

CCN is self inverse CCN(a,b,c)= (a,b,ab c)


CCN(a,b,ab c)= a,b, ab (ab c) = a,b,c
Toffoli gate
• Also called Controlled Controlled NOT
• Acts on three qubits
Matrix representation Circuit representation

c=0 then AND


b=0 and c=1 then NOT
SWAP gate

a a’

b b’

CSWAP is also known as Fredkin gate


Universal Quantum Gate
Quantum circuits
• The same way
classical gates can be arranged to form a classical circuit,
quantum gates can be arranged to form a quantum circuit

Unlike classical circuits,


the same number of wires
is going throughout the circuit

• Quantum circuit is the most commonly used model


to describe a quantum algorithm

You might also like