Understanding a proof on a special case of Riesz's representation theorem 
Let $(S,\mathscr{S},\mu)$ be a measure space and $L:\mathcal{L}^2(\mu)\to\mathbb{R}$ be a linear map satisfying $|Lf|\leq C\left\|f\right\|_{2},\forall f\in\mathcal{L}^2(\mu)$ for some fixed constant $C\geq0$. Then there exists an a.e. unique element $g\in\mathcal{L}^2(\mu)$ such that
$$
Lf=\int fg\mathsf{d}\mu,\forall f\in\mathcal{L}^2(\mu).
$$

I am reading a proof to this proposition from here (Proposition 5.11). The first part is basically showing that there exists $\hat{g}\in\mathcal{L}^2$ such that $\hat{g}\perp f,\forall f\in\ker L$. This is the part that really confuses me. My questions include:

*

*Does the existence of a sequence of $f_n\in\ker{L}$ such that $\left\|f_n-h\right\|\to\inf_{f\in\ker L}\left\|f-h\right\|$, as argued by the author at the very beginning, use the closedness of $\ker{L}$?


*Since $\ker L$ is closed and $\mathcal{L}^2$ is complete, is it true that the $\hat{f}$ as defined in the proof should be an element of $\ker L$ as well?


*Why is it true that $\hat{g}\perp f,\forall f\in\ker L$? The writer skips that part (he said "directly follows") but I am not able to see it.
Thank you!
 A: Regarding your three questions:
(1) For the first one as mentioned in the comments, the existence of the infimising sequence follows just from the definition of the infimum. On the other hand, the author also states that
\begin{align}
\inf_{f \in \mathrm{ker} L}\lVert f-h \rVert  >0 \, .
\end{align}
This follows from the fact that $h \notin \mathrm{ker}L$ and that $\mathrm{ker} L$ is closed. Indeed, if  $\inf_{f \in \mathrm{ker} L}\lVert f-h \rVert  =0$ it would follow that
\begin{align}
\lim_{n \to \infty }\lVert f_n -h \rVert =0 \, ,
\end{align}
which would mean that $\mathrm{ker} L$ is not closed.
(2) You are right. $\hat f \in \mathrm{ker}L$.
(3) The author defines $\hat g =\hat f -h$, where $\hat f$ is the limit of the sequence $f_n$. Assume there exists $f \in \mathrm{ker}L$ such that $\int \hat g {f} \, \mathrm{d}\mu < 0$ (we can assume $<0$ without loss of generality because if not we can always flip the sign of $f$) . It follows that
\begin{align}
\lVert \hat f-h + \varepsilon f \rVert^2 =& \lVert \hat f-h  \rVert^2 + 2 \varepsilon \int \hat g {f} \, \mathrm{d}\mu  + \varepsilon \lVert f \rVert^2 \\
<& \lVert \hat f-h  \rVert^2  \, ,
\end{align}
for $\varepsilon $ chosen to be sufficiently small because the term linear in $\varepsilon $ dominates and is negative for $\varepsilon  \ll 1$. But this is a contradiction since $\hat f$ attains the infimum and the above inequality would imply that $\hat f + \varepsilon  f \in \mathrm{ker} L$ attains a lower value than the infimum.
