So I have a question regarding best-fit polynomials. Currently, using matrices and then Gaussian elimination, I come up with f(x) = Ax^2 + Bx + C and use the derivative of that fit to come up with the estimated minimum.
However, some times the coefficient of A comes back negative, where of course then f'(x) = 0 will then define the maximum.
So what I want to know is how can I force the calculation of the best fit line with A > 0?
Background on how I'm calculating it:
$$ \begin{vmatrix} \mathbf{n} & \mathbf{\sum_{} \mathbf{X}_i} & \mathbf{\sum_{} \mathbf{X}_i^2} \\ \mathbf{\sum_{} \mathbf{X}_i} & \mathbf{\sum_{} \mathbf{X}_i^2} & \mathbf{\sum_{} \mathbf{X}_i^3} \\ \mathbf{\sum_{} \mathbf{X}_i^2} & \mathbf{\sum_{} \mathbf{X}_i^3} & \mathbf{\sum_{} \mathbf{X}_i^4} \end{vmatrix} \begin{vmatrix} \mathbf{C}\\ \mathbf{B}\\ \mathbf{A}\\ \end{vmatrix} = \begin{vmatrix} \mathbf{\sum_{} \mathbf{Y}_i}\\ \mathbf{\sum_{} \mathbf{X}_i \mathbf{Y}_i}\\ \mathbf{\sum_{} \mathbf{X}_i^2 \mathbf{Y}_i}\\ \end{vmatrix} $$
So n = # of points etc... Then Gaussian elimination to solve for A B & C.
I thought just negating A, and although it flips the curve (causes it to curve upward), it appears after graphing the function in excel that it does not seem quite right.
.
The blue points are the actual x,y points. The black poly fit line is the best fit quadratic as determined by excel and the above calculation, with the equation of that line in the graph (A = -0.02). The red best fit line has A = 0.02.
Thank you in advanced!
There does not have to be a best fit when you require $A>0$. The best you can do is require $A\geq 0$. In that case proceed as follows: