That's essentially what was requested in the first part of a problem my daughter asked me some explanation about the other day. Incidentally I had worked on a similar problem involving four points that morning and had used my HP-50g to solve the corresponding system of linear equations. But calculators are not allowed in her class, so I had to find another method. Her teacher's solution used Gauss elimination which doesn't involve many calculations in a 3x3 system, but a mistake done in the beginning leads to completely wrong answers (like mine, when doing it by hand that way). I don't like this kind of problem being posed to students, I mean problems involving number crunching when a calculator is not available. On the other hand, according to her math textbook, this problem had been asked on the admittance exam of an important university here (UNICAMP), so her teacher is not wrong by occasionally asking a bit of hand calculations from his students. However, I decided to find a faster method, perhaps an easier-to-remember formula, considering the time per question is usually short during this kind of exams.

Here is my approach:

Given three points

PFor instance, using the data points from the textbook,_{1}= (x_{1}, y_{2})

P_{2}= (x_{2}, y_{2})

P_{3}= (x_{3}, y_{3})

P1 = (1, 2)find the equation of the corresponding parabola,

P2 = (2, 2.7)

P3 = (3, 3.2)

y = axThe solution consists basically in solving a system of linear equations:^{2}+ bx + c

yOr, in matrix form,_{1}= ax_{1}^{2}+ bx_{1}+ cy

_{2}= ax_{2}^{2}+ bx_{2}+ cy

_{3}= ax_{3}^{2}+ bx_{3}+ c

/ \ / \ / \Rather than solving it numerically, it should be better to solve it symbolically. Thus the resulting formula may be used again to solve similar problems, avoiding unnecessary and heavy matrix calculations.

| x_{1}^{2}x_{1}1 | | a | | y_{1}|

| | | | | |

| x_{2}^{2}x_{2}1 | | b | = | y_{2}|

| | | | | |

| x_{3}^{2}x_{3}1 | | c | | y_{3}|

\ / \ / \ /

The determinant of the square matrix above, a Vandermonde Matrix, is very easy to compute, requiring only three subtractions and three multiplications. Also not difficult to calculate are the other matrices associated to the Cramer's Rule for this system. So, that method appears to be more adequate to be used here:

| y

_{1}x_{1}1 | | x_{1}^{2}y_{1}1 | | x_{1}^{2}x_{1}y_{1}|

| | | | | |

| y_{2}x_{2}1 | | x_{2}^{2}y_{2}1 | | x_{2}^{2}x_{2}y_{2}|

| | | | | |

| y_{3}x_{3}1 | | x_{3}^{2}y_{3}1 | | x_{3}^{2}x_{3}y_{3}|

a = ------------------- ; b = ------------------- ; c = -------------------

| x_{1}^{2}x_{1}1 | | x_{1}^{2}x_{1}1 | | x_{1}^{2}x_{1}1 |

| | | | | |

| x_{2}^{2}x_{2}1 | | x_{2}^{2}x_{2}1 | | x_{2}^{2}x_{2}1 |

| | | | | |

| x_{3}^{2}x_{3}1 | | x_{3}^{2}x_{3}1 | | x_{3}^{2}x_{3}1 |

y

_{1}(x_{2}- x_{3}) + y_{2}(x_{3}- x_{1}) + y_{3}(x_{1}- x_{2})

a = ---------------------------------------

(x_{1}- x_{3})(x_{2}- x_{3})(x_{1}- x_{2})

y_{1}(x_{3}^{2}- x_{2}^{2}) + y_{2}(x_{1}^{2}- x_{3}^{2}) + y_{3}(x_{2}^{2}- x_{1}^{2})

b = ---------------------------------------------------

(x_{1}- x_{3})(x_{2}- x_{3})(x_{1}- x_{2})

y_{1}(x_{2}^{2}x_{3}- x_{3}^{2}x_{2}) + y_{2}(x_{3}^{2}x_{1}- x_{1}^{2}x_{3}) + y_{3}(x_{1}^{2}x_{2}- x_{2}^{2}x_{1})

b = ---------------------------------------------------------------

(x_{1}- x_{3})(x_{2}- x_{3})(x_{1}- x_{2})

or, more mnemonically,

yNow, solving for the original numerical example:_{1}y_{2}y_{3}

a = ------------------ + ------------------ + ------------------

(x_{1}- x_{2})(x_{1}- x_{3}) (x_{2}- x_{1})(x_{2}- x_{3}) (x_{3}- x_{1})(x_{3}- x_{2})

y_{1}(x_{2}+ x_{3}) y_{2}(x_{3}+ x_{1}) y_{3}(x_{1}+ x_{2})

b = - ------------------ - ------------------ - ------------------

(x_{1}- x_{2})(x_{1}- x_{3}) (x_{2}- x_{1})(x_{2}- x_{3}) (x_{3}- x_{1})(x_{3}- x_{2})

y_{1}x_{2}x_{3}y_{1}x_{3}x_{1}y_{3}x_{1}x_{2}

c = ------------------ + ------------------ + ------------------

(x_{1}- x_{2})(x_{1}- x_{3}) (x_{2}- x_{1})(x_{2}- x_{3}) (x_{3}- x_{1})(x_{3}- x_{2})

x_{1}= 1 y_{1}= 2

x_{2}= 2 y_{2}= 2.7

x_{3}= 3 y_{3}= 3.22 2.7 3.2 2 2.7 3.2 .

a = --------------- + --------------- + --------------- = --- + ----- + ----- . . a = -0.1

(1 - 2)*(1 - 3) (2 - 1)*(2 - 3) (3 - 1)*(3 - 2) 2 -1 2

2*(2 + 3) 2.7*(3 + 1) 3.2*(1 + 2) -10 -10.8 -9.6 .

b = - --------------- - --------------- - --------------- = --- + ----- + ----- . . b = 1.0

(1 - 2)*(1 - 3) (2 - 1)*(2 - 3) (3 - 1)*(3 - 2) 2 -1 2

2*2*3 2.7*3*1 3.2*1*2 12 8.1 6.4 .

c = --------------- + --------------- + --------------- = --- + ----- + ----- . . c = 1.1

(1 - 2)*(1 - 3) (2 - 1)*(2 - 3) (3 - 1)*(3 - 2) 2 -1 2

.

. . y = -0.1*x^{2}+ x + 1.1

Here is a QBASIC program that handles the cases from n = 2 through 4, that is, linear, quadratic, cubic and biquadratic equations, where n is the number of data points:

DEFDBL A-H, O-Z: DEFINT I-N

DO UNTIL N > 1 AND N < 5

CLS

INPUT "N: ", N

LOOP

DIM A(N), X(N), Y(N)

FOR I = 1 TO N

A(I) = 0

PRINT "X("; I; "), "; "Y("; I; ") ";

INPUT "", X(I), Y(I)

NEXT I

FOR I = 1 TO N

P = 1

FOR J = 1 TO N - 1

P = P * (X(I) - X(1 + (J + I - 1) MOD N))

NEXT J

T = Y(I) / P

A(1) = A(1) + T

M = N - 1

S% = 1

FOR K = 2 TO N

S% = -S%

IF K = N THEN M = 1

S = 0

FOR J = 1 TO M

P = 1

FOR L = 1 TO K - 1

P = P * X(1 + (I + (L - 2 + J) MOD (N - 1)) MOD N)

NEXT L

S = S + P

NEXT J

A(K) = A(K) + S% * T * S

NEXT K

NEXT I

FOR I = 1 TO N

PRINT "P("; I; ") = ("; X(I); ","; Y(I); ")"

NEXT I

FOR I = 1 TO N

PRINT "A("; N - I; ") = "; A(I)

NEXT I

END

Examples:

---------------------------------------

N: 3X( 1 ), Y( 1 ) 1,2

X( 2 ), Y( 2 ) 2,2.7

X( 3 ), Y( 3 ) 3,3.2

P( 1 ) = ( 1 , 2 )

P( 2 ) = ( 2 , 2.7 )

P( 3 ) = ( 3 , 3.2 )A( 2 ) = -.1000000000000001

A( 1 ) = 1

A( 0 ) = 1.1---------------------------------------

---------------------------------------

N: 4

X( 1 ), Y( 1 ) 1,5

X( 2 ), Y( 2 ) 2,41

X( 3 ), Y( 3 ) 3,127

X( 4 ), Y( 4 ) 4,269

P( 1 ) = ( 1 , 5 )

P( 2 ) = ( 2 , 41 )

P( 3 ) = ( 3 , 127 )

P( 4 ) = ( 4 , 269 )A( 3 ) = 1.000000000000007

A( 2 ) = 18.99999999999999

A( 1 ) = -28.00000000000005

A( 0 ) = 12.99999999999999

---------------------------------------