# Tag Info

9

There are two questions here. The first asks how you might actually implement this in code, and the second asks what's the point if you know which oracle you're passing in. Implementation Probably the best way is to create a function IsBlackBoxConstant which takes the oracle as input, then runs the Deutsch Oracle program to determine whether it is constant....

8

Remember that when you define the oracle effect as $B_f |x \rangle |y \rangle = |x \rangle |y \oplus f(x) \rangle$, $f(x)$ is a classical function of a classical 1-bit argument, so you do not have a way to compute $f(\frac {1} {\sqrt 2} |0\rangle +\frac {1} {\sqrt 2} |1\rangle)$ (a function of a quantum state). The quantum oracles that implement classical ...

8

Apply it twice: $$O_xO_x|i\rangle|b\rangle=O_x|i\rangle|b\oplus x_i\rangle=|i\rangle|b\oplus x_i\oplus x_i\rangle=|i\rangle|b\rangle$$ Hence, $O_x$ is its own inverse, and therefore reversible. To prove unitarity, it makes more sense to prove that $O_x$ has eigenvectors $$|i\rangle(|0\rangle+|1\rangle)\quad\text{and}\quad|i\rangle(|0\rangle-|1\rangle)$$ ...

8

I believe there are two issues here. The first isn't anything wrong with your statement, but rather that you could make a far stronger (non-quantum) statement by the same reasoning: $\mathsf{P}\neq \mathsf{BPP}$. Why is this? For testing if an $n$ bit function is constant or balanced with certainty (as required by $\mathsf{P}$), it could be that we have to ...

8

I think there are probably two points to make here: 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 ...

6

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 ...

5

(Based on the time limitation I assume we're talking about an undergraduate level project, and not something more advanced.) If you look at the questions about Grover's algorithm, you'll notice that a lot of them ask about implementing oracles for interesting tasks - or at least tasks more satisfying than looking for the state $|111\rangle$ :-) One ...

5

It is not possible at an information-theoretic level to do what you want to do. Let us suppose we have two pure states: $|\phi\rangle$ and $|\psi\rangle$, where $$|\phi\rangle = \frac{1}{\sqrt{N}}\sum_{i=1}^N |x_i\rangle$$ and $|\psi\rangle$ is similar to $|\phi\rangle$ but with a few of the coefficients tweaked in some way. Notice that we're fixing just ...

5

Overview To recap the one-bit Deutsch Oracle problem, there are four possible oracle functions: constant-0, constant-1, identity, and negation. The task is to determine whether the oracle function is constant (constant-0 & constant-1) or variable/balanced (identity & negation). You can do this using phases as follows: Rewrite the oracle function as ...

4

The controlled dot doesn't do anything: it merely observes the bottom qubit in order to decide whether to apply the 𝑋 gate onto the top qubit. In the answer below, the qubit that appears first is the control qubit, it maps to the bottom qubit in your diagram, and the second one is the target qubit. The CNOT gate works on two qubits at once. You can't ...

4

If you look at the formula you want to prove term-by-term, you'll notice that the sum and the $(-1)^f(x)$ part is the same in both formulas; you just need to show that $$H^{\otimes n} |x\rangle = \frac{1}{\sqrt{2^n}} \left( \sum_{y=0}^{2^n-1} (-1)^{x \cdot y} |y\rangle \right )$$ You can either show this strictly by induction (similar to this question but ...

4

It is limited to matrix $U_f$ which maps $|x,y\rangle$ to $|x,y\oplus f(x)\rangle$, and the little thought is $$U_f|x,-\rangle=\frac{1}{\sqrt{2}}(|x,0\oplus f(x)\rangle-|x,1\oplus f(x)\rangle)=$$ $$=\begin{cases} |x,-\rangle & \text{if }f(x)=0\\ -|x,-\rangle & \text{if }f(x)=1 \end{cases}=(-1)^{f(x)}|x,-\rangle$$ where $x\in\{0,1\}$ or generally $x\... 4 To answer your first question, the quantum oracles are defined by their effect on the basis states$|0\rangle$and$|1\rangle$, and if the oracle has to be computed on a superposition of basis states, its effects are expressed using the fact that the oracle is a linear transformation. This means that you never compute$f(|+\rangle)$; instead, to compute the ... 3 This is not so straightforward, I suspect. The issue is being able to distinguish between the constant case (e.g. every input gives output 0) and the case where only one input returns 1, and all others return 0. To distinguish these cases is essentially a Grover Search (the return of 1 being essentially a marked item that you want to search for the existence ... 3 TL;DR: You won't be able to distinguish the constant and balanced function scenarios if you start with$|y\rangle = |0\rangle$. If you start with$|x\rangle = |0\rangle$and$|y\rangle = |0\rangle$: For a balanced function$ f (0) = f '(1)$you'll get $$\frac{1}{2}(|0,f(0)\rangle+|0,f'(0)\rangle+|1,f(1)\rangle+|1,f'(1)\rangle)) =$$ $$= \frac{1}{2}(|0,f(... 3 There are many different variants depending on what it is precisely that you want to achieve (note, this was written before recent edits, although I think there is still value/relevance in this more general answer). The closest analogy to the Deutsch-Jozsa algorithm is probably to say that you're given one of two states, and you want to know which you've ... 3 The circuit you gave implements an oracle for a function f(x) = 0, which is constant. You can observe that there are no gates leading from the top two wires (inputs |x\rangle) to the bottom wire (output |y\rangle). Since the oracle is supposed to transform |x\rangle|y\rangle into |x\rangle|y \oplus f(x)\rangle, and |y\rangle always remains ... 3 Notice that \mathcal O_x is a permutation matrix. The matrix elements are$$\langle j, c\rvert\mathcal O_x\lvert i,b\rangle =\delta_{ij}\langle c\rvert b\oplus x_i\rangle =\delta_{ij}\delta_{c,b\oplus x_i}.$$In other words, \mathcal O_x is diagonal with respect to the first register, and, for each block corresponding to a given i, connects all and ... 3 There is no way to build the oracle in a way which would not defeat the point of Deutsch's algorithm - that's why it is an oracle-based algorithm. The only way would be if you would come up with an incredibly hard to compute function (this is, an incredibly long circuit) which would take one input bit x and give one output bit f(x) (but on the way could ... 3 Deutsch's algorithm is not faster on a quantum computer, Deutsch's algorithm is only possibe on a quantum computer. A classical computer cannot perform Deutsch's algorithm, a classical computer can only simulate Deutsch's algorithm. Forget about speed, more fundamental is that we are performing a type of computation that can never be performed, in any ... 3 Yes, it will depend on n because sampling with replacement is assumed in the proof, which doesn't make sense if n is finite. Intuitively, if a function f really is balanced, and first output corresponding to certain random input is 0 or 1, then the probability that the second output corresponding to some other random input will be the same is less ... 3 To measure, observe that you are simply projecting a quantum state onto some basis set of vectors. First, I will note that this state is not normalized. Let us first define the following quantum state.$$|\psi_i\rangle = \begin{pmatrix}1\\-1\\0\\0\end{pmatrix}.$$Then, calculating the corresponding probability yields:$$|\langle \psi_i|\psi_i\rangle|^2 = (... 3 Your first formula is not correct. The correct formula for Hadamard gates for the arbitrary$|x\rangle$from the calculational basis is (it can be proved by induction): $$H^{\otimes n}|x\rangle=\frac{1}{\sqrt{2^n}} \sum_{y=0}^{2n-1}{(-1)^{x\cdot y}}|y\rangle$$ where$x\cdot y=x_0y_0\oplus x_1y_1\oplus x_2y_2\oplus ...\oplus x_ny_n$In case$|x\rangle = |0\...

3

@cgranade and I have a chapter on the Deutsch-Jozsa algorithm (Chapter 7) as well as implementations of the oracles for Q# in our book Learn Quantum Computing with Python and Q#. You can find the code samples for the book in the repo here. In particular, the oracles look like this: namespace DeutschJozsa { open Microsoft.Quantum.Intrinsic; ...

3

Probably only two qubits constrain set of algorithm you can run on your device, for example HHL algorithm (linear equation solver) seems to impossible work there. You can however implement algorithms based on uniformly controlled rotation used for preparing arbitrary quantum state. See details in the paper Transformation of quantum states using uniformly ...

3

I have implemented via qiskit two algorithms and posted in github that need only 1-2 qubits. First is Iterative Quantum Phase Estimation (IQPE) that works on two qubits, the second one is Variational Quantum Eigensolver (VQE) that works on only one qubit (one can do also for 2 qubits) in my implementations. Actually they are jupyter notebook tutorials, so I ...

3

One implements $U_f$ with one circuit that acts on qubit(s) in the superposition state. This means that no matter what is the input (basis state in the superposition), we act on the qubits with the same circuit and it takes the same execution time (the same number of gates in the circuit) for all possible inputs. So, how I understand, the scenario of ...

2

Let $f$ be your favorite $\mathrm{SAT}$ problem. For example, one that I like is: Are there integers $x_1, x_2, x_3$, each $-2^{50}\le x_1,x_2,x_3 \le 2^{50}$, with $x_1^3+x_2^3+x_3^3=42?$ Write $f$ as a sequence of irreversible $\mathsf{NAND}$ gates, etc., and convert them to a sequence of reversible $\mathsf{CCNOT}$ gates, etc. to determine a unitary $... 2 How can I calculate the ground state of$H(0)$? The ground state means the eigenvector with lowest eigenvalue. Take your given example, $$H(1)=\left(\begin{array}{cc} 1 & 1 \\ 1 & 1 \end{array}\right).$$ You solve$\text{det}(H(1)-\lambda\mathbb{I})=0$to find the eigenvalues. In this case,$\lambda=0,2\$. So you're interested in the smallest ...

2

I will try to give an answer from complexity theory's point of view. This question should be asked in cs.stackexchange by the way. The Deutsch-Jozsa problem has an efficient algorithm on quantum computation and on a classical probabilistic Turing machine, so it is in BQP and BPP. There is no result that says: if you show a problem A in BQP and not in P, then ...

Only top voted, non community-wiki answers of a minimum length are eligible