374: Using Mathematica to Find Partial Fraction Decompositions

These examples are designed to introduce you to the Mathematica commands Factor, Expand, Solve, Together, and Apart. Commands such as these are useful for finding partial fraction decompositions of proper rational functions!
?Factor
Symbol
Factor[poly] factors a polynomial over the integers. ​Factor[poly,Modulusp] factors a polynomial modulo the prime p. ​Factor[poly,Extension{
a
1
,
a
2
,…}] factors a polynomial allowing coefficients that are rational combinations of the algebraic numbers
a
i
.
Factor[x^3-5x^2-3x-18]
(-6+x)(3+x+
2
x
)
Factor[x^5-4x^4-16x^3+19x^2+24x+36]
(-6+x)(-2+x)(3+x)(1+x+
2
x
)
?Expand
Symbol
Expand[expr] expands out products and positive integer powers in expr. ​Expand[expr,patt] leaves unexpanded any parts of expr that are free of the pattern patt.
Expand[(-6+x)(-2+x)(3+x)(1+x+
2
x
)]
36+24x+19
2
x
-16
3
x
-4
4
x
+
5
x
?Solve
Symbol
Solve[expr,vars] attempts to solve the system expr of equations or inequalities for the variables vars. ​Solve[expr,vars,dom] solves over the domain dom. Common choices of dom are Reals, Integers, and Complexes.
Solve[x^3-5x^2-3x-18==0,x]
{x6},x
1
2
(-1-
11
),x
1
2
(-1+
11
)
Solve[{A+C+D==0,A+B+4D==6,-4A-3C+5D==1,-4A-4B-2C+2D==-2},{A,B,C,D}]
A
13
3
,B-1,C-5,D
2
3

?Together
Symbol
Together[expr] puts terms in a sum over a common denominator, and cancels factors in the result.
?Apart
Symbol
Apart[expr] rewrites a rational expression as a sum of terms with minimal denominators. ​Apart[expr,var] treats all variables other than var as constants.
Apart[1/(x^5-4x^4-16x^3+19x^2+24x+36)]
1
1548(-6+x)
-
1
140(-2+x)
+
1
315(3+x)
+
7+x
301(1+x+
2
x
)
Together[%]
1
(-6+x)(-2+x)(3+x)(1+x+
2
x
)
Apart[(6x^2+x-2)/((x+1)^2(x^2-4))]
2
3(-2+x)
-
1
2
(1+x)
+
13
3(1+x)
-
5
2+x
Together[%]
-2+x+6
2
x
(-2+x)
2
(1+x)
(2+x)