# What straight line is closest to x^3 over the interval −1 ≤ x ≤ 1?

• March 18th 2011, 07:06 PM
leesperare
What straight line is closest to x^3 over the interval −1 ≤ x ≤ 1?
I'm studying for a test, and this is one of the practice problems:

Quote:

What straight line is closest to x^3 over the interval −1 ≤ x ≤ 1?
I have the answer, but can't make much sense of it:

Quote:

((x^3, 1)/(1, 1)) · 1 + ((x^3, x)/(x, x)) · x = ((1/2)/(2/3))x .

Here, (f,g) = Integral from -1 to 1 of (f·g dx).
I figure this has something to do with least squares, since you're trying to fit a line to a curve, but other than that I'm lost.

Could someone please provide a detailed explanation of the above solution? It would highly benefit my understanding of the material. Thank you!
• March 19th 2011, 01:20 AM
FernandoRevilla
Quote:

Originally Posted by leesperare
I figure this has something to do with least squares, since you're trying to fit a line to a curve, but other than that I'm lost.

We have to find the orthogonal projection of $x^3$ over the subspace of $\mathbb{R}[x]$ :

$F=\{f:[-1,1]\to \mathbb{R},\;f(x)=a+bx\}$

A basis of $F$ is $B=\{1,x\}$ . As $\int_{-1}^11\cdot x\;dx=0$ then, $B'=\{1/\sqrt{(1,1)},x/\sqrt{(x,x)}\}$ is an orthonormal basis of $F$ . Now, apply a well known theorem.
• March 19th 2011, 02:38 AM
chisigma
Quote:

Originally Posted by leesperare
I'm studying for a test, and this is one of the practice problems:

I have the answer, but can't make much sense of it:

I figure this has something to do with least squares, since you're trying to fit a line to a curve, but other than that I'm lost.

Could someone please provide a detailed explanation of the above solution? It would highly benefit my understanding of the material. Thank you!

If 'closest' is in the 'least square sense' , then the coefficients of 'best polynomial' of order n approximating y(x) in [-1,1] minimize the quantity...

$\displaystyle I= \int_{-1}^{1} [y(x) - \sum_{k=0}^{n} a_{k}\ P_{k} (x)]^{2}\ dx$ (1)

... where $P_{k}(x)$ is the Legendre Polynomial of order k. The $a_{k}$ minimizing (1) are found with standard procedure to be...

$\displaystyle a_{k}= \frac{2k+1}{2}\ \int_{-1}^{1} y(x)\ P_{k}(x)\ dx$ (2)

In Your case is $y(x)=x^{3}$ , $n=1$, $P_{0}=1$ and $P_{1}=x$, so that...

$\displaystyle a_{0}= \frac{1}{2}\ \int_{-1}^{1} x^{3}\ dx$

$\displaystyle a_{1}= \frac{3}{2}\ \int_{-1}^{1} x^{4}\ dx$ (3)

Kind regards

$\chi$ $\sigma$