Quantum Computing for Everyone: Learn the
Fundamentals in a Day
14/03/2024 Anandaraman, NISER Bhubaneswar 1
Objectives
1. CMOS Transistor
2. Logic Gates (NOT, NOR, OR, NAND, AND)
3. Logic circuits
4. Logic Functions (Instantiation of logic circuits)
5. Computational Basis & Superposition
6. Quantum logic Gates (I, X, H, CNOT, CCNOT and CSWAP)
7. Implement logic circuits using quantum gates (XOR, SWAP, Bell state, Half and full adder)
14/03/2024 Anandaraman, NISER Bhubaneswar 2
CMOS
Two types of MOSFETs: NMOS and PMOS
The NMOS turns on when the voltage is high and off when the voltage is low. The PMOS, on
the other hand, turns on whenever the voltage is low and goes off as the voltage goes high.
When the two are used together to realize the logic gates, they are called CMOS
(Complementary MOS).
14/03/2024 Anandaraman, NISER Bhubaneswar 3
CMOS Logic Gates
We can attach a pMOS transistor that connects to the source and an nMOS transistor that
connects to the ground.
This cMOS transistor acts in a similar manner to the NOT logical function.
14/03/2024 Anandaraman, NISER Bhubaneswar 4
CMOS Logic Gates
14/03/2024 Anandaraman, NISER Bhubaneswar 5
CMOS Logic Gates
14/03/2024 Anandaraman, NISER Bhubaneswar 6
Logic Circuits (Half Adder)
Logic circuits are combinations of logic gates interconnected to perform complex logical
operations.
14/03/2024 Anandaraman, NISER Bhubaneswar 7
Logic Circuits (Full Adder)
14/03/2024 Anandaraman, NISER Bhubaneswar 8
Logic Function (De Morgan's Law)
De Morgan's Law allows you to rewrite complex logic expressions containing negation, OR
(OR gate), and AND (AND gate) operations into simpler forms using only negation, OR, and
AND on individual variables. This simplification can:
➔ Simplifying Logic Expressions
➔ Implementing Logic Functions with Universal Gates
➔ Understanding Boolean Algebra
First Law: The negation of the OR of two or more variables is equivalent to the AND of the
negations of the individual variables.
(A ∩ B)’ = A’ ∪ B’
Second Law: The negation of the AND of two or more variables is equivalent to the OR of
the negations of the individual variables.
(A ∪ B)’ = A’ ∩ B’
14/03/2024 Anandaraman, NISER Bhubaneswar 9
Computational Basis
Computational basis refers to a specific set of basis states used to represent the state of a
qubit.
Classical Bit: Two states (0 or 1)
Qubit: Two states (|0⟩ and |1⟩), but can also be in a superposition of both simultaneously.
In the computational basis, a qubit can be in either:
|0⟩ (ket-zero): Represented as "off" or 0, similar to a classical bit.
|1⟩ (ket-one): Represented as "on" or 1, again similar to a classical bit.
14/03/2024 Anandaraman, NISER Bhubaneswar 10
Superposition
Unlike a classical bit, a qubit can be in both states at the same time.
It's like the light switch being both on and off simultaneously. We call this state a
superposition.
A qubit in superposition is represented by a combination of |0⟩ and |1⟩, with complex
numbers indicating the probability of finding it in either state when measured. It's written as:
|ψ⟩ = α |0⟩ + β |1⟩
where α and β are complex numbers and their squares add up to 1 (|α|^2 + |β|^2 = 1).
The modulus of a complex number z = x + iy, denoted by |z|, is given by the formula |z| =
√(x2 + y2), where x is the real part and y is the imaginary part of the complex number z.
14/03/2024 Anandaraman, NISER Bhubaneswar 11
Review: Matrix Multiplication
14/03/2024 Anandaraman, NISER Bhubaneswar 12
What are the four operations on one bit?
1. Reversible means given the operation and output value, you can find the input value
For Ax=b, given b and A, you can uniquely find x.
2. Operations which permute are reversible; operations which erase & overwrite are not.
(Identity and Negation are reversible, constant-0 and constant-1 are not reversible)
3. Quantum computers use only reversible opetations.
4. Reversible gate reduces power dissipation.
5. All quantum operators are their own inverses.
14/03/2024 Anandaraman, NISER Bhubaneswar 13
Review: Tensor product of vectors
14/03/2024 Anandaraman, NISER Bhubaneswar 14
Representing multiple cbits
14/03/2024 Anandaraman, NISER Bhubaneswar 15
Quantum logic gates
Quantum logic gates are represented by unitary matrices.
computational basis of the two-level qubit system represented with vectors as follows;
I, X and H Gates
Identity (I) Gate, NOT (X) Gate, Hadamard (H) Gate
14/03/2024 Anandaraman, NISER Bhubaneswar 16
Identity gate, X gate and Hadamard gate
Identity gate doesn't affect any qubit state, and thus it can be same as buffer in classical
circuits.
NOT or X gate inverts the state of the qubit i.e., |0>changes to |1> and |1>changes to |0>.
Transforms a qubit into superposition of two states
14/03/2024 Anandaraman, NISER Bhubaneswar 17
CNOT, CCNOT and CSWAP Gates
CNOT Gate (Controlled-NOT Gate): Two-qubit gate with one control and one target qubit.
If the control qubit is |1⟩, it applies a NOT operation on the target qubit; otherwise, it leaves the target
qubit unchanged. This gate is essential for creating entanglement and implementing
quantum circuits.
Toffoli Gate (CCNOT Gate): Three-qubit gate with two control and one target qubit.
If both control qubits are |1⟩, it applies a NOT operation on the target qubit;
otherwise, it leaves the target qubit unchanged. The Toffoli gate
is also known as the “controlled-controlled-NOT” gate.
Swap Gate: The swap gate exchanges the states of two qubits. It has applications in
various quantum algorithms, particularly for rearranging qubit states during computation.
CSWAP Gate: Controlled SWAP gate is abbreviated as CSWAP as it swaps the values of B
and C at the output when A = 1
14/03/2024 Anandaraman, NISER Bhubaneswar 18
14/03/2024 Anandaraman, NISER Bhubaneswar 19
Quantum gates
CNOT gate is also called as Feynman gate.
CCNOT gate is also called as Toffoli gate.
CSWAP gate is also called as Fredkin gate.
As far as the number of outputs are concerned, they are same as inputs due to reversibility
(Reversible unitary operation)
Reversible gate reduces power dissipation
Identity gate doesn't affect any qubit state, and thus it can be same as buffer in classical
circuits.
Hadamard or H Gate transforms a qubit into superposition of two states from a definite
computational basis state.
14/03/2024 Anandaraman, NISER Bhubaneswar 20
Bloch Sphere (Felix Bloch)
Visualizing the state of a single qubit (3D)
|0> --> Spin-UP, |1> --> Spin-Down
Basis States and Superpositions:
North pole: (θ = 0, φ = 0) corresponds to |0 ⟩ (α = 1, β = 0).
South pole: (θ = π, φ = 0) corresponds to |1 ⟩ (α = 0, β = 1).
Equator: Points with θ = π/2 represent equal superpositions of |0 ⟩ and |1 ⟩
(e.g., α = β = 1/√2). Azimuthal Angle (Horizontal position)
0° (positive x-axis) to 360° (back to the
positive x-axis)
Other points: Represent varying superpositions based on θ – Theta (azimuthal angle)
their distance from the poles and angle relative to the axes.
Polar Angle (Vertical position)
0° (directly on the positive z-axis)
to 180° (directly on the negative z-
axis).
φ – Phi (Polor angle)
NOTE: Together, the polar and azimuthal angles uniquely identify any point on the sphere.
14/03/2024 Anandaraman, NISER Bhubaneswar 21
14/03/2024 Anandaraman, NISER Bhubaneswar 22
Single qubit gate operations are just
rotations on the surface of the bloch
sphere
14/03/2024 Anandaraman, NISER Bhubaneswar 23
14/03/2024 Anandaraman, NISER Bhubaneswar 24
XOR quantum circuits
XOR Gate Implementation with
CNOT Quantum Gate
14/03/2024 Anandaraman, NISER Bhubaneswar 25
2-qubit SWAP circuit
14/03/2024 Anandaraman, NISER Bhubaneswar 26
Bell State Preparation
Bell states are the four states that can be created when two qubits are maximally entangled.
The four states are represented as so:
Circuit for implementing the first Bell state Circuit for the third Bell state
Circuit to implement the second Bell state Circuit for the fourth Bell state
Each particle has two possible spin orientations and therefore the composite state is
represented by a 4-vector in a four-dimensional Hilbert space.
14/03/2024 Anandaraman, NISER Bhubaneswar 27
How the circuit actually creates the first Bell state
How the circuit actually creates the first Bell state
Kronecker product of H and I Gate
Next we need to multiply the above matrix by our initialised qubit state:
14/03/2024 Anandaraman, NISER Bhubaneswar 28
First Bell state
Now we just need to apply the CNOT gate to the circuit by multiplying the state above with the CNOT matrix:
Which finally gives us the state:
1. Measuring one qubit of a Bell pair instantly reveals the state of the other qubit.
2. A maximally entangled pair of correlated or anti-correlated qubits.
3. Creating Bell states is currently error prone.
4. Can be used to measure the quality of a quantum computer.
14/03/2024 Anandaraman, NISER Bhubaneswar 29
Half Adder
14/03/2024 Anandaraman, NISER Bhubaneswar 30
Full Adder
14/03/2024 Anandaraman, NISER Bhubaneswar 31
14/03/2024 Anandaraman, NISER Bhubaneswar 32