Factor by Grouping Calculator

Factor by Grouping Calculator

Emerging AI Skill PRO

Enter Calculation

Enter numeric values for a, b, x, y to evaluate ax + ay + bx + by = (a+b)(x+y).

Formula

ax+ay+bx+by=(a+b)(x+y)\text{a}\text{x} + \text{a}\text{y} + \text{b}\text{x} + \text{b}\text{y} = \left(\text{a} + \text{b}\right)\left(\text{x} + \text{y}\right)

Example

2·5+2·7+3·5+3·7=(2+3)(5+7)=602 \cdot 5 + 2 \cdot 7 + 3 \cdot 5 + 3 \cdot 7 = \left(2 + 3\right)\left(5 + 7\right) = 60
Usage stats

Advertisement

Results

Factored Form (a+b)(x+y)
(5)(12)
equals 60
Expanded value (ax+ay+bx+by) 60
(a + b) 5
(x + y) 12
Product (a+b)(x+y) 60

Report an error on this page

What is Factoring by Grouping?

Factoring by grouping is an algebra technique used to factor expressions with four terms. When an expression has the structure \(\text{a}\text{x} + \text{a}\text{y} + \text{b}\text{x} + \text{b}\text{y}\), you can group the terms in pairs, pull out the greatest common factor from each pair, and rewrite the whole expression as a product of two binomials: \(\left(\text{a} + \text{b}\right)\left(\text{x} + \text{y}\right)\). This calculator evaluates that identity numerically so you can check your own algebra work.

How to Use This Calculator

Enter numeric values for the four coefficients: a and b (the factors that pair with the variable groups) and x and y. The tool computes the expanded sum \(\text{a}\text{x} + \text{a}\text{y} + \text{b}\text{x} + \text{b}\text{y}\), the grouped factors \(\left(\text{a} + \text{b}\right)\) and \(\left(\text{x} + \text{y}\right)\), and their product. Because the identity always holds, the expanded value and the factored product will match — confirming the factoring is correct.

Rectangle area model split into four sub-rectangles representing ax, ay, bx, by
An area model: a rectangle of sides (a+b) and (x+y) splits into the four product terms.

The Formula Explained

Start with \(\text{a}\text{x} + \text{a}\text{y} + \text{b}\text{x} + \text{b}\text{y}\). Group the first two terms and the last two: \(\left(\text{a}\text{x} + \text{a}\text{y}\right) + \left(\text{b}\text{x} + \text{b}\text{y}\right)\). Factor each group: \(\text{a}\left(\text{x} + \text{y}\right) + \text{b}\left(\text{x} + \text{y}\right)\). Both groups now share the common binomial \(\left(\text{x} + \text{y}\right)\), so factor it out to get the following:

$$\text{a}\text{x} + \text{a}\text{y} + \text{b}\text{x} + \text{b}\text{y} = \left(\text{a} + \text{b}\right)\left(\text{x} + \text{y}\right)$$

Advertisement

Worked Example

Suppose \(\text{a} = 2\), \(\text{b} = 3\), \(\text{x} = 5\), \(\text{y} = 7\). The expanded value is:

$$2\cdot5 + 2\cdot7 + 3\cdot5 + 3\cdot7 = 10 + 14 + 15 + 21 = 60$$

The factored form is:

$$\left(2 + 3\right)\left(5 + 7\right) = \left(5\right)\left(12\right) = 60$$

Both sides equal 60, confirming the identity.

Diagram showing four-term expression grouped into two pairs and factored into a product of two binomials
Grouping the four terms into pairs reveals the common factors that combine into (a+b)(x+y).

More Worked Examples: Factoring by Grouping

Example 1: A symbolic polynomial

Factor \(6x^2 + 9x + 4x + 6\).

  1. Group into pairs: \((6x^2 + 9x) + (4x + 6)\).
  2. Factor the GCF from each pair. The GCF of \(6x^2\) and \(9x\) is \(3x\), and the GCF of \(4x\) and \(6\) is \(2\). This gives \(3x(2x + 3) + 2(2x + 3)\).
  3. Both groups contain the binomial \((2x + 3)\). Factor it out: \((3x + 2)(2x + 3)\).
  4. Check: \((3x+2)(2x+3) = 6x^2 + 9x + 4x + 6 = 6x^2 + 13x + 6\). This matches the original.

Example 2: A negative sign in the second group

Factor \(x^3 - 3x^2 + 2x - 6\).

  1. Group: \((x^3 - 3x^2) + (2x - 6)\).
  2. Factor each pair: \(x^2(x - 3) + 2(x - 3)\).
  3. Factor out the common binomial: \((x - 3)(x^2 + 2)\).
  4. Check: \((x-3)(x^2+2) = x^3 + 2x - 3x^2 - 6\), which equals \(x^3 - 3x^2 + 2x - 6\).

Now suppose the second pair starts with a negative term: \(x^3 - 3x^2 - 2x + 6\). Grouping gives \((x^3 - 3x^2) + (-2x + 6)\). If you factor out \(+2\), you get \(2(-x + 3)\), and \((-x+3)\) does not match \((x-3)\). Factor out the negative instead: \(-2x + 6 = -2(x - 3)\). Then \(x^2(x - 3) - 2(x - 3) = (x - 3)(x^2 - 2)\). Check: \(x^3 - 2x - 3x^2 + 6\) ✓.

Example 3: Numeric check with this calculator's inputs

Let \(a = 4\), \(b = -1\), \(x = 3\), \(y = 2\).

Expanded form: \(ax + ay + bx + by = 4(3) + 4(2) + (-1)(3) + (-1)(2) = 12 + 8 - 3 - 2 = \) 15.

Factored form: \((a + b)(x + y) = (4 + (-1))(3 + 2) = (3)(5) = 15\). Both forms give the same value, which confirms the factorization.

Advertisement

Step-by-Step: How to Factor by Grouping by Hand

  1. Confirm there are four terms and pull out any overall GCF first. Grouping is designed for four-term expressions. If all four terms share a common factor, factor it out first. For example, \(2x^2 + 6x + 2x + 6\) becomes \(2(x^2 + 3x + x + 3)\).
  2. Group into two pairs. Put the first two terms in one group and the last two in another: \((\text{term}_1 + \text{term}_2) + (\text{term}_3 + \text{term}_4)\).
  3. Factor the GCF from each pair, adjusting signs so the binomials match. If the third term is negative, factor out a negative GCF from the second pair so the leftover binomial has the same signs as the first.
  4. Factor out the common binomial. Once both groups contain the same binomial, treat it as a single factor. The expression \(A(\text{binomial}) + B(\text{binomial})\) becomes \((A + B)(\text{binomial})\).
  5. Check by expanding. Multiply your answer using FOIL or the distributive property. You should recover the original four terms, possibly in a different order.

If the first grouping fails: the order of terms can be rearranged. For example, in \(ax + by + ay + bx\), the pairs \((ax + by)\) and \((ay + bx)\) have no common binomial. Reorder to \(ax + ay + bx + by\) and group again: \(a(x + y) + b(x + y) = (a + b)(x + y)\).

If no grouping works: if you have tried the possible pairings and none produces a common binomial, the expression may not be factorable by grouping. It may still factor by another method, or it may be prime over the integers.

FAQ

When can I factor by grouping? When an expression has four terms and the terms can be grouped so each pair shares a common factor, leaving a shared binomial.

Does the order of grouping matter? No — you can group \(\left(\text{a}\text{x} + \text{b}\text{x}\right) + \left(\text{a}\text{y} + \text{b}\text{y}\right)\) and still arrive at \(\left(\text{a} + \text{b}\right)\left(\text{x} + \text{y}\right)\).

Why don't the values always look like a clean factorization? This tool works with the numeric values you supply. For symbolic factoring you keep the variables; here we verify the equality numerically.

Last updated:

Most popular in Math and Statistics

View all Math and Statistics calculators