# To find the best angles in QAOA why we do not optimize over a maximum ofall shots instead of a mean?

When finding the best angles for QAOA we optimize over $$F_{p}(\beta , \gamma) = \langle \psi_p(\gamma,\beta)|C|\psi_p(\gamma,\beta)\rangle$$.
In each optimization step we simulate the circuit $$m$$ times and then calculate the mean $$\mu$$ of the outcomes which is $$F_{p}(\beta , \gamma) = \langle \psi_p(\gamma,\beta)|C|\psi_p(\gamma,\beta)\rangle$$.

What would happen if we don't optimize over the mean but on the maximum of the results of the simulation

Wouldn't it be much more efficient as fewer shots are needed for each simulation?

In QAOA we are looking for a ground state of a Hamiltonian $$H$$. This means that we want to find a quantum state $$|\psi\rangle$$ for which a energy is minimal, or in other words, a state asociated with a minimal eigenvalue.
Suppose that $$|\psi\rangle$$ is our eigenstate, hence $$H|\psi\rangle = \lambda|\psi\rangle,$$ where $$\lambda$$ is respective eigenvalue. Multiplying by $$\langle\psi|$$ we get $$\langle\psi|H|\psi\rangle = \langle\psi|\lambda|\psi\rangle = \lambda,$$ since $$\langle\psi|\lambda|\psi\rangle = \lambda\langle\psi|\psi\rangle = \lambda$$ ($$\langle\psi|\psi\rangle = 1$$ comes from requirement that a quantum state is a unit vector).
As we want $$\lambda \rightarrow \min$$, we have to minimize $$\langle\psi|H|\psi\rangle$$, i.e. the mean.