= Solution
The singular weight requires care about the space of admissible polynomials. Since $n\ge1$, $x^n$ has finite squared <norm>. A <polynomial> $q$ has finite error relative to $x^n$ near zero exactly when $q(0)=0$: a nonzero constant term makes the integrand asymptotic to $q(0)^2/x$, whose integral diverges. If $q(0)=0$, the residual is $O(x)$ and the integrand is $O(x)$.
Thus \b[the full space $\Pi_{n-1}$ is not a subspace of $V$], so the projection theorem cannot be applied to it as written. Nevertheless a unique best finite-error approximation does exist in
$$
W=\Pi_{n-1}\cap V=\operatorname{span}\{x,x^2,\ldots,x^{n-1}\}.
$$
For $n=1$, this is the zero space and the answer is $q=0$. For $n\ge2$, $W$ is finite dimensional and its <Gram matrix> is positive definite, because a nonzero <polynomial> cannot vanish on an interval. Solving the normal equations therefore gives its unique <orthogonal projection> of $x^n$. All omitted polynomials have infinite error, so this also minimizes the extended error over the full <polynomial> set. The distinction is \b[an invalid full-space projection premise, not nonexistence of every finite-error best approximation]. As throughout weighted $L^2$, use equivalence classes for the underlying measure.
Back to article page