Solution (source code)

= Solution

The nonzero <leading coefficients> and distinct degrees make $P_0,\ldots,P_{n-1}$ a <basis> of the <polynomials> of degree at most $n-1$. Consequently the given <orthogonality> implies $\int_a^bf(x)Q(x)dx=0$ for every such <polynomial> $Q$.

If $f$ has infinitely many distinct zeros in $(a,b)$, there is nothing to prove. Otherwise suppose it has fewer than $n$. Among those zeros, list the sign-changing ones as $t_1<\cdots<t_m$, with $m<n$, and put $Q(x)=\prod_{j=1}^m(x-t_j)$, using $Q=1$ when $m=0$. On each interval between zeros, $f$ has a fixed sign by <continuity>. Crossing a sign-changing zero flips both $f$ and $Q$; crossing any other zero flips neither sign. Thus $fQ$ has one constant sign wherever nonzero. Since $f$ is not identically zero, <continuity> gives an <open interval> on which $fQ$ is strictly of that sign. Hence its integral is nonzero, contrary to orthogonality to $Q$. \b[Therefore $f$ has at least $n$ distinct zeros in $(a,b)$.] This is the reusable <orthogonality forces many interior zeros> argument.