A quadratic equation can also have complex roots. In that case too it would not be possible to arrive at the solution by factoring; instead we would have to use the quadratic formula.
Complex roots of a quadratic equation are always complex conjugates. If one root is a+ ib, the other is a - ib.
The quadratic equation would be:
(x - (a + ib))(x - (a - ib)) = 0
=> (x - a - ib)(x - a + ib) = 0
=> (x - a)^2 - (ib)^2 = 0
=> x^2 + a^2 - 2ax - i^2b^2 = 0
=> x^2 + a^2 - 2ax + b^2 = 0
=> x^2 - 2ax + a^2 + b^2 = 0
The equation we get is of the form x^2 - 2ax + a^2 + b^2 = 0
We'll use the irrational roots of an equation that always come in pairs. We also use the fact that a polynomial could be written as a product of linear factors, such as:
P(x) = a(x – x1)(x – x2) (in this case we've written a quadratic, which has 2 roots)
We'll put x1 = p + sqrt m => the other root is the conjugate of x1 => x2 = p – sqrt m.
P(x) = a(x – p - sqrt m)(x – p + sqrt m)
We'll remove the brackets:
P(x) = ax^2 – ax*(p - sqrtm) – ax(p+sqrtm) – (p^2 - m)
P(x) = ax^2 – 2p*a*x - (p^2 - m)