quadratic function solution

Hi,

I have a simple question regarding solving a quadratic function

$\displaystyle y = ax^2 + bx + c$

I tried to solve it as follows in general for y=y1 find the roots of the quadratic equation:

$\displaystyle 0 = ax^2 + bx + c - y1$

Hence, in more detail...

for $\displaystyle y = y1$:

$\displaystyle k = c - y1$

$\displaystyle d = b^2 - 4 a k$

assuming $\displaystyle d > 0$

$\displaystyle x1 = \frac{(-b + sqrt(d))}{2a}$

$\displaystyle x2 = \frac{(-b - sqrt(d))}{2a}$

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

$\displaystyle y(x) = 3x^2 + 2x + 1$

$\displaystyle y(3) = 34$

and $\displaystyle x(34)$ following the solution above gives:

$\displaystyle x1=27$ and $\displaystyle 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?

Thank you in advance.

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

$\displaystyle ax^2+bx+c=a\left(x-\frac{-b+\sqrt{b^2-4ac}}{2a} \right)\left(\frac{-b-\sqrt{b^2-4ac}}{2a}\right).$

Re: quadratic function solution

I'm getting the correct result:

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

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

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

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

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

$\displaystyle \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.

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.

Re: quadratic function solution

Quote:

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.

Re: quadratic function solution

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

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

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

$\displaystyle (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

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

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