Important announcement

Dear visitor,

Please note that this OpenCourseWare platform will be replaced at the end of 2026 by a new platform (under the same url ocw.tudelft.nl).

Courses and their contents that are currently available the platform will partly be migrated. URL’s for this content will change and content might be unavailable for some time. In addition, some courses will not be available anymore.

If you are linking to specific courses on this platform (for instance for your students), please take timely measures to avoid problems with access. Possible actions are:

  • Download the materials to your local platform (laptop, server)
  • For educators only (including TU Delft lecturers): Contact us at ocw@tudelft.nl and inform us what course you are using in what context (institute, program, period of use, number of students). We will research (in collaboration with the authors of the course) and decide if we will migrate the course, and if yes, can supply you with a new url.

Thank you.

3.2.4 Encoding functions into unitaries

Course subject(s) Module 3: Quantum Compiling and Quantum Dots

In classical algorithms we use functions to compute desired quantities. We want to be able to do the same in quantum algorithms. We have seen, however, that quantum circuits rely on a universal set of quantum gates to carry out processes. How can we encode functions in quantum gates?

We start reviewing a set of classical functions known as Boolean functions. These are functions that map from strings of bits of length m to strings of bits of length n.

f:{0,1}m→{0,1}n

Two examples are:

  • NOT(x) = x XOR 1

  • AND(a,b) = ab mod 2

The quantum counterpart of a classical NOT can be achieved using an X gate. However, the task is not that simple and a bigger set of qubits is usually required.

In general, one can encode Boolean functions into unitaries by increasing the number of qubits to n+m, where n and m correspond to the length of the bits defined above for f. This way a unitary gate U can be defined acting on n+m qubits as:

where

|f(x)+y⟩=|f(x)n⊕yn⟩…|f(x)1⊕y1⟩

Using this we can encode a counterpart for the AND function!

The reason for this increase in qubits is because unlike classical gates, quantum gates must be unitary. Recall that a unitary gate is any matrix U such that UU†=I  holds. Importantly, this means that quantum gates are invertible, which intuitively means that we can figure out the input to a function by looking at its output. By contrast, not all classical functions are invertible, because a AND 0 = 0 regardless of whether a = 0 or a = 1. If we want to make a classical function quantum, we first must make it invertible (also known as reversible), and this can easily be done by passing the input along with the output, i.e.

f(|x⟩|0⟩)=f(|x⟩|f(x)⟩)

so that we can always deduce the input from the output, because the input is part of the output!

Creative Commons License
Fundamentals of Quantum Information by TU Delft OpenCourseWare is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Based on a work at https://online-learning.tudelft.nl/courses/fundamentals-of-quantum-information/ /
Back to top
[sg_popup id=6]