# Math Help - quadratic function solution

Hi,

I have a simple question regarding solving a quadratic function
$y = ax^2 + bx + c$
I tried to solve it as follows in general for y=y1 find the roots of the quadratic equation:
$0 = ax^2 + bx + c - y1$

Hence, in more detail...
for $y = y1$:
$k = c - y1$
$d = b^2 - 4 a k$
assuming $d > 0$
$x1 = \frac{(-b + sqrt(d))}{2a}$
$x2 = \frac{(-b - sqrt(d))}{2a}$

However, this is not producing the desired result. For example, assume the following function

$y(x) = 3x^2 + 2x + 1$
$y(3) = 34$
and $x(34)$ following the solution above gives:
$x1=27$ and $x2=-33$
None of them being 3 as I would expect. Can someone point me in the right direction or a link with info I can look up?

2. ## Re: quadratic function solution

you have to distinguish between factorization and solving of the equation.

To solve the equation you have x1 and x2 as you mentioned, this gives you the roots of your equation only. But, the factorization of the the quadratic function is given by
$ax^2+bx+c=a\left(x-\frac{-b+\sqrt{b^2-4ac}}{2a} \right)\left(\frac{-b-\sqrt{b^2-4ac}}{2a}\right).$

3. ## Re: quadratic function solution

I'm getting the correct result:

$34 = 3x^2 + 2x + 1$

$\Rightarrow0 = 3x^2 + 2x -33$

$\Rightarrow x = \frac{-2\pm\sqrt{2^2-4\cdot3(-33)}}{2\cdot3}$

$\Rightarrow x = \frac{-2\pm\sqrt{400}}6$

$\Rightarrow x = \frac{-2\pm20}6 = \frac{-1\pm10}3$

$\Rightarrow x = 3\quad\mathrm{or}\quad x=-\frac{11}3.$

If you are getting something different, I suggest showing your work so that we may locate any errors.

4. ## Re: quadratic function solution

Thanks. After few hours of googling, posting here and reassuring me that it is correct I realised that excel does not like lack of parentheses. Thanks again a lot.

5. ## Re: quadratic function solution

Originally Posted by gatemaze
Thanks. After few hours of googling, posting here and reassuring me that it is correct I realised that excel does not like lack of parentheses. Thanks again a lot.
I believe Excel follows the standard order of operations. You'll always need parentheses in situations like that when you're entering an expression in plain text. The horizontal line in a fraction (called a vinculum) acts as a grouping symbol in handwritten expressions, but we don't have that luxury when we just use a / for division.

6. ## Re: quadratic function solution

To solve $ax^2 + bx + c = 0$ in general, first divide everything by $a$:

$x^2 + \frac{b}{a}x + \frac{c}{a} = 0$. Complete the square by adding $\frac{b^2}{4a^2}$ to both sides:

$x^2 + \frac{b}{a}x + \frac{b^2}{4a^2} + \frac{c}{a} = \frac{b^2}{4a^2}$

$(x + \frac{b}{2a})^2 = \frac{b^2}{4a^2} - \frac{c}{a} = \frac{b^2 - 4ac}{4a^2}$

Take square root of both sides

$x + \frac{b}{2a} = \pm \sqrt{\frac{b^2 - 4ac}{4a^2}} = \pm \frac{\sqrt{b^2 - 4ac}}{2a}$

$x = -\frac{b}{2a} \pm \frac{\sqrt{b^2 - 4ac}}{2a} = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$