Minimizing an integral -- Hilbert space 
Find the real values of $a, b$ which minimize $$\int_1^{\infty}
 \left| \frac{1}{x^2} - a \frac{1}{x^3} - b\frac{1}{x^4}\right|^2 \;
 dx.$$ Hint : Work in an appropriate Hilbert space.

Here is why I tried :


*

*First I noticed that we can work in the vector space $X:= \mathcal{C}\Big([1, \infty), \mathbb{R}\Big)$ endowed with the $\|\cdot\|_2$ norm. Consider the subspace $$ Y :=~ \text{Span}\left\{ \frac{1}{x^3}, \frac{1}{x^4}\right\}$$ and the function $f(x) := \frac{1}{x^2}$. We're thus aiming at identifying a function $y \in Y$ minimizing
$$\big\| f - u \big\|_2.$$

*I've applied the Gram-Schmidt process to obtain an orthonormal basis $\{e_1, e_2\}$ of $Y$. The first one was easy but computing the second was nightmare.

*I computed the projection
$$ \text{Proj}_Y(f) ~=~ \langle f, e_1\rangle e_1 + \langle f, e_2 \rangle e_2.$$

*The function $f - \text{Proj}_Y(f)$ minizes the above integral. So all that remains to be done is to regroup the terms in $x^{-3}$ and $x^{-4}$ in $\text{Proj}_Y(f)$ to get the constants $a$ and $b$.


Is this the good way to tackle this kind of problem ? Is it me or the computations rapidly get tedious (way too much to reasonably expect anyone this question in an exam context for instance) ? Am I right in thinking that we would not get the right answer if we skip the Gram-Schmidt process step ?
 A: I'm not totally sure what the hint is getting at (perhaps consider the integral as the $L^2$ inner product of $f(x) = \frac 1 {x^2} - a\frac 1 {x^3} - b \frac 1 {x^4}$ with itself), but regardless this seems like a simple calculus problem to me. Put \begin{align*} I(a,b) &= \int^\infty_1 \left( \frac 1 {x^2} - a\frac 1 {x^3} - b \frac 1 {x^4} \right)^2 dx \\
&= \int^\infty_1 \frac{1}{x^4} + a^2 \frac{1}{x^6} + b^2 \frac{1}{x^8} - 2a \frac{1}{x^5} - 2b \frac{1}{x^6} + 2ab \frac{1}{x^7} dx \\
&= \frac 1 3 + \frac{a^2}{5} + \frac{b^2}{7} - \frac{a}{2} -\frac{2b}{5} + \frac{ab}{3}.
\end{align*} Now just minimize using techniques from multivariable calculus.
A: With the change of variable $x=\frac{1}{u}$ we are left with:
$$ \min_{a,b} \int_{0}^{1}\left(x-ax^2-bx^3\right)^2\,dx $$
and now we may exploit the fact that shifted Legendre polynomials give a complete orthogonal base of $L^2(0,1)$ with respect to the usual inner product. Since:
$$ P_0(2x-1) = 1,\quad P_1(2x-1)=2x-1,\quad P_2(2x-1)=6x^2-6x+1,\quad P_3(2x-1)=20x^3-30x^2+12x-1 $$
by letting $Q_n(x)=P_n(2x-1)$ we have:
$$ 2x = Q_0(x)+Q_1(x),\quad 6x^2=Q_2(x)+3 Q_1(x)+2Q_0(x),\quad 20x^3= Q_3(x)+5Q_2(x)+9Q_1(x)+5Q_0(x)$$
and:
$$ x-ax^2-bx^3 = \left(\frac{1}{2}-\frac{a}{6}-\frac{b}{4}\right) Q_0(x)+\left(\frac{1-a}{2}-\frac{9b}{20}\right)Q_1(x)+\left(-\frac{a}{6}-\frac{b}{4}\right)Q_2(x)+\left(-\frac{b}{20}\right)Q_3(x)$$
so that, by Parseval's identity, the $L^2$ norm we want to minimize is given by:
$$N(a,b)=\frac{1}{3}-\frac{a}{2}+\frac{a^2}{5}-\frac{2 b}{5}+\frac{a b}{3}+\frac{b^2}{7}$$
and by letting $\frac{\partial N}{\partial a}=\frac{\partial N}{\partial b}=0$ we get the stationary point
$$ (a,b)=\color{red}{\left(3,-\frac{21}{10}\right)}$$
and the associated minimum $\color{red}{\large\frac{17}{60}}$.
