Another well known quantum algorithm for searching. Takes a function $f : \{0,1\}^n \rightarrow \{0,1\}$ where f(x) = 1 for exactly one x. The goal is to find x. New gates: $V_f$ and FLIP$_*$ $\ket{*}$ denotes the superposition over al classical possibilities. ### Oracle $V_f$ ![[Pasted image 20260805102238.png]] We use the Unitary $U_f$ as previously defined to construct $V_f$ ![[Pasted image 20260805102605.png]] ### FLIP$_*$ We first need FLIP$_0$ defined as follows: ![[Pasted image 20260805102659.png]] This is implemented via this circuit: ![[Pasted image 20260805102717.png]] Z is a Pauli matrix and the empty circles denote negative control wires. So Z is only applied if all other wires are $\ket{0}$ Now we define the unitary FLIP$_*$: ![[Pasted image 20260805103650.png]] ![[Pasted image 20260805103706.png]] ### The search algorithm: ![[Pasted image 20260805110129.png]] The algorithm works as follows: 1. $\ket{0}$ on every qubit. 2. Superposition over all entries via H which results in the quantum state $\ket{*}$ 3. Apply unitary $V_f$ 4. Apply unitary FLIP$_*$ 5. Repeat 3 and 4 t times 6. Measure. How does this work?: We want the algorithm to terminate in $\ket{x_0}$ First, we bring the system into uniform superposition $\ket{*}$ We know that $\ket{x_0}$ is part of the superposition so we can rewrite as follows: ![[Pasted image 20260805110521.png]] ![[Pasted image 20260805110633.png]] ![[Pasted image 20260805110641.png]] ![[Pasted image 20260805110648.png]]