TExcelTAD
Home › Algebra › Factoring and Reducing Algebraic Fractions

Factoring and Reducing Algebraic Fractions

An algebraic fraction (a rational expression) is one polynomial divided by another, such as x2−9x2+x−6\frac{x^2 - 9}{x^2 + x - 6}. Reducing it works exactly like reducing 1218\frac{12}{18} to 23\frac{2}{3}: factor top and bottom, then cancel the factors they share. The new part is keeping track of the values of xx that would make a denominator zero.

Rational expressions and their domain

A rational expression is undefined wherever its denominator is 0. Those xx values are excluded from its domain, and you should state them, because reducing can hide them.

x+2x−5excluded: x=53xx2−4x2−4=(x−2)(x+2) → excluded: x=2 and x=−2x−1x2+1x2+1 is never 0 for real x → nothing excluded\begin{aligned} &\frac{x + 2}{x - 5} && \text{excluded: } x = 5 \\ &\frac{3x}{x^2 - 4} && x^2 - 4 = (x - 2)(x + 2) \ \to\ \text{excluded: } x = 2 \text{ and } x = -2 \\ &\frac{x - 1}{x^2 + 1} && x^2 + 1 \text{ is never 0 for real } x \ \to\ \text{nothing excluded} \end{aligned}

Reducing: factor, then cancel factors

The rule is the same as for numbers (Equivalent Fractions): a factor common to the whole numerator and the whole denominator can be divided out, because a⋅kb⋅k=ab\frac{a \cdot k}{b \cdot k} = \frac{a}{b} for k≠0k \ne 0.

x2−9x2+x−6=(x−3)(x+3)(x+3)(x−2)factor both=x−3x−2cancel (x+3)excluded values from the ORIGINAL denominator: x=−3 and x=2\begin{aligned} &\frac{x^2 - 9}{x^2 + x - 6} \\ &= \frac{(x - 3)(x + 3)}{(x + 3)(x - 2)} && \text{factor both} \\ &= \frac{x - 3}{x - 2} && \text{cancel } (x + 3) \\[1ex] &\text{excluded values from the ORIGINAL denominator: } x = -3 \text{ and } x = 2 \end{aligned}

So x2−9x2+x−6=x−3x−2\frac{x^2 - 9}{x^2 + x - 6} = \frac{x - 3}{x - 2} for all x≠−3,2x \ne -3, 2. The reduced form is defined at x=−3x = -3, but the original is not; that point is a "hole" in the graph of the original.

Note: Only factors cancel, never terms. In x+66\frac{x + 6}{6} the 6 in the numerator is a term of a sum, not a factor of the whole numerator, so x+66≠x+1\frac{x + 6}{6} \ne x + 1. Test with x=6x = 6: 126=2\frac{12}{6} = 2, but x+1=7x + 1 = 7.

Opposites: a−ba - b and b−ab - a

x−4x - 4 and 4−x4 - x are not equal, but they are opposites: 4−x=−(x−4)4 - x = -(x - 4). So they cancel to −1-1:

4−xx2−16=−(x−4)(x−4)(x+4)=−1x+4,x≠±4\frac{4 - x}{x^2 - 16} = \frac{-(x - 4)}{(x - 4)(x + 4)} = \frac{-1}{x + 4}, \qquad x \ne \pm 4

Checking numerically

A good habit: pick a value of xx that is not excluded, evaluate the original and the reduced form, and compare. Fraction gives exact results:

python · try it yourself
from fractions import Fraction

def original(x):
    return Fraction(x**2 - 9, x**2 + x - 6)

def reduced(x):
    return Fraction(x - 3, x - 2)

for x in [0, 1, 5, -7]:
    print(x, original(x), reduced(x), original(x) == reduced(x))

for x in [-3, 2]:
    try:
        print(x, original(x))
    except ZeroDivisionError:
        print(x, "original is undefined (division by zero)")
0 3/2 3/2 True
1 2 2 True
5 2/3 2/3 True
-7 10/9 10/9 True
-3 original is undefined (division by zero)
2 original is undefined (division by zero)

Notice that Fraction itself reduces: Fraction(-9, -6) becomes 3/2 because it divides out gcd⁡(9,6)=3\gcd(9, 6) = 3. That is the same idea, done with numbers.

SymPy's cancel reduces a rational expression, and factor shows the factored form:

python · try it yourself
import sympy as sp

x = sp.symbols("x")
expr = (x**2 - 9) / (x**2 + x - 6)
print(sp.cancel(expr))
print(sp.factor(expr))
print(sp.cancel((4 - x) / (x**2 - 16)))
print(sp.cancel((2*x**2 + 5*x - 3) / (4*x**2 - 1)))
print(sp.solve(sp.denom(sp.together(expr)), x))   # excluded values
(x - 3)/(x - 2)
(x - 3)/(x - 2)
-1/(x + 4)
(x + 3)/(2*x + 1)
[-3, 2]

Tip: SymPy's cancel silently drops the excluded values. When you report a reduced answer, find them from the original denominator yourself, as the last line does.

In software

  • Avoiding 0/00/0. x2−1x−1\frac{x^2 - 1}{x - 1} evaluated at x=1x = 1 in floating point gives a division by zero, though the reduced form x+1x + 1 gives 2. Graphics and physics code often reduces formulas by hand first so that a special input does not crash or produce nan.
  • Fewer operations, less rounding. A reduced expression has smaller degree, so evaluating it costs less and accumulates less rounding error.
  • Exact rationals. fractions.Fraction, SymPy's Rational and big-number libraries keep every fraction reduced with a GCD after each operation, so numbers do not grow without bound (Euclid's algorithm).

Exercises

Exercise 1: Excluded values

State the excluded values of x+1x2−5x+6\frac{x + 1}{x^2 - 5x + 6}.

Answer

x=2x = 2 and x=3x = 3

Solution

x2−5x+6=(x−2)(x−3)x^2 - 5x + 6 = (x - 2)(x - 3), which is 0 at x=2x = 2 and x=3x = 3.

Exercise 2: Reduce a monomial fraction

Reduce 18a4b224a2b5\frac{18a^4b^2}{24a^2b^5}.

Answer

3a24b3\frac{3a^2}{4b^3}, with a≠0,b≠0a \ne 0, b \ne 0.

Solution
1824=34;a4a2=a2;b2b5=1b3\frac{18}{24} = \frac{3}{4}; \quad \frac{a^4}{a^2} = a^2; \quad \frac{b^2}{b^5} = \frac{1}{b^3}

Exercise 3: Factor and reduce

Reduce x2+7x+10x2−25\frac{x^2 + 7x + 10}{x^2 - 25}.

Answer

x+2x−5\frac{x + 2}{x - 5}, with x≠5,−5x \ne 5, -5.

Solution
(x+2)(x+5)(x−5)(x+5)=x+2x−5excluded from the original denominator: x=5 and x=−5\begin{aligned} &\frac{(x + 2)(x + 5)}{(x - 5)(x + 5)} = \frac{x + 2}{x - 5} \\ &\text{excluded from the original denominator: } x = 5 \text{ and } x = -5 \end{aligned}

Exercise 4: Opposite factors

Reduce 6−2xx2−9\frac{6 - 2x}{x^2 - 9}.

Answer

−2x+3\frac{-2}{x + 3}, with x≠±3x \ne \pm 3.

Solution
6−2x=2(3−x)=−2(x−3)−2(x−3)(x−3)(x+3)=−2x+3\begin{aligned} &6 - 2x = 2(3 - x) = -2(x - 3) \\ &\frac{-2(x - 3)}{(x - 3)(x + 3)} = \frac{-2}{x + 3} \end{aligned}
python · try it yourself
import sympy as sp

x = sp.symbols("x")
print(sp.cancel((6 - 2*x) / (x**2 - 9)))
-2/(x + 3)

Exercise 5: Spot the illegal cancellation

A student writes x2+4x+2=x+2\frac{x^2 + 4}{x + 2} = x + 2. Show with one value that this is wrong, and explain the mistake.

Answer

It is false: at x=1x = 1 the left side is 53\frac{5}{3} and the right side is 33. (At x=0x = 0 both sides happen to equal 2.)

Solution

x2+4x^2 + 4 is a sum of squares and does not factor into (x+2)(x+2)(x + 2)(x + 2) (that is x2+4x+4x^2 + 4x + 4). The student treated it as a difference of squares. A single test value may agree by chance, so test more than one.

python · try it yourself
from fractions import Fraction

for x in [0, 1, 2]:
    print(x, Fraction(x**2 + 4, x + 2), x + 2)
0 2 2
1 5/3 3
2 2 4

Test yourself

Reduce x2−4xx2−16\frac{x^2 - 4x}{x^2 - 16}.

  1. xx+4\frac{x}{x + 4}
  2. −4x−16\frac{-4x}{-16}
  3. xx−4\frac{x}{x - 4}
  4. 1/4

Which values are excluded from x−3x2−x−6\frac{x - 3}{x^2 - x - 6}?

  1. only 3
  2. 3 and −2
  3. −3 and 2
  4. none

What does 5−yy−5\frac{5 - y}{y - 5} simplify to?

  1. 1
  2. 0
  3. −1
  4. It cannot be simplified