The Stack Overflow podcast is back! Listen to an interview with our new CEO.

# Tag Info

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

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

7

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

6

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

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

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

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

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

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

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

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

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 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 ... 2 I don't have an example for Deutsch's algorithm handy, but here and here are two tutorials which walk you through implementing the Deutsch-Jozsa algorithm and the oracles it uses in Q#. The idea for these two algorithms is the same: you have to provide the oracle to the algorithm as an operation implemented elsewhere. This way the algorithm doesn't know ... 2 You have two examples on the IBM Q Experience page about the algorithm. They show an example of a function. This could inspire you for your simulations I hope. 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 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 ... 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 TL;DR: There are 8 possible outcomes, each with equal probability of being read. The final state has q[1] read as 0 in 4 of the outcomes, and read as 1 in the other 4 outcomes. Since you are only measuring q[1], you only see the two results, one with q[1] as 0 and one with q[1] as 1. They are both around 50% because each outcome had an equal probability of ... 2 I am not sure what the second question is about, but in the first one you are probably inquiring about the concept of "phase kickback": Why does the "Phase Kickback" mechanism work in the Quantum phase estimation algorithm? 2 As everyone knows, all functions of quantum computing are inverses of each other. Hence, the 2 H gates cancel out. Quantum gates all have inverses, but the inverse of a gate is not necessarily the same gate, though Hadamard gates, which are the ones being most considered here, are their own inverse. I'm not sure if by "2 H gates" you mean the two gates ... 2 There are really two different questions here. How can you figure out that a given output can be written as tensor product of two vectors? This is equivalent to asking: how do you figure out whether an output is separable? For pure states, which is what you are considering, this is rather easy. In your specific case (two qubits), you might simply notice ... 2 If you have already got, mathematically, to the point of having the vector (1,-1,1,-1)/2, you don't have to worry about the action of the controlled-not any more. You've already done that! All you have to do is factor the answer. Personally, I usually find the answer quite difficult to see when expressed in this way. Once you've got the answer you can ... 1 I don't think you can factor. There are many cases where the result of the gate will produce a combined CNOT output (4 numbers) that cannot be factored. I think most states between two qbits is entangled from our perspective. So you cannot trust in factoring. Instead, the four products remain in memory while your program writes the data to both of your ... 1 The terms of expression do not cancel out in the balanced function case. We start with$$\frac{1}{2} (|0\rangle|0 \oplus f(0)\rangle - |0\rangle|1 \oplus f(0)\rangle + |1\rangle|0 \oplus f(1)\rangle - |1\rangle|1 \oplus f(1)\rangle) If $f(0) \neq f(1)$, consider the first two terms (the only ones which can cancel with each other, since the state of the ...

1

Finally, I found the answer myself there. The only interesting thing is the amplitude of $|0\rangle^{\oplus n}$. If the function is constant, it is $\pm 1$ and if the function is balanced, it is $0$. Hence, in the first case we are sure to measure all qubits in the $|0\rangle$ state and in the second case, we cannot measure all of them in this state (else ...

1

If you want to measure $|\phi\rangle$ in some basis $U|b_1\rangle,...,U|b_n\rangle$ instead of $|b_1\rangle,...,|b_n\rangle$, then you need to rotate the state "backward", i.e. measure $U^{-1}|\phi\rangle$ in $|b_1\rangle,...,|b_n\rangle$. The simple rule to find the direction of rotation is to consider the state and the required measurement basis together \$\...

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