In "Condensed Matter Field Theory" by Alexander Altland and Ben Simons there is this derivation of one-particle Operators in the formalism of second quantization:
Let us now consider a one-body operator, $\hat{O}_1$, which is diagonal in the one-particle state basis $\{ {\lambda_i} \}$, with $\hat{O}_1 = \sum o_{\lambda_i}|\lambda_i><\lambda_i|$, $o_{\lambda_i}=<\lambda_i|\hat{O}_1|\lambda_i>$. With this definition, one finds that \begin{equation} <n'_{λ_1},n'_{λ_2},...|\hat{O}_1|n_{λ_1},n_{λ_2},...> = \sum_i > o_{\lambda_i} n_{λ_i} <n'_{λ_1},n'_{λ_2},...|n_{λ_1},n_{λ_2},...> = \end{equation} \begin{equation} <n'_{λ_1},n'_{λ_2},...|\sum_i > o_{\lambda_i} \hat{n}_{λ_i}|n_{λ_1},n_{λ_2},...> \end{equation} Since this equality holds for any set of states, one can infer the second quantized representation of the operator $\hat{O}_1$, \begin{equation} \hat{O}_1 = \sum o_{λ_i} \hat{n}_{λ_i} = \sum > o_{λ_i}a^†_{λ_i}a_{λ_i} \end{equation}
Honestly I can't get what they are doing, it seems to me that any inner product of a multiparticle state with a one-particle state like $|\lambda>$ should be equal to zero so I don't understand how does he gets rid of all the $|\lambda_i><\lambda_i|$.
(This is essentially the same question as A question regarding to the one-body operators in N-particle Hilbert space but I tried to write down Altland calculations to help to figure out the answer.)