QSWE
  • Welcome
  • Algorithms
    • BB84
    • Bell Inequality
    • Deutsch
    • Bernstein-Vazirani
    • Simon
  • Code
    • CirQ
      • BB84
      • Bell Inequality
      • Deutsch
      • Bernstein-Vazirani
      • Simon
  • Contact
Powered by GitBook
On this page
  • Objective
  • Classical protocol
  • Quantum protocol
  • Expectation vs Reality
  1. Algorithms

Deutsch

Simplest demonstration of quantum computation

PreviousBell InequalityNextBernstein-Vazirani

Last updated 2 years ago

Code :

is one of the simplest demonstrations of an improvement of quantum computation over classical computation using , and .

Objective

Consider an unknown function that maps {0,1}→{0,1}\{0,1\} \rightarrow \{0,1\}{0,1}→{0,1}. We want to know if f(0)==f(1)f(0)==f(1)f(0)==f(1) .

Classical protocol

The only way to get the answer is to measure f(0) and f(1), i.e. query the oracle twice.

Quantum protocol

Prerequisites

We have 2 qubits. We can design a circuit with any gates including a black box oracle gate that implements the unknown function.

Phase kickback

Phase kickback is the workhorse in almost every quantum algorithm.

Classical bits can only be flipped, from 0 to 1 and back. Therefore information must be encoded in a series of bits.

Qubits have one additional degree of freedom which is phase. For example, Z∣1⟩=−∣1⟩Z|1\rangle = -|1\rangleZ∣1⟩=−∣1⟩. More generally, eiθ∣ψ⟩e^{i \theta}|\psi\rangleeiθ∣ψ⟩ is phase-shifted away from ∣ψ⟩|\psi\rangle∣ψ⟩ by an angle θ\thetaθ. Why is this important?

Encoding information in the phase allows us to perform certain computations with exponentially fewer qubits. However, this new kind of information encoding also makes it very difficult and non-intuitive to create new quantum computing algorithms.

Running the algorithm

To identify if f(0)==f(1)f(0)==f(1)f(0)==f(1), we can calculate f(0)⊕f(1)f(0) \oplus f(1)f(0)⊕f(1). Thanks to quantum superposition and phase kickback, we can do that with just 1 query of the oracle.

  1. Prepare two qubits in the ∣+⟩1∣−⟩2|+\rangle_1|-\rangle_2∣+⟩1​∣−⟩2​​ state.

  2. Apply the oracle such that O∣+⟩1∣−⟩2=∣+⟩1∣f(+)⊕−⟩2O|+\rangle_1|-\rangle_2 = |+\rangle_1|f(+)\oplus -\rangle_2O∣+⟩1​∣−⟩2​=∣+⟩1​∣f(+)⊕−⟩2​

    This can be achieved by first applying the secret function fff on qubit 1 and then a CNOT gate on qubit 2.

  3. Applying a Hadamard on qubit 1 and rearranging the states the output becomes =12((1+(−1)x)∣0⟩1+(1−(−1)x)∣1⟩1)∣−⟩2={\frac {1}{2}}((1+(-1)^{x})|0\rangle_1 +(1-(-1)^{x})|1\rangle_1 )|-\rangle_2=21​((1+(−1)x)∣0⟩1​+(1−(−1)x)∣1⟩1​)∣−⟩2​, where x=f(0)⊕f(1)x=f(0) \oplus f(1)x=f(0)⊕f(1).

  4. Measure qubit 1. If f(0)⊕f(1)=0f(0) \oplus f(1) = 0f(0)⊕f(1)=0, then ∣1⟩1|1\rangle_1∣1⟩1​ interferes destructively and vanishes and the output is 0. If f(0)⊕f(1)=1f(0) \oplus f(1)=1f(0)⊕f(1)=1, then ∣0⟩1|0\rangle_1∣0⟩1​ interferes destructively and vanishes and the output is 1.

Expectation vs Reality

Deutsch algorithm does not have any good practical applications.

But, in practice, the secret function is fairly contrived and we know of no application where this function is both important and so expensive to query that a single query improvement is worth a quantum computation.

In theory the algorithm (and its ) shows a clear quantum advantage over the classical best case.

Cirq
Deutsch's algorithm
superposition
interference
phase kickback
extensions