Keywords

1 Introduction

Quantum computing studies algorithms and hardware for performing computation using systems that exploit quantum physics. In the gate model of quantum computing [6], the information storage and processing are done using tools from linear algebra. The information is stored in a quantum register composed of quantum bits. Each quantum bit is represented as a unit-norm vector in a two-dimensional complex Hilbert space. A multi-qubit register is modeled as a tensor product space arising from the individual quantum bits. The information in the quantum register can evolve in time according to invertible, inner product-preserving transformations, modeled mathematically in the gate model of quantum computing as unitary operators. The information in the quantum register can be accessed, to some extent, through quantum measurement, typically modeled as a randomized projection on vectors from the computational basis of the Hilbert space.

The key promise of quantum computing is to achieve speedup compared to classical computers [10], leading to faster algorithms in many domains, including linear algebra [5], database search [4], or machine learning [1, 3, 9]. The study of quantum algorithms can also lead to more efficient classical methods [7, 11].

One of the first, didactic example of a problem for which a quantum computer abstracted using the gate model shows speedup is a promise problem known as the Deutsch-Jozsa problem [2]. Assume that you are given a Boolean function on n-bits: \(f: \left\{ 0,1\right\} ^n \rightarrow \left\{ 0,1\right\} \) with a black-box access. That is, on a classical computer, you can call it on any bit string and see the result, but you cannot decompile it. On a quantum computer, you have access to an oracle, a unitary transformation \(U_f\) that performs the function using some form of input and output encoding.

In the Deutsch-Jozsa problem, we are promised that the function is of one of two types

  • constant, that is, always returns 0, or always returns 1,

  • balanced, that is, for half of the \(2^n\) possible inputs it returns 0, for the remaining \(2^{n-1}\) inputs, it returns 1.

The task is to use the ability to execute f(x) for any x to figure out if f is constant, or balanced.

Let \(N=2^n\) be the number of distinct inputs x. On a classical computer, we need at least two calls to f to be able to decide if the function is constant or balanced – in the most optimistic scenario when first call returns 0 and the second returns 1, we know the answer after these two calls to f. But if we see zeros all the time, we need \(N/2+1\) calls to have the answer – if value number \(N/2+1\) is also 0, it is a constant function, if the value is 1, it is a balanced function. Thus, pessimistically, we need \(O\left( {N}\right) =O\left( {2^n}\right) \) calls to f to solve the Deutsch-Jozsa problem on a classical computer. It is well-known that on a quantum computer, we can solve the Deutsch-Jozsa problem much quicker, using just one call to the unitary oracle \(U_f\).

The Deutsch-Jozsa algorithm has been recently generalized to include discrimination between balanced functions and almost-constant functions [8], with the query complexity increasing with the distance from a constant function. Here, we show that it can be generalized in a different way, to a family of promise problems involving discrimination between a specific constant function \(f_l\), for example an all-zero function, and a family of functions \(f_k\) that have fixed level of imbalance, that is, have exactly k outputs equal to one, as long as \(k\ge N/2\). We show that this problem can be solved with only one query to the function oracle.

2 Quantum Deutsch-Jozsa Algorithm

To define the Deutsch-Jozsa algorithm, we need to have ability to evaluate Boolean functions using unitary operators, and the ability to use Boolean function evaluation to provide the answer whether the function is constant or balanced.

2.1 Quantum Boolean Function Evaluation

A Boolean function on n bits returning an m bit string is a function \(f: \left\{ 0,1\right\} ^n \rightarrow \left\{ 0,1\right\} ^m\). Consider \(n=m\), and a function \(f(x)=NOT x\) that negates all bits of x. It is a permutation - a one-to-one mapping - on the set \(\left\{ 0,1\right\} ^n\). Now consider a function \(f_y(x) = y\) XOR \(x = y \oplus x\), where \(\oplus \) is a modulo-two addition. If a bit in y is 0, the corresponding bit in x is not changed – an identity mapping, a particular form of permutation, on those bits. If a bit in y is 1, the corresponding bit in x is negated - a permutation on those bits. That is, for arbitrary n-bit y, \(x \rightarrow y \oplus x\) is a permutation on the set \(\left\{ 0,1\right\} ^n\) - vectors for all possible x are mutually orthogonal, same as are. Then, a linear mapping will produce when we perform . Since \(y \oplus x\) is a permutation on \(\left\{ 0,1\right\} ^n\), it is a one-to-one mapping. It also preserves the inner product. The inner product among basis vectors , \(x \in \left\{ 0,1\right\} ^n\) is null, and the inner products among the outputs are also null. This mapping is inner-product-preserving, and thus compatible with the rules of quantum mechanics.

Not all functions \(f: \left\{ 0,1\right\} ^n \rightarrow \left\{ 0,1\right\} ^n\) are permutations; a constant function that always returns all bits set to 0 is not a permutation. Consider an arbitrary function \(f: \left\{ 0,1\right\} ^n \rightarrow \left\{ 0,1\right\} ^m\). Let us have an \(n+m\)-qubit system \(\mathcal {H}= (\mathbb {C}^2)^n \otimes (\mathbb {C}^2)^m\). Consider a state , where is one of the \(2^n\) basis states of \((\mathbb {C}^2)^n\), and is one of the \(2^m\) basis states of \((\mathbb {C}^2)^m\). We wish to have a linear transformation \(U_f\), a unitary operator, that takes the vector, and produces, on output, a state , in particular, for \(z=0^m\), it produces . For each x, \(z \rightarrow z \oplus f(x)\) is a permutation on the basis states of \((\mathbb {C}^2)^m\), and thus is a permutation on the basis states of \(\mathcal {H}\). Hence,

which performs , is a one-to-one mapping that preserves the inner product – and thus can describe unitary evolution of a quantum system.

Consider \(m=1\), arbitrary n, and an \(n+1\)-qubit system in an arbitrary state of the form . Let \(E=HX\) be a Pauli X gate followed by Hadamard gate; it transforms to and to , and is Hermitian. Let \(E_n= I^{\otimes n} \otimes E\) denote application of E to the last, \(n+1\) qubit. We have

We obtained the result by seeing that differs by a sign depending on the value of f(x); if \(f(x)=0\), it is , if \(f(x)=1\) it is . Then we used phase kickback to the top qubits. Value of \(f(x)=1\) is reflected in change of phase of by \(\pi \), whereas \(f(x)=0\) results in no change.

We now see two ways of representing the result of applying f(x) as encoded by :

The first option is to encode the result in the state of the last qubit, the second is to encode it in the phase of the input qubits.

2.2 The Deutsch-Jozsa Problem

Consider four query states for arbitrary binary uv. Two are simple, and , and correspond to two possible one-bit constant functions. Two other are entangled, and , and correspond to the two one-bit balanced functions.

If someone prepares a two-qubit system in one of the four query states, can we distinguish whether it is any of these two and , or any of these two and ? We have , that is, it is easy to distinguish from , and from . All other inner products of these four states are equal to . Any unitary transformation has to preserve the dimensionality of the space, and the inner products. Thus, there is no mapping that would map to be orthogonal to or ; same for . If we want to use orthogonality of any member from one group of states to any member from the other group of states to reliably distinguish states from one group from the other, then a group composed of and cannot be reliably distinguished from group consisting of and .

We have seen above two ways of representing the result of applying a binary function f(x) given a state : encoding the result as an additional qubit, or as a phase change of the input qubit. Consider a n-bit binary function f. We can construct a state using Hadamard transform. Then, we can construct a state , and apply our two options of evaluating f quantum mechanically to this \(n+1\)-qubit state. We will get

These two options are not equivalent. The four query states we have seen above can be seen as the first option for \(n=1\) if we equate \(u=f(0)\) and \(v=f(1)\); indeed . We have seen that we cannot use this representation to decide, based on orthogonality, if we got a function that is constant, or that returns equal number of 0’s and 1’s.

On the other hand, consider the second representation, or actually just its first qubit . A constant function will have , while a balanced function will have . We can ignore the global phase, that is, the sign, and we end up with two orthogonal states, for constant and for balanced function. As we can see, while unitary actions after applying the black-box unitary oracle cannot change the distinguishability of states because they must preserve the inner products, differences prior to applying the function oracle can affect our ability to distinguish states.

3 Generalized Deutsch-Jozsa Problem

We show here that the ability to distinguish all-zeros from all-ones that we get from \(U_f =U_f (I^{\otimes n} \otimes I)\) and the ability to distinguish all-zeros and all-ones from a balanced function that we get from \(U_f E_n = U_f (I^{\otimes n} \otimes E)\) are not the only possibilities for quickly solving promise problems involving two groups of binary functions. We can form a class of single-qubit unitary operators A defined by the condition \(|a|^2+|b|^2=1\),

$$\begin{aligned} I=\begin{bmatrix} 1 &{} 0\\ 0&{} 1 \end{bmatrix},\;\;\;\; A=\begin{bmatrix} a &{} -{{b}^{*}}\\ b&{} {{a}^{*}} \end{bmatrix},\;\;\;\; E=\begin{bmatrix} \frac{1}{\sqrt{2}} &{} \frac{1}{\sqrt{2}}\\ -\frac{1}{\sqrt{2}}&{} \frac{1}{\sqrt{2}} \end{bmatrix}, \end{aligned}$$

and observe that unitaries I and E are at the extreme ends of the family, with a spectrum of other operators in between. These operators can each solve a different promise problem of discriminating between two classes of functions.

Consider two functions \(f_l\) and \(f_k\) with the corresponding black-box unitaries \(U_l\) and \(U_k\), and let \(y_j=f_k(j)\) and \(x_j=f_l(j)\). Also, let \(\xi _j =1\) if \(y_j=x_j\) and \(\xi _j =0\) otherwise, and \(\delta _j=1-\xi _j\); we will use \(\varXi \) to denote the number of outputs on which the functions agree, and \(\varDelta \) to denote the Hamming distance between the outputs, that is, the number of outputs that differ; we have \(\varXi +\varDelta =2^n\).

Let \(A_n= I^{\otimes n} \otimes A\) denote application of A to the last, \(n+1\)-st qubit of an \(n+1\)-qubit system. Then, we have

and a similar expression for \(U_l\), with \(y_j\) replaced by \(x_j\).

The inner product of the two states is

where \(\alpha =-2\mathfrak {R}{(a{{b}^{*}})}\). Indeed, we have

The last equality comes from the fact that \((\bar{y_j} \bar{x_j} + x_j y_j )=1\) if and only if \(x_j = y_j\), and \(( x_j \bar{y_j} + y_j \bar{x_j} )=1\) if and only if \(x_j = \bar{y_j}\).

To achieve perfect distinguishability of the resulting states through quantum measurement, which corresponds to having inner product \(h_\varDelta =0\), we need to set a, b such that \(\alpha =-2\mathfrak {R}{(a{{b}^{*}})}\) becomes \(\alpha = \varXi / \varDelta = 2^n/\varDelta - 1\). Since \(\alpha \in [-1,1]\) for any two unit-norm quantum states, we can do that as long as \(\varDelta \ge \frac{1}{2} 2^n\); the promised functions \(f_k\) and \(f_l\) must differ on at least half of their outputs to be perfectly distinguishable through orthogonality of the results of and .

For any \(k \in [2^{n-1},2^n]\), we can perfectly distinguish functions \(f_k\) with exactly k outputs of 1 from the all-zero constant function \(f_l\) using just one oracle access by using unitary defined by \(\mathfrak {R}{(a{{b}^{*}})} = -\frac{2^n/k -1 }{2}\); note that here \(\varDelta =k\). On a classical computer, the same task can be achieved quickly if \(k \sim 2^n\), but can take \(O\left( { N}\right) =O\left( {2^n}\right) \) function calls if k is close to \(2^{n-1}\).

As an example, consider a problem involving functions defined over \(n=4\) bits. Let \(f_l\) be an all-zero function, that is, for any of the 16 possible input bitstrings, it returns null. Let \(f_k\) be an imbalanced function with exactly \(k=12\) out of 16 inputs returning one, and with four null outputs. To discriminate \(f_l\) from any possible \(f_k\), we need to find a, b such that \(\mathfrak {R}{(a{{b}^{*}})} =-(16/12-1)/2=-1/6\) and \(|a|^2+|b|^2=1\): we can have \(a=1/\sqrt{6} -1/\sqrt{3} \) and \(b=1/\sqrt{3}+1/\sqrt{6}\).

In contrast to applying A prior to \(U_f\) to help solve the problem of discriminating an all-zero function \(f_l\) and a function \(f_k\) with k ones and \(N-k\) zeros on outputs, we can consider the result of applying \(I_n\) or \(E_n\) instead. For \(I_n\), we arrive at the state for the all-zero \(f_l\), while for \(f_k\) we arrive at , which has inner product \(\frac{N-k}{N}\). Only the all-one function \(f_k\) is distinguishable from the all-zero function \(f_l\). Using \(E_n\) instead leads to for \(f_l\) and to for \(f_k\). These have inner product of \(\frac{N-2k}{N}\). Here, only setting \(k=N/2\), that is, using a balanced function \(f_k\) as in the original Deutsch-Jozsa problem, leads to the ability to distinguish \(f_l\) from \(f_k\) without error using a single measurement.

With minor changes, we can also, for any \(k \in [0,2^{n-1}]\), distinguish a function with k zero outputs from an all-one constant function. The original Deutsch-Jozsa choice of \(k=2^{n-1}\) is the only case when we can distinguish \(f_k\) from both all-zero and all-one functions \(f_l\).

4 Conclusion

The Deutsch-Jozsa problem is often used to illustrate basic concepts in the gate model of quantum computing. Here, we show that the balance-vs-constant function promise problem lies at the edge of a family of promise problems involving discriminating between two subclasses of Boolean functions. The analysis of this broader family of problems can provide improved understanding of the conditions that lead to quantum speedup in Deutsch-Jozsa algorithm.