Session 4
Session 4
Qubit Gates
Agenda
Classical Logic Gates
Quantum Bit (Qubit)
Quantum Gates
• Single Qubit
• Multi Qubit
Classical Logic Gates
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
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
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
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 xy
• xyxy+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
Z1 Z2
Z3 Z4
Multiple-input AND Gate
Z1
Z2
Z3
Z4
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
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)
b b
a b a
– Gate operation
CNOT gate
– Example of acting on a superposition
CNOT
a a’
b b’