"The fundamental lemma of the calculus of variations states that if the definite integral of the product of a continuous function $f(x)$ and $h(x)$ is zero, for all continuous functions $h(x)$ that vanish at the endpoints of the range of integration and have their first two derivatives continuous, then $f(x)=0$."
Why can't we construct some $h(x)$ that starts at $(a,0)$, has a positive trajectory - imagine, say, an upside down parabola - and then comes back down to end at $(b,0)$, and then some $f(x)$ that is positive for the first half of the interval and negative for the second half (think of some sinusoidal curve)? Then when we integrate, we would basically be adding up a series of positive quantities ($h(x)f(x)$ would be positive), and then a series of negative quantities ($f(x)h(x)$ would be $\text{negative}\times\text{positive} = \text{negative}$). We could then fine-tune to get this to equal zero.
What precisely am I not understanding here?