Calculate: (x^3-3x+1)-(x^3+7-12x)

Expression: $\frac{ {x}^{2}-x-13 }{ \left( {x}^{2}+7 \right) \times \left( x-2 \right) }$

For each factor in the denominator, write a new fraction using the factors as new denominators. The numerators are unknown values

$\frac{ ? }{ {x}^{2}+7 }+\frac{ ? }{ x-2 }$

Since the factor in the denominator is quadratic, the numerator is an unknown linear expression $Ax+B$

$\frac{ Ax+B }{ {x}^{2}+7 }+\frac{ ? }{ x-2 }$

Since the factor in the denominator is linear, the numerator is an unknown constant $C$

$\frac{ Ax+B }{ {x}^{2}+7 }+\frac{ C }{ x-2 }$

To get the unknown values, set the sum of fractions equal to the original fraction

$\frac{ {x}^{2}-x-13 }{ \left( {x}^{2}+7 \right) \times \left( x-2 \right) }=\frac{ Ax+B }{ {x}^{2}+7 }+\frac{ C }{ x-2 }$

Multiply both sides of the equation by $\left( {x}^{2}+7 \right) \times \left( x-2 \right)$

${x}^{2}-x-13=\left( x-2 \right) \times \left( Ax+B \right)+\left( {x}^{2}+7 \right)C$

Simplify the expression

${x}^{2}-x-13=A{x}^{2}+Bx-2Ax-2B+C{x}^{2}+7C$

Use the commutative property to reorder the terms

${x}^{2}-x-13=A{x}^{2}+C{x}^{2}+Bx-2Ax-2B+7C$

Group the powers of the $x$-terms and the constant terms

${x}^{2}-x-13=\left( A+C \right){x}^{2}+\left( B-2A \right)x+\left( -2B+7C \right)$

When two polynomials are equal, their corresponding coefficients must be equal

$\left\{\begin{array} { l } -13=-2B+7C \\ -1=B-2A \\ 1=A+C\end{array} \right.$

Solve the system of equations

$\left( A, B, C\right)=\left( 2, 3, -1\right)$

Substitute the given values into the formed partial-fraction decomposition

$\frac{ 2x+3 }{ {x}^{2}+7 }+\frac{ -1 }{ x-2 }$

Use $\frac{ -a }{ b }=\frac{ a }{ -b }=-\frac{ a }{ b }$ to rewrite the fraction

$\frac{ 2x+3 }{ {x}^{2}+7 }-\frac{ 1 }{ x-2 }$