We make use of the fact that $L^2(\Omega)$ is a Hilbert space, and $C_c^\infty(\Omega)\subset L^2(\Omega)$ is dense.
$M$ is a dense subset of $\operatorname{span}\{f\}^\perp$, see the proof below. Therefore $\operatorname{cl}M = \operatorname{span}\{f\}^\perp$ (with $\operatorname{cl}$ being the closure).
There holds $M^\perp = (\operatorname{cl}M)^\perp$. Therefore $M^\perp = \operatorname{span} \{f\}^{\perp\perp} = \operatorname{span}\{f\}$.
Appendix: Density of $M$ in the orthogonal complement. There might be more elegant proofs, but here's one possible approach: Let $g\in\operatorname{span} \{f\}^{\perp}$ (and not in $C_c^\infty$). Then there are two sequences in $C_c^\infty$:
- $\phi_n \to g$ in $L^2$, and
- $\psi_n \to f$ in $L^2$.
Both follows from the already stated fact that $C_c^\infty(\Omega)\subset L^2(\Omega)$ is dense. The $\phi_n$ can be decomposed orthogonally into
$$\phi_n = \mu_n + \lambda_n f,\quad \text{ for }\mu_n\in f^\perp\text{ and }\lambda_n\in\mathbb C,$$
and $\lambda_n\to 0$, because $\phi_n\to g \in f^\perp$. The only remaining problem is that the $\mu_n\notin C_c^\infty(\Omega)$ necessarily. This is where we use $\psi_n$ to further decompose the $\phi_n$: First note that the sequence $(\psi'_n)$ also satisfies $\psi_n'\to f$:
$$\psi'_n:=\frac{\|f\|^2}{\langle \psi_n, f\rangle}\psi_n.$$
We use this in the decomposition of $\phi_n$:
$$\phi_n = [\mu_n + \lambda_n(f-\psi_n')] + \lambda_n\psi_n'.$$
- The term in the square brackets is in $C_c^\infty$ because $\phi_n$ and $\lambda_n\psi_n'$ are.
- The term in the square brackets is orthogonal to $f$ (because we have normalized $\psi'$ accordingly).
- The term $\lambda_n\psi_n'\to 0$.
Therefore, also $\phi_n':= \mu_n + \lambda_n(f-\psi_n')\in C_c^\infty \cap \{f\}^\perp$ converges to $g$. Hence $M\subset\{f\}^\perp$ is dense.