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$?
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).