# Thread: Least Squares Solution for a Parabola

1. ## Least Squares Solution for a Parabola

Hi there,

I have a set of data points

{(X1,Y1), (X2,Y2),........(Xn,Yn)}

I would like to approximate the relation between X and Y as a parabola. Assuming the parabola has form y = Ax^2+Bx+C, can somebody please provide me with the least squares regression formulas for A, B and C.

Any help is greatly appreciated.

Thanks,

AP

2. This is very simple. Use matrices. I'll use your model as is... $y = Ax^2+Bx+C$.
We don't need the epsilon since we are only fitting a curve.
Using your model the design matrix consists of three columns.

The first column is $x_1^2$ through $x_n^2$, the second column is $x_1$ through $x_n$ and the last column is all 1's.

The vector Y consists of $y_1$ through $y_n$.

The solution is the vector $\hat\beta^t=(\hat A, \hat B, \hat C)^t$

where $\hat\beta=(X^tX)^{-1}X^tY$

3. MathEagle,

Thanks for your reply. Unfortunately, matices to me, are like chinese to an englishman........

The general matrix solution for the regression of a polynomial of any degree is all over the web. But I dont get it.

I was looking for a specific solution to the parabola regression. Something that has a heap of "sum of XiYi" and "sum of Xi squared"..........

Any chance you could help with that??

Thanks again,

AP

4. Well, that makes our work harder.
I bet I can find it on the web.
One can solve it by differentiating and obtaining the normal equations.

$\sum_{i=1}^n(y_i-ax_i^2-bx_i-c)^2$
with respect to a,b,c and setting each equal to zero.

But now you'll tell me you never had calculus.

I figured I could find it on the web, matrices is better and they didn't finish it either.
They have just one more step after what I told you to do.
http://www.efunda.com/math/leastsqua...sqr2dcurve.cfm
I googled parabolic least squares, maybe you cna find other useful links.
I'm sure others have done this.
But between matrices and JMP on my pc I don't need to look at the normal equations.

Here's more with a parabolic fit, but I see matrices and a weird looking robot
http://www.bsu.edu/web/jkshim/mathan...eastsquare.htm

5. MathEagle,

I do have calculus, and I should understand matrices (a long, long time ago I did a degree in mathematics). I have been trying to solved the equations for the past 2 days, and I just keep stuffing it up. Thus, I was hoping someone had it in a nice neat form for me.

I have previously found the pages you suggest. The robot was a mystery to me also.

Thanks for you time and effort.

AP.

6. try the following page for the normal equations to fit a parabola in summation form
mixture: normal equation to fit a parabola

for a straight line
http://keral2008.blogspot.com/2009/0...of-y-on-x.html

7. As I stated yesterday, the normal equations can be found in the box in Least-Squares Parabola

8. Eagle and QP,

Thanks very much for your help, I am all sorted now.

To be honest, I am more than a little embarrassed I couldn't sort this out for myself.

Cheers,

AP