# Finding the closest function to another in a Hilbert space.

Let H be the Hilbert space L$^2$([0,1)], and let $S$ be the subspace of functions f $\in$ H satisfying $\int^1_0(1+x)f(x)dx=0$.

Find the element of $S$ closest to the function $g\in H$ defined by $g(x)=1$. Prove that it is the closest element.

I think what I need to do is find the orthogonal projection of $g$ onto $S$. I'm not exactly sure how I would go about doing that. Any help would be appreciated.

Note that $$S=(1+x)^\perp$$ Thus $S$ is closed and so we know, by the projection theorem, that there's a unique $f\in S$ such that $||f-g||=\min_{h\in S}\{||h-g||\}$. Furthermore, this $f$ is the unique element of $S$ satisfying $(f-g)\perp S$. But $$S^\perp = ((1+x)^\perp)^\perp=\overline{(1+x)}=1+x$$ so we can solve for $f$.
• Great answer, although (minor objection) it seems confusing to me to not distinguish between $1+x$ and the subspace generated by $1+x$. You're also not distinguishing between the function $x \mapsto 1+x$ and the expression $1+x$, but I think that's more common and excusable. – 6005 Aug 27 '16 at 0:15