Alternative proof of Fundamental Lemma of Variational Calculus? I am confused by one of the proof in the Calculus of Variations by Gelfand and Fomin. On page 9, we have

Lemma: If $\alpha(x)$ is continuous on $[a,b]$, and if $\int_a^b \alpha(x)h(x)=0$ for every $h(x) \in \mathcal{C}([a,b])$ such that $h(a)=h(b)=0$, then $\alpha(x)=0$ for all $x\in[a,b]$.

First, I don't understand why do we need $h(a)=h(b)=0$. Second, the proof in the book and in many other resources used contradiction. But can we simply argue that since $\mathcal{C}([a,b]) \subset L^2([a,b])$, and in $L^2([a,b])$ we can define the inner product
$$\langle \alpha(x), h(x) \rangle := \int_a^b\alpha(x)h(x) dx$$,
then the result would follow immediately, since $\langle u,v\rangle = 0 \forall v\Longrightarrow u=0$?
 A: Of course you can drop the assumption $h(a)=h(b)=0$ but then your assumptions are unnecessary strong.
EDIT:
For the second part: sure, you can use the $L^2$ inner product. But the proving that this bilinear form is non-degenerate is the same thing as to prove your claim, so this is like cheating. Furthermore, you need a little argument, to show that continuous maps that are almost everywhere zero are in fact identically zero (as the $L^2$ inner product is just giving you a statement about equalities almost everywhere).
A: EDIT: As pointed out in the comments the point 4 is not really necessary for this form of the lemma. That result is used to prove stronger form of the lemma, for example when $\alpha$ is not continuous.
I leave here my answer:
I suppose these facts are known:


*

*$L^2([a,b])$ is an Hilbert space with the usual inner product

*$u=\mathbf{0}$ in $L^2([a,b])$ means $u = 0 \ a.e.$ (this is because $L^p$ space are quotient spaces)

*Given a dense subset $S$ of an Hilbert space $X$ we have: $$\forall
        v \in S, \ \langle u,v \rangle = 0 \implies u = \mathbf{0}$$


You can now prove the lemma (without the assumption that the function vanish on the boundary) in this way:
$C([a,b])$ is a dense subspace of $L^2([a,b])$, so by point 4,  $$h \in C([a,b]), \ \langle \alpha,h \rangle = \int_a^b \alpha(x)h(x)dx = 0 \implies \alpha = \mathbf{0}$$
So $\alpha = \mathbf{0}$ in $L^2$ and hence, using point 2, $\alpha = 0 \ a.e.$ 
And this proves the lemma without the assumption that $\alpha$ is continuous.
A: Given $f$ is measurable and locally integrable
$$\int_a^bf(x)h(x) dx=0$$, for all compactly supported smooth functions $h$ with $h(a)=h(b)=0$, then $f=0$ almost everywhere on $[a,b]$
proof :
$r(x)=-{\frac {1}{x^2-a^2}}$
$q(x)=-{\frac {1}{b^2-x^2}}$
$$\psi(x) =e^{q(x)+r(x)} , \text{if $a< x< b$ }$$
$$\psi(x) =0  , \text{if $x$ $\notin (a,b)$}$$
let $u_\sigma(x)=\frac{1}{\sqrt{2\pi \sigma^2 }}e-^{-\frac{x^2}{2\sigma^2 }}$
$$g_{\sigma}(x)=\int_a^b \psi(y)f(y)u_{\sigma}(x-y)dy$$
we can identify $h(y)=\psi(y)u_{\sigma}(x-y)$
$h(a)=h(b)=0$
it is known that $$\lim_{\sigma \to 0}g_{\sigma}(x)=f(x)\psi(x)$$ almost everywhere on $[a,b]$
but $g_{\sigma}(x)=0$ implying $f(x)=0$ almost everywhere on $(a,b)$ since $\psi(x)>0$ on $(a,b)$
