7

There is something I really misunderstand about the Deutsch-Jozsa algorithm.

To check if $f$ is balanced or constant, we use the following algorithm:

enter image description here

where $U_f$ gives $(x,y) \rightarrow (x, y \oplus f(x))$.

Let's take $n=1$ for simplicity (thus the function $f$ is defined on $(0,1)$). We have four possible $U_f$ associated to two constant possibilities ($f$ equal to $0$ or $1$), and two balanced possibilities.

So, in practice, if I want to implement this in a circuit, I have to know exactly the "matrix" of $U_f$. And to do it I have to compute $f$ two times. Thus, I know if $f$ is balanced or constant even before having applied the quantum algorithm. So for a practical aspect, I don't understand what is the point of this.

Said differently, if I am given $U_f$ I agree that in one step I will know if $f$ is balanced or constant. But if I know $U_f$ I already know the answer to this question.

I am a little confused...

Lorenzo B.
  • 153
  • 8
Marco Fellous-Asiani
  • 1,514
  • 2
  • 13
  • 33

2 Answers2

8

I think there are probably two points to make here:

  1. The way that one implements quantum computation is not by simply looking at the unitary matrix and building something out of that, in just the same way that classical computation is not performed simply by first building the truth table and working off that (otherwise all classical computations would be exponential). Instead, as cnada says, the computation is itself built out of simple gates. The simplest is "do nothing" which is a perfectly good example of a constant algorithm. I don't need to see the unitary to build that!

  2. The context of an oracle is that you don't build it yourself, so you don't know the unitary. Somebody else gives it to you (or perhaps you'll have built it as the result of another computation), with certain promised properties, and it is your job to determine the relevant parameters. Of course, if you want to practically test whether that works, you'll build it all yourself. But then, you don't care about the efficiency saving during the test, because of course you know what you've built. Indeed, you need to know what you've built because otherwise your test cannot work; you don't know what to check the outcome against.

Incidentally, I think this question is closely related.

DaftWullie
  • 57,689
  • 3
  • 46
  • 124
7

If you see the operator only from the unitary matrix point of view and you enumerate all inputs/outputs, which makes you visualize the matrix, indeed you somehow already know the answer.

However, imagine now $n$ is very large, say just $n>50$ or $n>60$, it becomes a bit difficult to store a $2^n * 2^n$ unitary matrix. But if you can compute the function, that is having a sequence of gates representing the operation, you can just apply it without having a knowledge of the unitary.

Let us give you an example just on n=3: $$ f(x) = x_0 \oplus x_1 x_2 $$

To apply $ U_f $, we just need a $CNOT$ and a Toffoli gate representing the different operations of $f$, and apply directly, without necessarily having a knowledge of the unitary to build it (just decomposing into "simple" operations). You can extend to examples where $n$ is very large.

cnada
  • 4,754
  • 1
  • 8
  • 21
  • Nice answer! Could you possibly comment on the case where $n=\omega$ (ie tranfinite/intinite dimensional)? – user820789 Nov 05 '18 at 16:34
  • 1
    Well the algorithm assumes $f(x)$ takes values for $ x \in {0,1,...2^n-1 } $, that is the input is represented by a binary string. – cnada Nov 05 '18 at 16:46
  • In this context, would it be more appropriate to use cardinal or ordinal arithmetic? – user820789 Nov 05 '18 at 16:51
  • @meowzz I am not sure I understand. But do you consider the case $x$ to be a real value? – cnada Nov 05 '18 at 17:06
  • This answer mentions maps that "...corresponds to the finite subsets rather than arbitrary subsets, thus to terminating binary sequences (esp. rational numbers) instead of arbitrary binary sequences (real numbers)". Apologies for the unclearness of my question.. there are many things about quantum computing that still do not make sense to me. – user820789 Nov 05 '18 at 17:22
  • Thank you for your answer. It is more clear for me. So in practice the thing is : we know the mathematical formula $f(x)$ but we never calculate its value for all $x$. Thus we don't really have the information at the beginning. It is actually a common thing, when we have in math a function $f$ it can be very hard to know if it is increasing or not. We would have the answer by calculating all the $f(x)$ but it would be an infinite time calculation. Here it is somehow the same (we just need the "formula" of $f$ that we translate in gates operations). – Marco Fellous-Asiani Nov 06 '18 at 09:06
  • So in this problem, we assume that we know at the beginning of the problem, the formula $f(x)$ expressed in 2 bits operations which is equivalent to a general $f(x)$ formula in math (and not all the values of the function $f$, because in this case we would indeed already know the answer to our problem, and we would have indirectly solved it so using this algorithm would be useless). Am I right ? – Marco Fellous-Asiani Nov 06 '18 at 09:08
  • 1
    I guess you got it in your terms @StarBucK. – cnada Nov 06 '18 at 10:52
  • 1
    @StarBucK You're welcome. Don't forget to validate one answer when you feel one is good enough. – cnada Nov 06 '18 at 14:10