Proof (necessity of Legendre condition)

Suppose $P(x_0)<0$ for some $x_0\in[\alpha,\beta]$.

Choose $\eta(x)$ to be small and very wiggly around $x_0$.

Then the magnitude of $P\cdot(\eta')^2$ is much larger than $Q\cdot \eta^2$, so the second variation is negative.