There's a generic algorithm that works for these types of trinomials ($ax^2+bx+c$)
- First write $\left(\dfrac{ax\phantom{+4}}{\phantom{5}}\right) \left(\dfrac{ax\phantom{+4}}{\phantom{5}}\right).$
- Find the product $ac$, including sign.
- Find the prime factorization of $ac$ using the factor tree.
- Find all factor pairs of $ac$ using the factor tree: begin with $1$,$ac$, and increase the $1$ according to whether you can get it by a product of numbers in the prime factorization of $ac$. You are done when the first number has reached \sqrt{ac}.
- Find the factor pair of $ac$ such that the two numbers add to $b$, including sign. If $ac>0$, then the two numbers will have the same sign. If $ac<0$, then the two numbers will have opposite signs. (If this step fails, the quadratic does not factor.) Call these two numbers $s$ and $t$.
- Write $\left(\dfrac{ax+s}{\phantom{5}}\right)\left(\dfrac{ax+t}{\phantom{5}}\right).$
- Divide each of these binomials by its own GCF $\left(\dfrac{ax+s}{\operatorname{gcf}(a,s)}\right) \left(\dfrac{ax+t}{\operatorname{gcf}(a,t)}\right).$ Check that $$\operatorname{gcf}(a,s)\cdot\operatorname{gcf}(a,t)=a.$$
How do you apply this algorithm to $x^2+5x+6$?
Regards!
$$\left(\dfrac{x\phantom{+4}}{\phantom{5}}\right) \left(\dfrac{x\phantom{+4}}{\phantom{5}}\right)$$
$$ac=6$$
$$ac=6=2\cdot 3$$
$$(1,6),(2,3),(-1,-6),(-2,-3)$$
$$(s,t)=(2,3)$$
$$\left(\dfrac{x+2}{\phantom{5}}\right)\left(\dfrac{x+3}{\phantom{5}}\right)$$
$$\left(\dfrac{x+2}{1}\right)\left(\dfrac{x+3}{1}\right)=\left(x+2\right)\left(x+3\right)$$
In that case, as an alternative, we can proceed by completing the square as follow
$$x^2+5x+6=x^2+5x+\frac{25}{4}-\frac{25}{4}+6=\left(x+\frac{5}{2}\right)^2-\frac{1}{4}=$$ $$=\left[\left(x+\frac{5}{2}\right)-\frac{1}{2}\right]\left[\left(x+\frac{5}{2}\right)+\frac{1}{2}\right]=\left(x+2\right)\left(x+3\right)$$