0% found this document useful (0 votes)
0 views7 pages

Unit 2 Notes

Quantum algorithms leverage quantum mechanical principles for computation, with notable examples including Shor's algorithm for factoring and Grover's search algorithm. Quantum circuits, composed of quantum gates, facilitate these algorithms, allowing operations on qubits that can exist in superposition. Measurement is a critical process in quantum computing, collapsing quantum states to classical results and playing a vital role in extracting information and ensuring algorithmic functionality.

Uploaded by

yt97333
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)
0 views7 pages

Unit 2 Notes

Quantum algorithms leverage quantum mechanical principles for computation, with notable examples including Shor's algorithm for factoring and Grover's search algorithm. Quantum circuits, composed of quantum gates, facilitate these algorithms, allowing operations on qubits that can exist in superposition. Measurement is a critical process in quantum computing, collapsing quantum states to classical results and playing a vital role in extracting information and ensuring algorithmic functionality.

Uploaded by

yt97333
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/ 7

Quantum Algorithms

A quantum algorithm is a step-by-step procedure that uses quantum mechanical principles to


perform calculations on a quantum computer. Quantum algorithms are characterized by their
use of superposition or entanglement, and they are always reversible.

Classes of Quantum Algorithms


1. Shor's Quantum Fourier Transform Algorithms
 Provides exponential speedup over classical algorithms
 Key Applications:
o Solving factoring problems
o Solving discrete logarithm problems
o Breaking cryptosystems (e.g., RSA)
o Addressing hidden subgroup problems
2. Grover's Quantum Search Algorithms
 Provides quadratic speedup over classical algorithms
 Versatile Applications:
o Extracting statistics from unordered datasets
o Speeding up search in NP problems
o Searching cryptosystem keys
o Finding minimal elements in datasets
Quantum Counting Algorithm
 A clever combination of quantum searching and Fourier transform algorithms
 Used to estimate the number of solutions to a search problem more efficiently than
classical computers

Quantum circuits
Quantum algorithms are most commonly described by a quantum circuit, of which a simple
example is shown in the figure below.

A quantum circuit is a model for quantum computation, where the steps to solve the problem
are quantum gates performed on one or more qubits. A quantum gate is an operation applied to
a qubit that changes the quantum state of the qubit. Quantum gates can be divided into single-
qubit gates and two-qubit gates, depending on the number of qubits on which they are applied
at the same time. Three-qubit gates and other multi-qubit gates can also be defined. A quantum
circuit is concluded with a measurement on one or more qubits.

Example Code for Quantum Circuit:


1. NOT Gate
from qiskit import QuantumCircuit, transpile
qc = QuantumCircuit(2)
qc.qubits
[Qubit(QuantumRegister(2, 'q'), 0), Qubit(QuantumRegister(2, 'q'), 1)]
qc.x(0) # Add X-gate to qubit 0
qc.data

[CircuitInstruction(operation=Instruction(name='x', num_qubits=1, num_clbits=0,


params=[]), qubits=(Qubit(QuantumRegister(2, 'q'), 0),), clbits=())]

qc.draw("mpl")

2. CNOT Gate:

Single Qubit Operations:


A single qubit is represented as a vector ∣ψ⟩=a∣0⟩+b∣1⟩, where ∣a∣2+∣b∣2=1.
 Operations are implemented using 2×2 unitary matrices:
o Pauli Gates: X,Y,Z for quantum state manipulation.
0 1 
The single-qubit Pauli-X gate (σ). X   
1 0 
 0 i 
The single-qubit Pauli-Y gate (σy). Y   
i 0 
1 0 
The single-qubit Pauli-Z gate (σz). Z   .
0 1
o Hadamard Gate (H): Creates superposition states. This gate is a pi rotation
about the X+Z axis, and has the effect of changing computation basis from ∣0⟩,
1 1 1 
∣1⟩ to ∣+⟩, ∣−⟩ and vice-versa. H   
2 1 1
o Phase Gates (S, T): Introduce phase shifts to states.
S gate: Single qubit S gate (Z**0.5).
It induces a π/2 phase, and is sometimes called the P gate (phase).
1 0
S 
0 i 
and T Gate: Single qubit T gate (Z**0.25).
It induces a π/4 phase, and is sometimes called the pi/8 gate (because of how
the RZ(pi/4) matrix looks like).
1 0 
T  i / 4 
0 e 
o Rotation Gates: Rotate the Bloch Sphere along axes:
RXGate: Single-qubit rotation about the X axis.

RYGate: Single-qubit rotation about the Y axis.

RZGate: Single-qubit rotation about the Z axis.

1 1  i 1  i 
SXGate: The single-qubit Sqrt(X) gate ( X ). X   
2 1  i 1  i 
SwapGate: The SWAP gate is two-qubit operation. Expressed in basis states, the SWAP gate
swaps the state of the two qubits involved in the operation.
1 0 0 0 
0 0 1 0
SWAP   
0 1 0 0
 
0 0 0 1 
Universal Quantum Gates:
A small set of gates is sufficient to approximate any quantum operation. A Universal Gate Set
refers to a collection of quantum gates that can be used to approximate any unitary
transformation on a quantum computer to an arbitrary degree of accuracy. The most common
universal gate set includes single-qubit rotations and a specific two-qubit entangling gate, such
as the Controlled-NOT (CNOT) gate. Single-qubit rotations can be represented by gates like
the Pauli-X, Y, and Z gates, and the Hadamard gate. Together with the CNOT gate, these form
a complete set that can be used to build any quantum circuit.

UGate: The U gate is a gate that does a rotation around the Bloch sphere with 3 Euler angles.
The three angles used to perform the rotations are θ,λ, and φ.
┌──────────┐
q_0: ┤ U(ϴ,φ,λ) ├
└──────────┘

Single-qubit gates can be decomposed as: U=eiαRz(β)Ry(γ)Rz(δ).

use a U gate to create a Hadamard gate:

Controlled Operations
Controlled operations conditionally apply a unitary transformation U on a target qubit based
on the state of a control qubit.
 Controlled-NOT (CNOT): Flips the target qubit if the control qubit is ∣1⟩.
The CNOT gate is two-qubit operation, where the first qubit is usually referred to as
the control qubit and the second qubit as the target qubit.
Case 1: The CNOT gate flips the second qubit (the target qubit) if and only if the
first qubit (the control qubit) is 1
Case 2: The CNOT leaves the target qubit unchanged when the control qubit is
in state 0
Controlled-U: Generalizes this to apply U conditionally, a foundational component in quantum
circuits. This is a controlled version of the U gate (generic single qubit rotation), including a
possible global phase eiγ of the U gate.
q_0: ──────■──────
┌─────┴──────┐
q_1: ┤ U(ϴ,φ,λ,γ) ├
└────────────┘
CU  , ,  ,   q0, q1  I ∣0  0∣ei U  , ,   ∣1  1∣
1 0 0 0 
 
 0 ei cos    0 ei (   ) sin   ) 
 2 2 
 
0 0 1 0 
 i (   )       
0 e sin   0 ei (    )cos   
 2 2
Controlled-U1 gate: This is a diagonal and symmetric gate that induces a phase on the state
of the target qubit, depending on the control state.
1 0 0 0
0 1 0 0 
CU 1   I ∣0  0∣U 1∣1  1∣ 
0 0 1 0
 
0 0 0 ei 

Controlled-U3 gate (3-parameter two-qubit gate): This is a controlled version of the U3


gate (generic single qubit rotation). It is restricted to 3 parameters, and so cannot cover generic
two-qubit controlled gates).
CU3(θ,ϕ,λ)=CU(θ,ϕ,λ,0)
1 0 0 0 
 
0    
cos   0 ei sin   
CU3(θ,ϕ,λ) q0,q1=I⊗∣0⟩⟨0∣+U3(θ,ϕ,λ)⊗∣1⟩⟨1∣ =  2 2 
 
0 0 1 0 
    
 0 e sin   0 e
i i (   )
cos   
 2  2 
3. Toffoli Gate (CCNOT): a Toffoli gate is a type of gate that acts on three qubits: two
control qubits, which affect the state of a third, target qubit.
1 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0 

0 0 1 0 0 0 0 0
 
0 0 0 1 0 0 0 0
Toffoli   . CCXq0,q1,q2 = I⊗I⊗∣0⟩⟨0∣+CX⊗∣1⟩⟨1∣
0 0 0 0 1 0 0 0
 
0 0 0 0 0 1 0 0
0 0 0 0 0 0 0 1
 
0 0 0 0 0 0 1 0 

Measurement
Measurement collapses the quantum state into a classical result. n quantum computing,
measurement is acritical process that significantly differs from its classical counterpart. It does
not merely read a value but plays a pivotal role in determining the states of qubits, the
fundamental units of quantum information. Qubits can exist in a state of superposition,
embodying probabilities of being 0 or 1, unlike classical bits which are strictly one or the other.
When a qubit is measured, its wavefunction—which encodes the probabilities of its possible
states—collapses to a definite state of either 0 or 1, influenced by the probabilities established
prior to measurement. This collapse is both fundamental and irreversible; once a measurement
is made, the superposed state and the information it held are lost. The outcomes of
measurements are inherently probabilistic, with repeated measurements of the same qubit
yielding results consistent with those probabilities.
Quantum measurements can be categorized as:
 Full system measurements, in which all qubits are measured at once to capture the final
output.
 Mid-circuit measurements, during computational processes, which enhance algorithmic
capabilities by enabling operations conditional to these measurements.
 Partial measurements, which measure specific qubits, typically ancilla qubits used for
error correction, which helps identify errors without disrupting the data qubits.

Projective Measurement:
 Measures in the computational basis {∣0⟩,∣1⟩.
 Probability: P(0)=∣⟨0∣ψ⟩∣2, P(1)=∣⟨1∣ψ⟩∣2.
Deferred Measurement Principle:
 Intermediate measurements can be deferred to the end by replacing classical
conditioning with quantum gates
Principle of deferred measurement: Measurements can always be moved from an intermediate
stage of a quantum circuit to the end of the circuit; if the measurement results are used at any
stage of the circuit then the classically controlled operations can be replaced by conditional
quantum operations.
Often, quantum measurements are performed as an intermediate step in a quantum circuit, and
the measurement results are used to conditionally control subsequent quantum gates. However,
such measurements can always be moved to the end of the circuit.

Principle of implicit measurement: Without loss of generality, any unterminated quantum wires
(qubits which are not measured) at the end of a quantum circuit may be assumed to be
measured.
To understand why this is true, imagine you have a quantum circuit containing just two qubits,
and only the first qubit is measured at the end of the circuit. Then the measurement statistics
observed at this time are completely determined by the reduced density matrix of the first qubit.
However, if a measurement had also been performed on the second qubit, then it would be
highly surprising if that measurement could change the statistics of measurement on the first
qubit.

Significance of Measurement:

Extracting Information: Measurement is essential for extracting meaningful information


from quantum computations.

Quantum Algorithms: Many quantum algorithms, such as Shor's algorithm for factoring and
Grover's algorithm for searching, rely on measurements to obtain the final result.
Quantum Teleportation: Measurement plays a crucial role in quantum teleportation, a process
for transmitting quantum information over a distance.

Challenges and Considerations:

Measurement Problem: The act of measurement can disturb the quantum state, potentially
affecting the outcome of the computation.

Measurement Error: Imperfect measurement devices can introduce errors, leading to incorrect
results.

Simulation of Quantum Systems


Quantum computation excels at simulating quantum mechanics:

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy