Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I'm trying to define a quadratic that can pass through any 3 points. I've obviously done something wrong but can't figure out where. Any help would be appreciated.

$$ ax_1^2 + bx_1 + c = y_1 $$ $$ ax_2^2 + bx_2 + c = y_2 $$ $$ ax_3^2 + bx_3 + c = y_3 $$

Solve for C using the first equation

1$$ ax_1^2 + bx_1 + c = y_1 $$ 2$$ ax_1^2 + bx_1 - y_1 = -c $$ 3$$ -ax_1^2 - bx_1 + y_1 = c $$ 4$$ c = -ax_1^2 - bx_1 + y_1 $$

Now substitute C and solve be B using the second equation

5$$ ax_2^2 + bx_2 + c = y_2 $$ 6$$ ax_2^2 + bx_2 - ax_1^2 - bx_1 + y_1 = y_2 $$ 7$$ a(x_2^2 - x_1^2) + b(x_2 - x_1) = y_2 - y_1 $$ 8$$ b(x_2 - x_1) = y_2 - y_1 - a(x_2^2 - x_1^2) $$ 9$$ b = \frac{y_2 - y_1 - a(x_2^2 - x_1^2)}{(x_2 - x_1)} $$

Ok, now substitute B and C and solve A using the third equation

10$$ ax_3^2 + bx_3 + c = y_3 $$ $$ ax_3^2 + bx_3 - ax_1^2 - bx_1 + y_1 = y_3 $$

11$$ ax_3^2 + x_3\left(\frac{y_2 - y_1 - a(x_2^2 - x_1^2)}{(x_2 - x_1)}\right) - ax_1^2 - x_1\left(\frac{y_2 - y_1 - a(x_2^2 - x_1^2)}{(x_2 - x_1)}\right) + y_1 = y_3 $$

12$$ ax_3^2 - ax_1^2 + \frac{x_3(y_2 - y_1) - x_3a(x_2^2 - x_1^2)}{x_3(x_2 - x_1)} + \frac{-x_1(y_2 - y_1) + x_1a(x_2^2 - x_1^2)}{-x_1(x_2 - x_1)} = y_3 - y_1 $$

13$$ ax_3^2 - ax_1^2 + \frac{-x_1x_3(y_2 - y_1) + x_1x_3a(x_2^2 - x_1^2)}{-x_1x_3(x_2 - x_1)} + \frac{-x_1x_3(y_2 - y_1)+ x_1x_3a(x_2^2 - x_1^2)}{-x_1x_3(x_2 - x_1)} = y_3 - y_1 $$

14$$ ax_3^2 - ax_1^2 + \frac{-x_1x_3(y_2 - y_1) + x_1x_3a(x_2^2 - x_1^2) - x_1x_3(y_2 - y_1) + x_1x_3a(x_2^2 - x_1^2)}{-x_1x_3(x_2 - x_1)} = y_3 - y_1 $$

15$$ ax_3^2 - ax_1^2 + \frac{(y_2 - y_1) - a(x_2^2 - x_1^2) + (y_2 - y_1) - a(x_2^2 - x_1^2)}{(x_2 - x_1)} = y_3 - y_1 $$

16$$ a(x_3^2 - x_1^2) + \frac{2(y_2 - y_1) - 2a(x_2^2 - x_1^2)}{(x_2 - x_1)} = y_3 - y_1 $$

17$$ a(x_3^2 - x_1^2) + \frac{2(y_2 - y_1)}{(x_2 - x_1)} + \frac{ -2a(x_2^2 - x_1^2) }{(x_2 - x_1)} = y_3 - y_1 $$

18$$ a(x_3^2 - x_1^2) + \frac{2(y_2 - y_1)}{(x_2 - x_1)} -2a(x_2 - x_1) = y_3 - y_1 $$

19$$ a(x_3^2 - x_1^2) -2a(x_2 - x_1) = y_3 - y_1 - \frac{2(y_2 - y_1)}{(x_2 - x_1)} $$

20$$ a((x_3^2 - x_1^2) -2(x_2 - x_1)) = y_3 - y_1 - \frac{2(y_2 - y_1)}{(x_2 - x_1)} $$

21$$ a = \left(y_3 - y_1 - \frac{2(y_2 - y_1)}{(x_2 - x_1)} \right) / \left((x_3^2 - x_1^2) -2(x_2 - x_1)\right) $$

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

A simpler approach: from $a x_1^2 + b x_1 + c = y_1$ and $a x_2^2 + b x_2 + c = y_2$ you get $a (x_1^2 - x_2^2) + b (x_1 - x_2) = y_1 - y_2$, so (noting that $x_1^2 - x_2^2 = (x_1 - x_2)(x_1 + x_2)$), $b = \dfrac{y_1 - y_2}{x_1 - x_2} - a (x_1 + x_2)$.
Similarly $b = \dfrac{y_1 - y_3}{x_1 - x_3} - a (x_1 + x_3)$. Subtract these: $$0 = \dfrac{y_1 - y_2}{x_1 - x_2} - \dfrac{y_1 - y_3}{x_1 - x_3} - a(x_2 - x_3)$$ so $$a = \dfrac{\dfrac{y_1 - y_2}{x_1 - x_2} - \dfrac{y_1 - y_3}{x_1 - x_3}}{x_2 - x_3}$$

share|improve this answer
    
Thanks, I'm starting to understand this although I'm having difficulty understanding how you got $ -a(x_2-x_3) $ by subtracting the two definitions of b. How does $$ b - b = \frac{y_1-y_2}{x_1-x_2} -\frac{y_1-y_3}{x_1-x_3} - a(x_1+x_2)- a(x_1+x_3) $$ go to $$ b - b = \frac{y_1-y_2}{x_1-x_2} -\frac{y_1-y_3}{x_1-x_3} - a(x_2-x_3) $$ –  user346443 Jul 9 '12 at 9:59
    
@user346443: it's $-a(x_1+x_2) + a(x_1 + x_3)$ –  Robert Israel Jul 9 '12 at 17:04
    
Ah yeah. I am now embarrassed. Thanks heaps for the solution. –  user346443 Jul 10 '12 at 3:55
add comment

Hint: The calculations are too elaborate. Why do we have $c_1$, $c_2$, and $c_3$? There is one and only one constant term $c$. It can be easily eliminated, resulting in two linear equations involving the unknowns $a$ and $b$.

For the elimination process, solving and substituting works, but is not a good idea. Take the first two equations, subtract. Now $c$ is gone. Take the second equation and the third, subtract. Again, $c$ is gone. We now have two linear equations for $a$ and $b$. Eliminate $b$ by multiplying the first new equation through by $x_2-x_3$, and the second new equation by $x_1-x_2$, so that the coefficients of $b$ match. Subtract, and solve for $a$. Do not expand anything you do not need to.

For a fancier approach that generalizes nicely, look up the Vandermonde Determinant.

Edit: After the comments about the multiple $c_i$, these were removed. The substitution process used is not the optimal approach, but it works. Back substitution is now needed to find the other two coefficients.

share|improve this answer
    
Opps, I will edit out the $c_n$. So can it be solved the way I've done it. –  user346443 Jul 9 '12 at 3:19
    
I'm not quite up to matrices yet, I'm using this as an exercise to understand basic algebra. So has the error occurred due to the substitution method or one of the steps I've taken? I appreciate the help. –  user346443 Jul 9 '12 at 3:33
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.