What do you mean by trial and error?
Assuming roots of a quadratic are rational (meaning your leading coefficient is tyically not 1) then you can factorise it.
Let's say the roots are
x=−qp and
x=−sr and these correspond to linear factors
(qx+p) and
(sx+r) being zero.
Therefore, the two roots satisfy the quadratic equation
(qx+p)(sx+r)=0, i.e.
qsx2+(qr+ps)x+pr=0The leading coefficient is
qs.
Here
qr,ps are two magic numbers which add to give the middle coefficient, but they also multiply to give
qrps which is exactly the same as the leading coefficient
qs multiplying the constant term
pr.
All this is to say that there some logic involved here in factorising. When trying to factorise
ax2+bx+c=0 you should be splitting your
b into two magic numbers which add to
b yet multiply to
ac.
As they multiply to
ac, you just need to look at the factor pairs of this product and see what adds to
b.
Example: Factorise
2x2+5x+2.
Look for two numbers which add to
5 and multiply to
2×2=4.
These are
1,4. Then rewrite your quadratic as
(2x2+x)+(4x+2) [we have split
5x=x+4x] and factorise fully each bracket to get
x(2x+1)+2(2x+1)Finally note that
(2x+1) is a bracket occuring twice in this expression therefore it can be factored out overall to give
(2x+1)(x+2)This is the factorisation. No trial and error needed. Just find the two magic numbers by looking at factor pairs of
ac which add to
b.