3

Determine the constants $a$ and $b$ for the integral $$ \int\limits _{0}^{1}(ax+b-f(x))^{2} dx$$ take the smallest possible value if $f(x)=(x^{2}+1)^{-1}$

thanks

Wmmoreno
  • 281

2 Answers2

3

Let $V$ be the vector space of all polynomials over $\mathbb{R}$ and let $U$ be the vector space spanned by the vectors $1$ and $x$. Furthermore, let $P_U$ denoted the orthogonal projection of $V$ onto $U$. Define an inner product on $V$ by $\langle f, g\rangle =\int_0^1 f(x)g(x) dx$. There is a well-known theorem in linear algebra saying that $$\|f-P_Uf\|\le \|f-g\|$$ for every $g\in U$.

Hence, we're done if we can find $P_Uf$, when $f=\frac{1}{x^2+1}$. If $(e_1, e_2)$ is an orthonormal basis of $U$, then $$P_Uf=\langle f, e_1\rangle e_1+\langle f, e_2\rangle e_2,$$ so we need to find $e_1$ and $e_2$. Gram-Schmidt implies \begin{align} e_1&=\frac{1}{\| 1\|}=1\\ e_2&=\frac{x-\langle x, e_1\rangle e_1}{\|x-\langle x, e_1\rangle e_1\|}=2\sqrt{3}\left(x-\frac{1}{2}\right) \end{align} and finally \begin{align} P_Uf&=\langle \frac{1}{x^2+1}, 1\rangle 1+\langle \frac{1}{x^2+1},x-\frac{1}{2} \rangle 12\left(x-\frac{1}{2}\right)=\\ &=\frac{3}{2}\left(4\log 2-\pi\right)x+\pi-3\log 2 \end{align} and so $a=\frac{3}{2}\left(4\log 2-\pi\right)$ and $b=\pi-3\log 2$.

Kortlek
  • 1,103
0

This is an alternative approach to Ron Ford's answer, with more of an optimization flavor. The advantage of this approach is that it can be used in much more complicated situations without much modification.

We have an objective function $$J(a,b) = \int_0^1 (ax+b-f(x))^2 dx.$$

A necessary condition for optimality is that the gradient of the objective is zero. That is, $$0 = G(a,b):=\begin{bmatrix}\frac{dJ}{da} \\ \frac{dJ}{db}\end{bmatrix}.$$

These gradient components $\frac{dJ}{da}, \frac{dJ}{db}$, can be computed by differentiating under the integral sign, yielding \begin{align} \frac{dJ}{da} &= \frac{d}{da}\int_0^1 (ax+b-f(x))^2 dx \\ &= \int_0^1 2x(ax + b - f(x))dx \\ &= a \int_0^1 2x^2 dx + b \int_0^1 2x dx - \int_0^1 2xf(x) dx \\ \end{align} We can evaluate these integrals analytically to simplify the expression: $$\frac{dJ}{da} = a \cdot 2/3 + b \cdot 1 - \log 2$$

A similar computation yields an analogous result for $\frac{dJ}{db}$: \begin{align} \frac{dJ}{db} &= a \int_0^1 2xdx + b \int_0^1 2 dx - \int_0^1 2 f(x) dx\\ &= a \cdot 1 + b \cdot 2 - \pi/2 \end{align}

Altogether requiring that the gradient is zero is equivalent to solving the following linear system: $$\begin{bmatrix}\frac{dJ}{da} \\ \frac{dJ}{db}\end{bmatrix} = 0 \quad \Leftrightarrow \quad \begin{bmatrix}2/3 & 1 \\ 1 & 2\end{bmatrix}\begin{bmatrix}a \\ b\end{bmatrix} = \begin{bmatrix}\log 2 \\ \pi/2\end{bmatrix},$$ which has solution $a = -\frac{3}{2}\pi + 6 \log 2$, $b = \pi - 3 \log 2$.

The Hessian is (everywhere) the matrix, $$\begin{bmatrix}2/3 & 1 \\ 1 & 2\end{bmatrix},$$ which is positive definite. This implies that the objective function is convex, which implies that the point where the gradient is zero is indeed the one and only minimum.

Nick Alger
  • 18,844