How can I convert $ax^2 + bx + c = 0$ to a FOIL-style $(x + d)(x - e) = 0$ equation?

I have an equation in a computer program that I'm currently solving with the standard $\frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$. If the discriminator is negative I end up with an imaginary number solution, and I don't know how to deal with that. Using the FOIL method seems like a nice alternative for getting two real solutions to x.

Update

Based on the answers here, I realized that I probably made a mistake arriving at the values for $a$, $b$, and $c$. I went back and re-solved my equation, and ended up with values that are giving me real solutions.

So in summary, getting imaginary results told me I had an incorrect equation. And now I know a lot more about quadratic equations. Thanks for the help everyone!

-
A downvote already? – MikeWyatt Jan 28 '12 at 19:24
If the discriminant is negative then there are exactly two (necessarily conjugate) non-real solutions and no real ones; you can't do anything about that, really. – Dylan Moreland Jan 28 '12 at 19:24
If you post that as an answer, I'll accept it. It sounds like I need to ask a new question about how to use the non-real solutions in a situation that requires a real number. – MikeWyatt Jan 28 '12 at 19:25
@MikeWyatt: If your application requires the roots to be real, and they are not, you are out of luck. For example, suppose you are given the equations of two circles, and you want to find where the circles meet. With some algebra, you can reduce the problem to a quadratic equation. If the quadratic equation has no real solution, you simply conclude that the circles don't meet. Added: FOIL is not for serious work, it is only for solving contrived artificially simple early high school problems. – André Nicolas Jan 28 '12 at 19:31
In Maple you can use command : factor$(x^2+\frac{b}{a} \cdot x+\frac{c}{a},real)$ – pedja Jan 28 '12 at 19:31

Well. . .

There's several problems here.

First, notice: $$(x+d)(x-e)=x^2-ex+dx-ed=x^2+(d-e)x-ed$$ Where in the world are you going to get a leading coefficient? In other words, this method doesn't suffice without some manipulations of the standard form. That manipulation is: $$\frac{1}{a}\left(ax^2+bx+c\right)=x^2+px+q \quad \quad p=\frac{b}{a},q=\frac{c}{a}$$ The second issue is that it can't be generally figured out what $d$ and $e$ are. $d$, by definition, is the opposite of the first root of the equation. $e$, by definition, is the second root. However, the relationships between $p$ and $q$ and $d$ and $e$ are: $$d-e=p \quad -ed=q$$ This information doesn't allow us to determine $d$ and $e$ in terms of the coefficients $p$ and $q$. There's also the common sensical fact, that like I said, you have to know the roots to know $e$ and $d$.

But the biggest issue is what you want. You cannot get rid of the imaginary solutions. They will always be solutions to particular quadratics. It is impossible to "get rid of them." For example, notice: $$x^2+1=0$$ There are no solutions to this equation in $\mathbb{R}$. The only solutions are in $\mathbb{C}$. They are $i$ and $-i$. Now, let me show why they have to be those particular quantities in a very simply way: \begin{align} x^2+1&=(x-r_1)(x-r_2)\\ &=(x-i)(x+i)\\ &=x(x+i)-i(x+i)\\ &=x^2+ix-ix-i^2\\ &=x^2-(-1)\\ &=x^2+1 \end{align} Do you see how those solutions have to be $i$ and $-i$? This applies to all quadratics. Their roots are whatever makes the following relation true and the fundamental relation (that is, that the quadratic is equal to $0$) true. I hope this makes sense.

Addendum: It may help to see precisely where "that formula" comes from. It is derived directly from the standard form equation.

First, make this observation: $$(x-v)^2=x^2-2vx+v^2$$ You can turn the manipulated form into a square: \begin{align} x^2+px+q&=0\\ x^2+px&=-q\\ x^2+px+\left(\frac{p}{2}\right)^2&=-q+\left(\frac{p}{2}\right)^2\\ \left(x+\frac{p}{2}\right)^2&=-q+\left(\frac{p}{2}\right)^2=\frac{-4q+p^2}{4}\\ x+\frac{p}{2}&=\pm \sqrt{\frac{-4q+p^2}{4}}=\frac{1}{2}\sqrt{-4q+p^2}\\ x&=\pm \frac{1}{2}\sqrt{-4q+p^2}-\frac{p}{2}=\frac{-p\pm\sqrt{-4q+p^2}}{2} \end{align} Substituting back in for $p$ and $q$ gives us: \begin{align} x&=\frac{-\frac{b}{a}\pm \sqrt{-4\frac{c}{a}+\left(\frac{b}{a}\right)^2}}{2}\\ &=\frac{-b \pm a\sqrt{-4\frac{c}{a}+\frac{b^2}{a^2}}}{2a}\\ &=\frac{-b \pm a\sqrt{\frac{b^2-4ac}{a^2}}}{2a}\\ &=\frac{-b \pm \sqrt{b^2-4ac}}{2a} \end{align}

Also, André Nicolas provides an even more simple derivation of the quadratic formula in this question: Why can ALL quadratic equations be solved by the quadratic formula?

-

If a polynomial has a root $r$ (imaginary or real), then you can pull out a factor of $x-r$.

For example, to factor $x^2 + 1$, we first find the roots. You can use the quadratic equation for this in general, but it's easy to see in this example that the roots are $i$ and $-i$. This means the polynomial $x^2 + 1$ factors as $(x - i)(x + i)$.

Notice this polynomial has no real solutions. There is no amount of algebraic trickery you can do to get around that fact. Depending on your application, you will either have to accept the imaginary roots or regard the polynomial as having no (real) solutions.

-

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

If you plug a number $n$ into a polynomial and get $0$, then $(x-n)$ is a factor of that polynomial. So the two numbers that you can plug into a quadratic polynomial that mkae it add up to $0$ correspond to the two factors.

But you can't get real numbers if the solutions are not real numbers.

-