Arithmetic, Algebra & Number Theory Equations, Systems & Polynomials AC method (grouping) with Gauss's lemma on primitive polynomials

Factoring Trinomials Calculator (AC Method)

Enter the three coefficients of ax² + bx + c and this calculator factors it. It pulls out the greatest common factor first, then runs the AC method: it searches for the pair of integers whose product is a·c and whose sum is b, and uses that pair to split the middle term and group. When no such pair exists it tells you so — the trinomial is prime over the integers — and gives the exact irrational or complex factorisation instead, so you always leave with a usable answer.

Calculator

This calculator runs in your browser. Enable JavaScript for live results — the inputs, formula and worked example below remain fully readable without it.

Inputs this calculator takes, with typical values
InputWhat to enterExample
Coefficient a (of x²)The number multiplying x², with its sign. Integer coefficients are what the AC method needs.2
Coefficient b (of x)The number multiplying x, with its sign. Enter 0 for a difference of squares such as 4x² − 9.7
Constant cThe term with no x. Enter 0 if the trinomial is really a binomial such as 6x² − 15x.3

It returns

  • Factored form — The product of a common factor and one or two binomials.
  • Factorability over the integers
  • AC pair (product a·c, sum b)
  • Greatest common factor removed — Carries the sign of a, so the leading coefficient inside the brackets stays positive.
  • Root x₁
  • Root x₂
  • Discriminant b² − 4ac — A perfect square here is exactly the condition for an integer factorisation.

The formula

ax2+bx+c=a(xx1)(xx2)
m,n=b±b24ac2

In plain text: ax² + bx + c = a(x − x₁)(x − x₂), where m·n = ac and m + n = b split the middle term

  • aCoefficient of x²
  • bCoefficient of x
  • cConstant term
  • m, nThe AC pair: two integers with m·n = ac and m + n = b
  • x₁, x₂The roots, (−b ± √(b² − 4ac)) / 2a

An integer factorisation of an integer trinomial exists exactly when b² − 4ac is a perfect square.

Updated Category Equations, Systems & Polynomials Verified against published test cases Reading time 13 min

What factoring a trinomial actually means

Factoring rewrites a sum as a product. The trinomial 2x² + 7x + 3 and the product (2x + 1)(x + 3) are the same expression written two ways, and you can verify that by multiplying the brackets back out. Nothing has been solved and no value of x has been found; only the shape has changed.

The shape matters because a product is zero exactly when one of its factors is zero. That single fact — the zero-product property — is why factoring is taught before anything else in equation solving. Once you have (2x + 1)(x + 3) = 0 you can read the roots straight off: 2x + 1 = 0 gives x = −0.5, and x + 3 = 0 gives x = −3. No formula, no square roots.

Factoring also does work that root-finding cannot. Cancelling a common bracket simplifies a rational expression; recognising a repeated factor tells you a curve touches rather than crosses the axis; and in calculus a factored denominator is what partial fractions need. So it is worth being able to factor even when you already know the roots.

One limitation is built in. Most integer trinomials do not factor over the integers. Pick a, b and c at random and the discriminant is usually not a perfect square, which means the roots are irrational and no pair of integer binomials exists. Such a trinomial is called prime over the integers, and reporting that honestly is as much a correct answer as producing brackets.

The AC method, and why it works

The AC method turns factoring into a search for two numbers. To factor ax² + bx + c:

  1. Take out the greatest common factor of a, b and c first, together with the sign of a if it is negative.
  2. Multiply a by c.
  3. Find two integers m and n with m·n = ac and m + n = b.
  4. Split the middle term: ax² + mx + nx + c.
  5. Group the first two and last two terms and factor each pair. The same bracket appears twice; take it out.

Step 3 looks like guesswork, but it is a quadratic in disguise. Two numbers with a known sum b and known product ac are precisely the roots of t² − bt + ac = 0, whose discriminant is b² − 4ac — the discriminant of the original trinomial. So the pair exists as integers exactly when b² − 4ac is a perfect square, and when it is, m and n are (b + √Δ)/2 and (b − √Δ)/2. That is how this calculator finds them without trial and error, and it is why the discriminant is reported alongside the answer.

Step 5 always works once step 3 succeeds, and the reason is worth seeing. After splitting, the first pair is x(ax + m) and the second is (n/d)(dx + dc/n) for the right common factor d; because mn = ac, the two brackets are forced to agree. Gauss's lemma is the general statement behind this: a polynomial with integer coefficients that factors over the rationals also factors over the integers, once the content — the common factor — has been removed.

Two shortcuts sit inside the general method. When b = 0 and ac < 0 you have a difference of squares: a² − b² = (a + b)(ab). When Δ = 0 you have a perfect square trinomial and the answer is a single bracket squared. Both fall out of the AC method automatically, but recognising them saves time by hand.

Worked example: factoring 6x² − 15x − 9 by hand

Start with 6x² − 15x − 9, so a = 6, b = −15, c = −9.

  1. Common factor first. gcd(6, 15, 9) = 3, and a is positive, so pull out 3: 6x² − 15x − 9 = 3(2x² − 5x − 3). Everything from here works on 2x² − 5x − 3.
  2. Multiply a by c. ac = 2 × (−3) = −6.
  3. Find the pair. You need two integers whose product is −6 and whose sum is −5. The candidate pairs are 1×(−6), (−1)×6, 2×(−3), (−2)×3, with sums −5, 5, −1, 1. The first one works: m = 1, n = −6.
  4. Split the middle term. 2x² + x − 6x − 3.
  5. Group and factor each pair. (2x² + x) + (−6x − 3) = x(2x + 1) − 3(2x + 1).
  6. Take out the shared bracket. (2x + 1)(x − 3).
  7. Restore the common factor. 6x² − 15x − 9 = 3(x − 3)(2x + 1).

Check by expanding: 3(x − 3)(2x + 1) = 3(2x² + x − 6x − 3) = 3(2x² − 5x − 3) = 6x² − 15x − 9 ✓.

Now confirm the discriminant shortcut. Δ = (−15)² − 4(6)(−9) = 225 + 216 = 441, and √441 = 21, a perfect square — which is exactly why an integer factorisation existed. The roots are (15 ± 21)/12, giving 3 and −0.5, and those are the numbers the brackets announce: x − 3 = 0 at 3, and 2x + 1 = 0 at −0.5.

Change the constant to −8 and watch it fail: 6x² − 15x − 8 has Δ = 225 + 192 = 417, which is not a perfect square (20² = 400, 21² = 441). No integer pair exists, and the trinomial is prime over the integers. Its roots are (15 ± √417)/12 ≈ 2.9518 and −0.4518.

How to read the result

The factorability line is the first thing to check. "Factors over the integers" means the brackets shown contain only whole numbers and you can hand them in as they are. "Prime over the integers" means no such brackets exist and the factorisation shown uses decimal roots — correct, but not what a factoring exercise is asking for. "Irreducible over the reals" means the discriminant is negative and the only factorisation involves complex numbers.

The greatest common factor output catches the error that costs the most marks. A factorisation is only complete when the common factor has been removed: (6x − 18)(2x + 1) is a true statement about 6x² − 15x − 9 but it is not fully factored, because 6x − 18 still has a 6 in it. If this output shows anything other than 1 or −1, the factor belongs out front.

The roots and the brackets are two views of the same information. A bracket (qxp) corresponds to the root p/q, so a root of 1.5 means the bracket (2x − 3), and a root of −3 means (x + 3). If you prefer to go the other way — start from the roots and build the brackets — the quadratic equation calculator gives the roots and this page gives the brackets.

Finally, remember what a perfect-square discriminant does and does not tell you. It guarantees integer brackets exist for integer coefficients. It says nothing about whether the roots are integers: 2x² + 7x + 3 has Δ = 25 and factors cleanly, yet one root is −0.5.

Reference: common factoring patterns

Each row is verified by expanding the right-hand side. Δ is the discriminant b² − 4ac.
PatternExampleΔFactored form
Simple trinomial, a = 1x² − 5x + 61(x − 3)(x − 2)
Leading coefficient ≠ 12x² + 7x + 325(2x + 1)(x + 3)
Common factor first6x² − 15x − 94413(x − 3)(2x + 1)
Difference of squares4x² − 9144(2x − 3)(2x + 3)
Perfect square trinomialx² + 6x + 90(x + 3)²
Perfect square, a ≠ 19x² − 12x + 40(3x − 2)²
No constant termx² − 3x9x(x − 3)
Negative leading coefficient−x² + 4x − 34−(x − 1)(x − 3)
Prime over the integersx² + x − 15none with integers; roots (−1 ± √5)/2
Irreducible over the realsx² + x + 1−3none with reals; complex roots only

Δ is a perfect square in every row that factors over the integers, and in no row that does not.

"Prime" means prime over a specific number system

Calling a trinomial prime is always relative to the coefficients you allow. x² − 2 is prime over the integers and over the rationals, but factors over the reals as (x − √2)(x + √2). x² + 1 is prime over the reals but factors over the complex numbers as (xi)(x + i). School exercises almost always mean "over the integers" unless they say otherwise, which is the convention this calculator reports against. If you need the exact irrational form rather than a decimal, put the root through the radical simplifier.

Mistakes that break a factorisation

  • Skipping the common factor. Always take out the GCF before anything else, or you will end up with brackets that still share a factor and a marker will call the answer incomplete.
  • Multiplying only a and c but forgetting the sign. For 2x² − 5x − 3, ac = −6, not 6. The negative is what forces the pair to have opposite signs.
  • Using a + c instead of a·c. The AC method needs the product for step 2 and the sum only for the pair.
  • Grouping without checking the brackets match. If the two brackets after grouping are not identical, you split the middle term with the wrong pair, or you factored one group with the wrong sign.
  • Leaving a negative leading coefficient inside. −x² + 4x − 3 should become −(x − 1)(x − 3), not (−x + 1)(x − 3), which is correct but non-standard.
  • Declaring a trinomial prime after only trying a few pairs. Compute the discriminant instead: if it is not a perfect square, no pair exists and no amount of searching will find one.
  • Confusing factoring with solving. (2x + 1)(x + 3) is a factorisation. The roots −0.5 and −3 come from setting each bracket to zero, which is a separate step.

When the AC method is not the right tool

The AC method factors quadratic trinomials in one variable. Outside that scope you need something else.

Four or more terms with no quadratic shape often yield to plain grouping: x³ + 2x² + 3x + 6 = x²(x + 2) + 3(x + 2) = (x + 2)(x² + 3). Look for a repeated bracket rather than a factor pair.

Cubics and above need the rational root theorem: any rational root p/q in lowest terms has p dividing the constant and q dividing the leading coefficient. Test those candidates, then divide out the factor you find with polynomial long division and factor the smaller quotient. The cubic equation solver handles the case where no rational root exists.

Sums and differences of cubes have their own identities: a³ − b³ = (ab)(a² + ab + b²) and a³ + b³ = (a + b)(a² − ab + b²). Neither quadratic bracket factors further over the reals.

When you only need the roots, skip factoring altogether. The quadratic formula never fails, and completing the square gives the vertex form as a bonus. Factoring is the fast route only when the numbers cooperate.

If the coefficients themselves need reducing first, the greatest common factor calculator and the prime factorisation calculator do that part quickly.

Key terms

Trinomial
A polynomial with three terms. Here specifically ax² + bx + c with a ≠ 0.
AC method
Factoring by multiplying a and c, finding two integers with that product and with sum b, splitting the middle term and grouping.
Content and primitive part
The content is the greatest common factor of the coefficients; dividing it out leaves the primitive polynomial, which is what the AC search actually works on.
Prime (irreducible) polynomial
One that cannot be written as a product of two lower-degree polynomials with coefficients in the chosen number system.
Zero-product property
If a product equals zero then at least one factor equals zero. This is what turns a factorisation into a set of roots.
Gauss's lemma
A primitive polynomial with integer coefficients that factors over the rationals also factors over the integers — the reason the AC method never needs fractions.

Frequently asked questions

How do I know if a trinomial can be factored?

Compute the discriminant b² − 4ac. If the coefficients are integers and the discriminant is a perfect square (0, 1, 4, 9, 16, 25, 36 …), integer binomial factors exist. If it is a non-square positive number the roots are irrational and the trinomial is prime over the integers. If it is negative there are no real factors at all. This test is instant and definitive, which beats trying factor pairs until you run out of patience.

What does the calculator mean by prime?

Prime here means it cannot be split into two binomials with integer coefficients. It does not mean the expression has no roots: x² + x − 1 is prime over the integers but has two perfectly good irrational roots, (−1 ± √5)/2. Every polynomial of degree two factors over the complex numbers; the question is always which number system you are allowed to use, and school exercises mean the integers.

Why do I take out the greatest common factor first?

Because otherwise the answer is incomplete and the search is harder than it needs to be. Removing the GCF from 6x² − 15x − 9 leaves 2x² − 5x − 3, whose ac is −6 instead of −54, so there are far fewer pairs to check. It also guarantees the brackets you end up with cannot be reduced further, which is what "factor completely" asks for.

How do I factor when a is negative?

Pull the negative out with the common factor, so that the x² term inside the brackets is positive. For −x² + 4x − 3, factor out −1 to get −(x² − 4x + 3) = −(x − 1)(x − 3). Every rule you know then applies unchanged inside the brackets. Leaving the negative on the leading coefficient is not wrong, but it makes sign errors far more likely and does not match the form textbooks mark as standard.

What is the difference between factoring and solving?

Factoring rewrites an expression as a product; solving finds the values of x that make an equation true. They are related by the zero-product property: once you have (2x + 1)(x + 3) = 0, set each bracket to zero and read off x = −0.5 and x = −3. If there is no equation — no "= 0" — then there is nothing to solve and factoring is the whole task.

Does the AC method work when a = 1?

Yes, and it simplifies. With a = 1 the product ac is just c, so you look for two integers with product c and sum b, and those two numbers go straight into the brackets: x² − 5x + 6 needs product 6 and sum −5, which is −2 and −3, giving (x − 2)(x − 3). No grouping step is needed. Many courses teach this case first and then present the AC method as the generalisation.

Can a trinomial have three factors?

Only if one of them is a constant or the expression is not really quadratic. A degree-two polynomial factors into exactly two linear factors, possibly identical, plus a numerical common factor: 6x² − 15x − 9 = 3(x − 3)(2x + 1) has a constant and two binomials. If you find three binomial factors, the expression was degree three or higher, and polynomial long division is the tool for peeling factors off one at a time.

Why does my factored answer look different from the book's?

Order and sign placement are not unique. (x + 3)(2x + 1) and (2x + 1)(x + 3) are the same product, and −(x − 1)(x − 3) equals (1 − x)(x − 3). Multiply your version out: if you recover the original trinomial exactly, your answer is right. Books usually order the brackets by increasing leading coefficient and keep the common factor positive out front, which is the convention this calculator follows.

References