Finding Best-fit Curve from Points I am given the set of data points:
$(1,2), (0,1), (-1,0), (-2,3)$
I am trying to find the best fit curve in the space:
$f(x) = ax^2 + bx + c \;\;\;a,b,c \in R$
How do I go about doing this? I was looking at:
http://en.wikipedia.org/wiki/Linear_least_squares_%28mathematics%29#Motivational_example
but I am confused when I get to the partial derivatives part.
Any help would be appreciated.
Thanks
 A: You have this tagged as linear algebra, but so far all the answers seem to be using Calculus.
Let matrix $A$ be the matrix created from the system of equations that result from plugging each point into $f(x)$ and $y$ be the matrix containing the values of $f(x)$ In this particular case, 
$A = \begin{bmatrix} 4 & -2 & 1\\ 1 & -1 & 1\\ 0 & 0 & 1\\ 1 & 1 & 1\end{bmatrix}$
$y = \begin{bmatrix} 3 \\ 0 \\ 1\\ 2 \end{bmatrix}$
Recall that for a non-singular matrix $A$, the least squared solution $\bar{x}$ is the solution to the normal equations (Your textbook should explain why). Thus, by solving the normal equations, you effectively find the values of $a,b,c$ that create the least squares solution.
The normal equations are $(A^TA)\bar{x} = A^Ty$
A: $f(-2) = 4a - 2b + c$
$f(-1) = a - b + c$
$f(0) = c$
$f(1) = a + b + c$
If your definition of "best fit curve" is "least squares," then the problem is:

Choose $a, b, c$ to minimize $(4a - 2b + c - 3)^2 + (a - b + c)^2 + (c - 1)^2 + (a + b + c - 2)^2$

Take the derivative of your expression with respect to $a, b, c$, and set each of these expressions equal to $0$.  This will give you three equations in three unknowns.  Solve those equations and you get values for $a, b, c$.
A: You calculate the error of your fit to the data points, square them and add them up.  For the first point, the error is $2-(a+b+c)$  For the second, it is $1-c$ and so on.  You will get $S(a,b,c)=(2-(a+b+c))^2+(1-c)^2+$two more terms.  This is what we want to minimize.  In the usual calculus fashion, you minimize by taking a derivative.  Here you have three variables, so you take the derivative of $S(a,b,c)$ with respect to each one.  The partial means that you consider the other variables to be fixed.  So for the first two terms of $S(a,b,c)$ we have $\frac {\partial S(a,b,c)}{\partial c}=2(2-(a+b+c))(-1)+2(1-c)(-1)=-2+2a+2b+4c$  You take the other two as well and set them all to zero.  This will give you three equations in three unknowns to solve for $a,b,c$
