Lecture Notes on Quantum Computation: Unitary Operations and Quantum Gates
Introduction
In this lecture, we will explore the fundamental model of quantum computation. We begin by considering quantum algorithms as sequences of unitary transformations, representing the basic computational steps. We will discuss why defining complexity solely by the number of unitary operations is insufficient and introduce the necessity of a finite set of quantum gates for a realistic computational model. This leads to the concept of universal quantum computation, where a finite set of gates can approximate any unitary operation.
We will then examine the relationship between classical and quantum computation, focusing on how classical Boolean functions can be embedded into reversible quantum operations. This involves representing classical computations using unitary matrices and quantum circuits. Finally, we will touch upon the concept of uniform families of quantum circuits and address the apparent contradiction between classical fan-out and the quantum no-cloning theorem. This lecture sets the stage for understanding the construction of quantum algorithms from a finite set of elementary quantum gates.
Quantum Computation as Unitary Operations
Quantum Algorithms as Unitary Sequences
Quantum computation is defined by the evolution of quantum states through a sequence of unitary transformations. Each computational step in a quantum algorithm corresponds to the application of a unitary operator.
Let \(\left|{\psi_i}\right\rangle\) represent the quantum state after the \(i\)-th step. If \(U_{i+1}\) is the unitary operation for the \((i+1)\)-th step, the state evolves as: \[\left|{\psi_{i+1}}\right\rangle = U_{i+1} \left|{\psi_i}\right\rangle\] For an algorithm with \(k\) steps, starting from an initial state \(\left|{\psi_0}\right\rangle\), the final state \(\left|{\psi_k}\right\rangle\) is given by the successive application of unitary operators \(U_1, U_2, \ldots, U_k\): \[\left|{\psi_k}\right\rangle = U_k U_{k-1} \cdots U_1 \left|{\psi_0}\right\rangle\]
Complexity: Beyond Counting Unitary Operations
A simplistic measure of quantum algorithm complexity might be the number of unitary operations. An algorithm with \(k\) sequential unitary operations could be naively considered to have complexity \(k\).
However, this approach is inadequate. Consider two algorithms: one applying two unitaries \(U_1\) and \(U_2\) sequentially, and another applying a single unitary \(U = U_2 U_1\). While the first appears to have complexity two and the second complexity one, this is misleading.
Composition of Unitary Operations
The product of unitary matrices is itself a unitary matrix. Thus, a sequence of unitary operations \(\{U_1, U_2, \ldots, U_k\}\) is equivalent to a single unitary operation \(U = U_k U_{k-1} \cdots U_1\). This suggests that merely counting unitary operations is not a meaningful measure of computational complexity.
The crucial point is that different unitary operations possess varying levels of implementation difficulty. Executing a complex unitary operation in a single step can be significantly more challenging than performing a sequence of simpler unitary operations. Therefore, a practical model of quantum computation must consider the constraints on implementable unitary operations, leading to the concept of quantum gates.
Limitations of Arbitrary Unitary Operations
Defining a computational model based on arbitrary unitary operations is fundamentally problematic for physical implementation. The set of all possible unitary matrices, even for a fixed number of qubits, is infinite. It is impossible to build a machine capable of directly implementing any arbitrary unitary transformation.
To create a realistic and physically realizable model, we must restrict ourselves to a finite set of elementary unitary operations, known as quantum gates. These gates serve as the fundamental building blocks for constructing quantum algorithms, analogous to classical logic gates in digital circuits. The following sections will introduce the concept of quantum gates and their role in defining a practical quantum computational model.
Quantum Computational Model: Quantum Gates and Circuits
The Necessity of Quantum Gates
While quantum computation is fundamentally described by unitary transformations, the space of all possible unitary operations is infinite, even for a single qubit. Implementing arbitrary unitary operations directly in a physical device is therefore impossible. To create a practical and physically realizable model of quantum computation, we must restrict ourselves to a finite set of elementary unitary operations, known as quantum gates.
Analogous to classical computation, where complex logic circuits are constructed from a finite set of basic gates like AND, OR, and NOT, quantum algorithms are built from a finite set of quantum gates. These gates act as the fundamental building blocks for performing quantum computations.
Universal Quantum Gate Sets
A set of quantum gates is called universal if any arbitrary unitary operation, on any number of qubits, can be approximated to any desired degree of accuracy by a quantum circuit composed solely of gates from this set. The concept of universality is essential because it ensures that with a limited set of basic operations, we can, in principle, perform any quantum computation.
A set of quantum gates \(G\) is universal if for any unitary operator \(U\) and any \(\epsilon > 0\), there exists a quantum circuit composed of gates from \(G\), denoted as \(C_G\), such that the operator \(U_{C_G}\) implemented by \(C_G\) approximates \(U\) with precision \(\epsilon\), i.e., \(\|U - U_{C_G}\| < \epsilon\).
Quantum Circuits
A quantum circuit is a sequence of quantum gates applied to a set of qubits. It is the quantum analogue of a classical logic circuit. Quantum algorithms are represented as quantum circuits, where the computation proceeds by applying a sequence of gates from a chosen universal set to an initial quantum state.
Compilation and Approximation
Implementing a specific unitary operation \(U\) in a quantum algorithm using a universal gate set \(G\) requires a process called compilation. Compilation involves decomposing \(U\) into a sequence of gates from \(G\). This means finding a sequence of gates \(G_{i_1}, G_{i_2}, \ldots, G_{i_l} \in G\) such that their product approximates \(U\): \[U \approx U_{compiled} = G_{i_l} \cdots G_{i_2} G_{i_1}\] In general, exact decomposition is not always possible, and we often rely on approximations. The accuracy of the approximation improves as the length of the gate sequence increases. The complexity of implementing a unitary operation is thus quantified by the minimum number of gates from a universal set required to approximate it to a given precision.
Complexity in Quantum Circuits
The complexity of a quantum algorithm, when implemented as a quantum circuit, is typically measured by the number of gates used in the circuit. This gate count provides a more realistic measure of the resources required for quantum computation compared to simply counting high-level unitary operations. Algorithms with fewer gates are generally considered more efficient. The choice of universal gate set can influence the gate count for implementing a particular algorithm.
When analyzing the complexity of a quantum algorithm, it is crucial to consider the number of elementary gates from a universal set required to implement the algorithm. This gate count is a more accurate reflection of the algorithm’s resource requirements than simply counting abstract unitary operations.
Classical Computation and Quantum Embedding
Classical Boolean Circuits and Irreversibility
Classical computation is fundamentally based on Boolean functions, which are implemented using circuits composed of gates such as AND, OR, and NOT. These circuits process binary inputs to produce binary outputs, performing logical operations. However, many classical logic gates, like AND and OR, are inherently irreversible. For example, knowing the output of an AND gate is 0 does not uniquely determine the inputs; they could be (0, 0), (0, 1), or (1, 0).
Reversible Computation as a Bridge to Quantum
Quantum computation, in contrast, is intrinsically reversible. This reversibility stems from the fact that quantum evolution is described by unitary operators, which are always invertible. To connect classical computation with the quantum framework, we must first consider reversible classical computation.
A classical computation is deemed reversible if its input can be uniquely determined from its output. This implies that reversible computations must be described by bijective functions, meaning they are one-to-one and onto. Irreversible gates like AND and OR must be transformed into reversible counterparts to be embedded within a quantum circuit.
Embedding Irreversible Functions into Reversible Functions
To represent an irreversible Boolean function \(f(x_1, \ldots, x_n)\) in a reversible manner, we can embed it into a larger reversible function \(F\). A standard technique is to preserve the input and append the result of the function using an auxiliary bit. Given a Boolean function \(f(x_1, \ldots, x_n)\), we define a reversible function \(F(x_1, \ldots, x_n, y)\) as: \[F(x_1, \ldots, x_n, y) = (x_1, \ldots, x_n, y \oplus f(x_1, \ldots, x_n))\] where \(\oplus\) denotes the XOR (exclusive OR) operation, and \(y\) is an ancilla bit, typically initialized to 0. The first \(n\) output bits are identical to the input bits \(x_1, \ldots, x_n\), ensuring that the transformation is reversible because the original input is retained. The \((n+1)\)-th output bit is the XOR of the initial value of \(y\) and the result of \(f(x_1, \ldots, x_n)\).
Example: Reversible AND Gate
Consider the irreversible AND function, \(f(x_1, x_2) = x_1 \land x_2\). We construct its reversible counterpart as \(F(x_1, x_2, y) = (x_1, x_2, y \oplus (x_1 \land x_2))\). Let’s examine its operation on all possible 3-bit inputs \((x_1, x_2, y)\):
\(F(0, 0, 0) = (0, 0, 0 \oplus (0 \land 0)) = (0, 0, 0)\)
\(F(0, 0, 1) = (0, 0, 1 \oplus (0 \land 0)) = (0, 0, 1)\)
\(F(0, 1, 0) = (0, 1, 0 \oplus (0 \land 1)) = (0, 1, 0)\)
\(F(0, 1, 1) = (0, 1, 1 \oplus (0 \land 1)) = (0, 1, 1)\)
\(F(1, 0, 0) = (1, 0, 0 \oplus (1 \land 0)) = (1, 0, 0)\)
\(F(1, 0, 1) = (1, 0, 1 \oplus (1 \land 0)) = (1, 0, 1)\)
\(F(1, 1, 0) = (1, 1, 0 \oplus (1 \land 1)) = (1, 1, 1)\)
\(F(1, 1, 1) = (1, 1, 1 \oplus (1 \land 1)) = (1, 1, 0)\)
When the ancilla bit \(y\) is initialized to 0, the last output bit becomes \(0 \oplus (x_1 \land x_2) = x_1 \land x_2\), effectively computing the AND function while preserving reversibility.
Unitary Matrix Representation of Reversible Gates
Crucially, any reversible Boolean function can be represented by a unitary matrix. A reversible Boolean function on \(n\) bits is essentially a permutation of the \(2^n\) possible input bit strings. We can map each \(n\)-bit input string to a computational basis state in an \(n\)-qubit Hilbert space. Since a reversible function permutes these input states to output states, and both sets of states form orthonormal bases, this permutation corresponds to a unitary transformation.
For the reversible AND gate \(F(x_1, x_2, y) = (x_1, x_2, y \oplus (x_1 \land x_2))\), we can construct a unitary matrix that acts on the computational basis states \(\{\left|{000}\right\rangle, \left|{001}\right\rangle, \left|{010}\right\rangle, \left|{011}\right\rangle, \left|{100}\right\rangle, \left|{101}\right\rangle, \left|{110}\right\rangle, \left|{111}\right\rangle\}\) according to the function \(F\). For instance, \(F(1, 1, 0) = (1, 1, 1)\) corresponds to the transformation \(\left|{110}\right\rangle \rightarrow \left|{111}\right\rangle\). The unitary matrix representing this reversible AND gate is related to the Toffoli gate (controlled-controlled-NOT gate). In general, reversible classical circuits can be translated into quantum circuits composed of unitary gates, allowing for the embedding of classical computations within the quantum model.
Note that to achieve reversibility, we often need to retain the input bits as part of the output. This can lead to an increase in the number of qubits required compared to irreversible classical computation, where intermediate results and inputs can be discarded. This trade-off between reversibility and space complexity is a fundamental consideration in reversible and quantum computing.
Universality in Quantum Computation
Universal Gate Sets: Approximating Any Quantum Operation
A cornerstone of quantum computation is the concept of universality. A set of quantum gates is deemed universal if it can approximate any arbitrary unitary operation to an arbitrary degree of precision. This is crucial because it implies that with a finite set of basic gates, we can perform any quantum computation, in principle, by constructing sufficiently long sequences of these gates.
Theorem 1 (Universality of Single-Qubit Gates and CNOT). The set consisting of all single-qubit gates, together with the CNOT gate, is universal. This means any unitary operation on any number of qubits can be approximated to arbitrary precision by a quantum circuit composed of single-qubit gates and CNOT gates.
This theorem underscores the power of combining single-qubit manipulations with a two-qubit entangling gate like CNOT. Single-qubit gates provide complete control over individual qubits, allowing for any rotation in the Bloch sphere. The CNOT gate introduces entanglement, a uniquely quantum resource that is essential for achieving computational capabilities beyond those of classical computers. The combination allows for universal quantum computation.
Minimal Universal Gate Set: H, T, S, and CNOT
While the set of all single-qubit gates and CNOT is universal, it is still infinite, which is not ideal for practical implementation. Remarkably, universality can be achieved with a finite set of gates. A well-known minimal universal gate set, allowing for approximation of any quantum circuit, is comprised of the CNOT gate and a small set of single-qubit gates: {H, T, S}. This set includes:
Hadamard gate (H): \[H = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}\] The Hadamard gate creates superposition states from computational basis states.
\(\pi/8\) gate (T): \[T = \begin{pmatrix} 1 & 0 \\ 0 & e^{i\pi/4} \end{pmatrix} = \begin{pmatrix} 1 & 0 \\ 0 & e^{i\pi/4} \end{pmatrix}\] Also known as the T gate, it introduces a phase of \(\pi/4\).
Phase gate (S): \[S = \begin{pmatrix} 1 & 0 \\ 0 & i \end{pmatrix}\] The S gate introduces a phase of \(\pi/2\).
Controlled-NOT gate (CNOT): \[CNOT = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \end{pmatrix}\] The CNOT gate entangles qubits and is essential for universal quantum computation.
The set of gates {H, T, S, CNOT} forms a minimal universal gate set. Any quantum circuit can be approximated to arbitrary precision using only these gates.
Theorem 2 (Approximation with H, T, S, and CNOT). Any quantum circuit can be approximated to arbitrary precision using only Hadamard (H), \(\pi/8\) (T), Phase (S), and Controlled-NOT (CNOT) gates.
This result is of paramount importance for practical quantum computing. It demonstrates that we do not need an infinite set of gates to perform arbitrary quantum computations. Instead, we can rely on a small, finite set of gates like {H, T, S, CNOT} to construct any quantum algorithm, albeit potentially requiring longer sequences of gates for complex operations. This minimal set provides a practical foundation for building and programming quantum computers.
Classical Fan-out and Quantum No-Cloning: Reconciling Copying in Quantum Circuits
Classical Fan-out: Replication of Classical Information
In classical digital circuits, the fan-out operation is a fundamental and ubiquitous operation. It allows for the duplication of a classical bit’s value. If we have a signal representing a bit \(x\), fan-out enables us to create multiple copies of this signal, all carrying the same value \(x\). These copies can then be used as inputs to different parts of a classical circuit, allowing for the reuse and distribution of classical information. This copying operation is essential for constructing complex classical logic circuits.
Quantum No-Cloning Theorem: Limits on Quantum Copying
The quantum no-cloning theorem is a fundamental principle in quantum mechanics that imposes a significant restriction on the manipulation of quantum information. It states that it is impossible to create a perfect copy of an arbitrary, unknown quantum state.
There exists no unitary operator \(U\) that can duplicate an arbitrary quantum state. More formally, there is no unitary operator \(U\) that, for any arbitrary quantum state \(\left|{\psi}\right\rangle\), performs the transformation: \[U (\left|{\psi}\right\rangle \otimes \left|{0}\right\rangle) = \left|{\psi}\right\rangle \otimes \left|{\psi}\right\rangle\] Description: This theorem states the fundamental limitation in quantum mechanics that arbitrary unknown quantum states cannot be perfectly duplicated by any unitary operation.
This theorem has profound implications for quantum computation and information processing. It means we cannot simply copy an unknown quantum state like we copy classical bits. Any attempt to copy an arbitrary quantum state using a unitary operation will inevitably distort the state or fail for some input states.
Reconciling Fan-out with No-Cloning: Copying Classical Bits in Quantum Circuits
At first glance, the no-cloning theorem appears to contradict the possibility of implementing classical fan-out within quantum circuits. If we cannot copy arbitrary quantum states, how can we replicate classical bits, which can also be represented as quantum states (\(\left|{0}\right\rangle\) and \(\left|{1}\right\rangle\))?
The resolution to this apparent paradox lies in the crucial distinction that the no-cloning theorem applies to arbitrary unknown quantum states, particularly superpositions. However, for classical bits, represented by the computational basis states \(\left|{0}\right\rangle\) and \(\left|{1}\right\rangle\), we can indeed perform a copying operation within the constraints of quantum mechanics.
Consider the Controlled-NOT (CNOT) gate. If we use the control qubit to hold the bit we want to copy and initialize the target qubit to \(\left|{0}\right\rangle\), the CNOT gate precisely implements the classical fan-out operation for classical input bits:
Copying \(\left|{0}\right\rangle\): \[CNOT(\left|{0}\right\rangle \otimes \left|{0}\right\rangle) = \left|{0}\right\rangle \otimes \left|{0}\right\rangle\] Input \(\left|{0}\right\rangle\) is copied to \(\left|{0}\right\rangle\).
Copying \(\left|{1}\right\rangle\): \[CNOT(\left|{1}\right\rangle \otimes \left|{0}\right\rangle) = \left|{1}\right\rangle \otimes \left|{1}\right\rangle\] Input \(\left|{1}\right\rangle\) is copied to \(\left|{1}\right\rangle\).
In both cases, the initial state of the control qubit is preserved, and its value is copied to the target qubit. Thus, for classical basis states, the CNOT gate acts as a classical fan-out gate, effectively copying the classical bit.
The quantum no-cloning theorem does not prevent copying of classical bits (computational basis states) in quantum circuits. By initializing a target qubit to \(\left|{0}\right\rangle\) and using a gate like CNOT, we can implement the classical fan-out operation for classical information within a quantum framework. However, this operation is limited to classical basis states and does not generalize to arbitrary superposition states, consistent with the no-cloning theorem.
Exercise: Constructing a Unitary Gate for Copying Classical Bits
Task: Design and Verify the Unitary Gate
Your task is to design a unitary gate, denoted as \(U_{copy}\), that operates on two qubits. This gate should take two qubits as input, where the first qubit is intended to be the source bit for copying, and the second qubit is initialized to the state \(\left|{0}\right\rangle\). The gate must perform the classical bit copying operation, such that for classical input bits \(x \in \{0, 1\}\), the following transformation occurs: \[U_{copy}(\left|{x}\right\rangle \otimes \left|{0}\right\rangle) = \left|{x}\right\rangle \otimes \left|{x}\right\rangle\] Specifically, you need to:
Determine the Unitary Matrix: Find the \(4 \times 4\) unitary matrix representation of \(U_{copy}\) in the computational basis \(\{\left|{00}\right\rangle, \left|{01}\right\rangle, \left|{10}\right\rangle, \left|{11}\right\rangle\}\).
Verify Unitarity: Ensure that the matrix you derive is indeed unitary, i.e., \(U_{copy} U_{copy}^\dagger = U_{copy}^\dagger U_{copy} = I\), where \(I\) is the identity matrix and \(U_{copy}^\dagger\) is the conjugate transpose of \(U_{copy}\).
Recognize the Gate: Identify if the unitary gate you have constructed is a known quantum gate.
Hint: The CNOT Gate
Consider the Controlled-NOT (CNOT) gate. Recall its action on the computational basis states. Think about how the CNOT gate behaves when the target qubit is initialized to \(\left|{0}\right\rangle\) and how this relates to the classical copy operation for the control qubit. The CNOT gate’s matrix representation is given by: \[CNOT = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \end{pmatrix}\]
Importance of Initializing the Target Bit
It is crucial to note that for the \(U_{copy}\) gate (which you should find to be the CNOT gate) to correctly perform classical bit copying, the second qubit (the target qubit) must be initialized to \(\left|{0}\right\rangle\). If the target qubit is not initialized to \(\left|{0}\right\rangle\), the operation will not generally correspond to a classical copy. Furthermore, attempting to use this gate to copy arbitrary superposition states will not result in valid cloning, consistent with the quantum no-cloning theorem. This exercise highlights that while we can copy classical information within a quantum framework, the no-cloning theorem fundamentally restricts the copying of arbitrary quantum states.
Expected Outcome
You should find that the unitary gate \(U_{copy}\) that performs the classical bit copying operation as described is indeed the CNOT gate. By working through this exercise, you will solidify your understanding of:
How quantum gates can implement classical operations.
The matrix representation of quantum gates.
The specific behavior of the CNOT gate.
The subtle interplay between classical fan-out and the quantum no-cloning theorem.
Conclusion
In this lecture, we have established the foundational model of quantum computation based on sequences of unitary operations. We addressed the necessity of moving from abstract unitary operations to a practical model using a finite set of quantum gates, emphasizing the concept of universal gate sets. We explored how classical computations can be embedded within the quantum framework through reversible Boolean functions and their unitary representations. Furthermore, we resolved the apparent conflict between classical fan-out and the quantum no-cloning theorem, demonstrating that classical bits can be copied in quantum circuits under specific conditions, particularly with initialized qubits. Finally, we introduced an exercise focused on designing a unitary gate for copying classical bits, which serves to reinforce these concepts. Moving forward, we will build upon these foundations by exploring specific quantum algorithms and delving deeper into the properties and applications of quantum gates in constructing efficient quantum circuits.