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

1. ## 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:

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:

((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!

2. 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 $\displaystyle x^3$ over the subspace of $\displaystyle \mathbb{R}[x]$ :

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

A basis of $\displaystyle F$ is $\displaystyle B=\{1,x\}$ . As $\displaystyle \int_{-1}^11\cdot x\;dx=0$ then, $\displaystyle B'=\{1/\sqrt{(1,1)},x/\sqrt{(x,x)}\}$ is an orthonormal basis of $\displaystyle F$ . Now, apply a well known theorem.

3. 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 \displaystyle I= \int_{-1}^{1} [y(x) - \sum_{k=0}^{n} a_{k}\ P_{k} (x)]^{2}\ dx$ (1)

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

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

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

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

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

Kind regards

$\displaystyle \chi$ $\displaystyle \sigma$