---
# System prepended metadata

title: A little of errata of slide 5.

---

A little of errata for slide 5.

Assume we know, how to prepare a system in a state $|\psi\rangle=\alpha|\phi_1\rangle+\beta|\phi_2\rangle$. For simplicity you may assume that this is a photon passing a [beam splitter](https://en.wikipedia.org/wiki/Beam_splitter) either way (i.e. $|\phi_1\rangle$ - goes straight,  $|\phi_2\rangle$ - turns right).

When a **quantum programmer** say "I measure", they mean "I will run an experiment $N$ times; $n$ times I observe my particle in a state $|\phi_1\rangle$, and ($N-n$) times in a state $|\phi_2\rangle$" (e.g. with a photon detector, or just as a light spot on a screen). What do they do with this number? 

$p(|\phi_1\rangle)\approx\frac{n}{N}$, thus, by definition you may approximate $|\alpha|\approx\sqrt{\frac{n}{N}}$. You then use you approximation as results of computing. E.g. $\alpha$ and $\beta$ are results of some heavy computation: 

$|\psi\rangle=|answer\rangle=PROGRAM\times|initial\_state\rangle$.

So, when a programmer says "I observe", they mean **a state**.

<hr/>

When a quantum physicist says "I measure" this means they **measure**. Measurement is an **observable** $Z$ -- one of the eigenvalues of some operator (most often -- an operator of energy, known as Hamiltonian). Often these values are $e_1=1$ and $e_2=-1$. So, they right the following formula for what they do (and call this "expected value of an observable"):

$expval = \langle \psi |Z|\psi\rangle = \langle \psi |Z\times(\alpha|\phi_1\rangle+\beta|\phi_2\rangle)\quad\quad$(1)

We remember, that an operator does not change the eigenvector, but adds a multiplication by and *eigenvalue*, i.e., consider the left part separately:

$\langle\psi|Z = (\alpha^*\langle\phi_1| + \beta^*\langle\phi_2|)\times Z=\alpha^*\langle\phi_1|Z + \beta^*\langle\phi_2|Z$, by linearity of a quantum system.

So, we "act" by an operator on the eigenvectors, which are +1 and -1:

$\alpha^*\langle\phi_1|Z + \beta^*\langle\phi_2|Z=e_1\alpha^*\langle\phi_1| + e_2\beta^*\langle\phi_2|=+\alpha^*\langle\phi_1|- \beta^*\langle\phi_2|$.

Finally, return to formula (1):

$expval=\langle \psi |Z\times(\alpha|\phi_1\rangle+\beta|\phi_2\rangle)=(+\alpha^*\langle\phi_1|- \beta^*\langle\phi_2|)\times(\alpha|\phi_1\rangle+\beta|\phi_2\rangle)$

We open the brackets carefully:

$\alpha^*\alpha\langle\phi_1|\phi_1\rangle+\alpha^*\beta\langle\phi_1|\phi_2\rangle - \beta^*\alpha\langle\phi_2|\phi_1\rangle-\beta^*\beta\langle\phi_2|\phi_2\rangle$.

Remove orthogonal terms:

$\alpha^*\alpha\langle\phi_1|\phi_1\rangle-\beta^*\beta\langle\phi_2|\phi_2\rangle=|\alpha|^2-|\beta|^2$.

So, expval is 1, when $\alpha\rightarrow1$ (then $\beta$ is close to 0). And when $\beta\rightarrow1$, then we "observe -1", as the physicist would say, and the programmer will be confused.