Unit 2 Notes
Unit 2 Notes
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.
qc.draw("mpl")
2. CNOT Gate:
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(ϴ,φ,λ) ├
└──────────┘
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
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:
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.
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.