Say for example I have a set of coordinate pairs as follows:
x y
0 100
20 90
100 0
I would like to generate an equation for this curve In the following format:
$$y = ax^2 + bx + c$$
Based on the example data the result that I obtained from Excel is:
$$y = -0.0063x^2 - 0.375x + 100$$
So, my question is, how would I be able to come up with $a, b, c$ on my own if I had to do it by hand. I need this for a program I am writing in c#, but I'm just not sure where to begin with the math.
You want to use the general form for a parabola and "plug in" the correct values in order to obtain the coefficients. Like so:
$$ax^2+bx+c=y$$
But we have three different equations:
$$100=a(0)^2+b(0)+c$$ $$90=a(20)^2+b(20)+c$$ $$0=a(100)^2+b(100)+c$$
Well, it immediately follows that $c=100$, so we can alter our equations:
$$90=a(20)^2+b(20)+100$$ $$0=a(100)^2+b(100)+100$$
Here, subtract $100$ from both equations and solve as you would any system of 2 linear equations.
My recommendation is to multiply the second equation by $(-1/5)$ and add it to the first.
Edit
So, hopefully you will agree that
$$0=a(100)^2+b(100)+100$$ and $$-\frac{1}{5} [0=a(100)^2+b(100)+100]$$
are the same equation. But then
$$-\frac{1}{5} [0=a(100)^2+b(100)+100]$$ is the same as $$0=-a\frac{(100)^2}{5}-b(20)-20]$$
You now take the 1st equation and add it to the second (some people call this solving a system of equations by elimination:
$$0=-a\frac{(100)^2}{5}-b(20)-20]$$ $$+[90=a(20)^2+b(20)+100]$$
from this we can obtain the final equation only in terms of $a$:
$$90=-a\frac{(100)^2}{5}+a(20)^2+80$$
from here, it is trivial to solve for $a$, and the by substitution obtain the value for $b$.
I hope that was clearer.