Usually one of two quantum encodings are considered for these Boolean functions. The phase oracle encodes the output bit as a sign flip or a phase shift by an angle of π.
Show the corresponding circuits with their action on
operators, which are just convenient names for Pauli
Z
and
-Z
.
Another way of encoding these Boolean functions is to show more direct bit action with a Boolean oracle representation, which is using an auxiliary qubit initialized to
The Deutsch algorithm is then simply about measuring (in the X basis) the result of running such a quantum oracle on a uniform superposition as input (
If one has more than one variable then the exact same procedure is called the Deutsch-Jozsa algorithm. For example for two variables, these are the corresponding phase and Boolean oracles:
There are not just constant and balanced functions now, but also unbalanced ones, about which the algorithm can't say anything at all, meaning outcome distribution is uniform for such cases: