The main purpose of this page is to serve as a gallery of work I've done. It also gives me a handy URL on which to post my résumé.
A couple of years ago, I wrote a simple program in C that lets you drag three different points around on the screen. These points would be used to calculate a parabola that they all lie on, and plot that parabola on the screen. The algebra used in working out the function for the parabola is relatively easy to do, and that is the subject of this blog.
As you may recall, a parabola can be represented using a quadratic equation:
The work then is pretty straightforward. We'll take the x and y coordinates of any three points (where no two have the same x value), and plug each pair of values into the equation above. With each of them we can solve for either a, b or c. Once we have any of those three terms calculated, we'll substitute it into one of our other solutions, eliminating that variable. Repeating this process will eliminate all three of them, defining them strictly in terms of our three given points.
The points in this case will be defined as (x1, y1),(x2, y2). and (x3, y3). We'll start with the simplest one, solving for c:
Next we'll solve for b, by using (x2, y2) for our x and y values, while replacing c with the equation above
Now we have a solution for c given b and a, and a solution for b given a. Next we'll find our solution for a, and put the whole thing together.
And now we have our three coefficients, and can use our original quadratic equation to calculate the y co-ordinate of any point on the curve given its x co-ordinate.