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:

Solution: The answer is:

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