Definitions: A quadratic trinomial is an expression of the form: a x^{ 2} + b x + c,where x is a variable and a, b and c are nonzero constants. The constant a is called the leading coefficient, b is called the linear coefficient, and c is called the additive constant. The discriminant, D, of a quadratic trinomial is defined as the quantity: D = b^{ 2} − 4 a c.The discriminant is used to classify or discriminate among various cases of quadratic trinomials. A perfect square number is a number that is the square of some integer. We will be interested in knowing whether or not the discriminant is a perfect square. 
x^{ 2} + 7 x + 6.is a quadratic trinomial with coefficients a = 1, b = 7, and c = 6. The discriminant is D = 7^{ 2} − 4 · 1 · 6 or D = 25. D is a perfect square because it is the square of 5.
2 x^{ 2} + 3 x − 4.is a quadratic trinomial with coefficients a = 2, b = 3, and c = −4. The discriminant is D = 3^{ 2} − 4 · 2 · (−4) or D = 41. Notice that D is not a perfect square.
Assumptions for this section: We will assume that the coefficients a, b and c are all nonzero integers and that the discriminant, D, is a perfect square. If these conditions don't hold then the quadratic trinomial cannot be factored by the methods of this section but may still be factorable using the more complicated method of completing the square. 
It is convenient to write a perfect square quadratic trinomial in the form: a^{ 2} + 2 a b + b^{ 2}Then it can be factored like this: a^{ 2} + 2 a b + b^{ 2} = (a + b)^{ 2} 
This leads to the following procedure for factoring a perfect square trinomial:

Algebra Coach Exercises 
x^{ 2} + b x + c.(We also assume that b and c are integers and that the discriminant is a perfect square.) First notice that the factors must be binomials, both of whose x terms must have coefficients of 1:
(x + •) (x + •)Now we need to determine the two • quantities. Let's call them m and n and set the unfactored form equal to the factored form: If we distribute the right side and then combine like terms we get:
The only way that the left side can be identical to the right side is if:
b = m + n, and c = m n.(In words, the sum of m and n must equal b and the product of m and n must equal c.) It is easy to show that only one combination of m and n will satisfy both conditions. Also, we will see in the section on completing the square that m and n are guaranteed to be integers if the discriminant D is a perfect square.
This leads to the following procedure for factoring a quadratic trinomial a x^{ 2} + b x + c when a = 1:

x^{ 2} + 8 x + 12 = (x + m) (x + n)
m n = 12, and m + n = 8.Here is a list of all the pairs of integers whose product is 12. Pick the pair whose sum is 8.
Thus m = 6 and n = 2 and the expression factors as:
m n 12 1 6 2 ← this pair has a sum of 8 4 3 3 4 ← already checked 2 6 ← already checked 1 12 ← already checked
x^{ 2} + 8 x + 12 = (x + 6) (x + 2)
x^{ 2} + x − 12 = (x + m) (x + n)
m n = −12, and m + n = 1.Here is a list of some of the pairs of integers whose product is −12. Pick the pair whose sum is 1.
Thus m = 4 and n = −3 and the expression factors as:
m n 12 −1 6 −2 4 −3 ← this pair has a sum of 1 … … ← need check no further
x^{ 2} + x − 12 = (x + 4) (x − 3)
Algebra Coach Exercises 
a x^{ 2} + b x + c.(Thus a no longer has to be equal to 1 as in the previous section but we still assume that the discriminant is a perfect square.) The method that we develop is a variation of the grouping method. Start by assuming that the quadratic trinomial can be factored like this:
a x^{ 2} + b x + c = (p x + q) (r x + s).We now set out to find p, q, r and s. Distribute on the right hand side:
a x^{ 2} + b x + c = p r x^{ 2} + p s x + q r x + q s.Look at the blue and red numbers on the right hand side. Think of p r as a single number (that has factors p and r), think of p s as another number that can be factored, and so on. Then, just as in the previous case, one condition for the left side to be equal to the right side is that:
b = p s + q r.In words, the sum of the number p s and the number q r must equal b. Unlike the previous case, the second condition is on the product a c. It is that:
a c = p r · q s = (p s) (q r).In words, the product of the number p s and the number q r must equal the product of a and c. These two conditions together give us enough information to find the two numbers p s and q r. We will see in the section on completing the square that these two numbers are guaranteed to be integers if the discriminant D is a perfect square. Also it can be shown that they are unique.
a x^{ 2} + b x + c = a x^{ 2} + p s x + q r x + c,or, showing the factors of a and c, like this:
a x^{ 2} + b x + c = p r x^{ 2} + p s x + q r x + q s.Now make two groups on the right hand side (hence the name grouping method). The first group consists of the first two terms (shown in red) and the second group consists of the last two terms (shown in blue):
a x^{ 2} + b x + c = p r x^{ 2} + p s x + q r x + q s.Factor one common factor out of the first group and a different common factor out of the last group like this:
a x^{ 2} + b x + c = p x(r x + s) + q(r x + s).This causes a new common factor of r x + s to appear, which we can also factor out, and we are done:
a x^{ 2} + b x + c = (p x + q) (r x + s).
This leads to the following procedure for factoring a quadratic trinomial a x^{ 2} + b x + c when a ≠ 1:

m n = a c = −30, and m + n = b = 7.Here is a list of all the pairs of integers whose product is −30. Pick the pair whose sum is 7.
m n 30 −1 15 −2 10 −3 ← this pair has a sum of 7 6 −5 … … ← need check no further; rest of list duplicates previous rows
6 x^{ 2} + 7 x − 5 = 6 x^{ 2} + 10 x − 3 x − 5.
6 x^{ 2} + 7 x − 5 = 6 x^{ 2} + 10 x − 3 x − 5.Factor the common factor 2 x out of the first group and a − sign out of the last group:
6 x^{ 2} + 7 x − 5 = 2 x(3 x + 5) − (3 x + 5).
6 x^{ 2} + 7 x − 5 = (2 x − 1) (3 x + 5).
m n = a c = −120, and m + n = b = 2.Here is a list of all the pairs of integers whose product is −120. Pick the pair whose sum is 2.
m n 120 −1 60 −2 40 −3 30 −4 24 −5 20 −6 15 −8 12 −10 ← this pair has a sum of 2 … … ← need check no further; rest of list duplicates previous rows
8 x^{ 2} + 2 x − 15 = 8 x^{ 2} + 12 x − 10 x − 15.
8 x^{ 2} + 2 x − 15 = 8 x^{ 2} + 12 x − 10 x − 15.Factor the common factor 4 x out of the first group and −5 out of the last group:
8 x^{ 2} + 2 x − 15 = 4 x(2 x + 3) − 5(2 x + 3).
8 x^{ 2} + 2 x − 15 = (2 x + 3) (4 x − 5).
Algebra Coach Exercises 