# How to generate a formula of a graph with three key points

I have three key points on a graph. How do I find out what the formula for this graph would be? The points are: (3,0) (5,2) (7,6). It is known that the graph will be a quadratic. Thanks

-
"quadratic" means parabola? – Vitaliy Kaurov Oct 18 '12 at 6:06
Try InterpolatingPolynomial[{{3, 0}, {5, 2}, {7, 6}}, x] or LinearAlgebraVandermondeSolve[{3, 5, 7}, {0, 2, 6}, Transpose -> True].x^Range[0, 2]. – J. M. Oct 18 '12 at 7:37

You can try Fit:

Fit[{{3, 0} , {5, 2}, {7, 6}}, {1, x, x^2}, x]


The graph can be generated by:

Plot[Evaluate@Fit[{{3, 0} , {5, 2}, {7, 6}}, {1, x, x^2}, x], {x, 2, 8}]


For your case, another approach is to solve the equations generated by the given points:

exp = a x^2 + b x + c ;
eqn = Table[((exp == y ) /. {x -> i[[1]], y -> i[[2]]}),
{i, {{3, 0} , {5, 2}, {7, 6}}}];
sol = Solve[eqn, {a, b, c}]
Plot[exp /. sol, {x, 2, 8}]
`

Of course, this solution will not work if the number of points increases and some of these points are not located on the curve.

-