---
# System prepended metadata

title: Deutsch Josza Algorithm

---

# Deutsch Josza Algorithm

A quantum algorithm to determine whether the function $f(x)$ is constant or random.


## Procedures
\begin{eqnarray}
	\left|0\right>^{\otimes N}\left|1\right> \to&& \left|+\right>^{\otimes N}\left|1\right>\\
	=&& \frac{1}{\sqrt{2}^n}\sum_{x = 0}^{2^n-1} \left|x\right> \left|-\right> \\
	\to&& \frac{1}{\sqrt{2}^n}\sum_{x = 0}^{2^n-1} \left|x\right> \frac{1}{\sqrt{2}} \left(\left|0 +f(x)\right> - \left|1+f(x)\right>\right) \\
	=&& \frac{1}{\sqrt{2}^n}\sum_{x = 0}^{2^n-1} (-1)^{f(x)}\left|x\right> \left|-\right>\\
	\to&& 
\end{eqnarray}

Finally measure the probability that the  register $N$ qubits is $\left|0\right>^{\otimes N}$.