#### *Related to [[Polynomial long division]]*
---
## How to integrate with partial fractions
- Integration by partial fractions is a technique we can use to **integrate fractions with a polynomial denominator and numerator.** The basic idea is to **find two fractions whose *sum* is equal to the original fraction**, essentially we want to break our complex fraction up into two smaller fractions. Since these *smaller fractions* are separated by an operator we can evaluate their integrals separately, making the process of integration significantly easier.
- The first step in integration by partial fractions is to **factor the fraction's denominator** into a distinct number of separate terms. *If the denominator is a quadratic this will be in the form of $\small(x+a)(x+b)$*
- If the **degree of the numerator's polynomial is *equal to or larger* than the degree of the denominator's polynomial** you will have to perform *polynomial long division* prior to factorization. This is because partial fraction decomposition **only works** when the degree of the numerator's polynomial is **smaller** than the denominator.
- After performing polynomial long division **you will likely still have a fraction in the simplified equation**. Split up the equation and evaluate the integral of that fraction separately, using partial fraction decomposition.
- If **both the numerator and denominator of the integrand are polynomials** and the **degree of the numerator is *smaller* than the degree of the denominator** you don't have to modify the integrand prior to factorization.
$\newline$
$\text{Step 1 - factor the denominator}$
$\int\frac{3x+11}{x^2-x-6}\;\;{\color{grey}\longrightarrow}\;\int\frac{3x+11}{(x-3)(x+2)}$
$\newline$
- If traditional factoring methods fail to work, you may have to use a technique known as **completing the square**. This technique requires you to find a single squared term along with some added constant A that equals the denominator. For example:
$\frac{1}{x^2+4x+5}\;\;\longrightarrow\;\;\frac{1}{(x+2)^2+1}$
$\newline$
- After factoring the denominator into 2, 3 or maybe in 4 terms **we set the integrand equal to a new equation that contains one, separate fraction *for each factored term*.** The terms are placed in the denominator of these new fractions and the numerator of each fraction will be a polynomial that is a degree lower. This polynomial must have a distinct variable *(A, B C...)* in place of each integer *(value that is not x)*. Depending on the form of the factored terms the form of the new separated fractions *will vary* so be sure to reference the chart below.
- *What we are doing here is asking the question: the sum of what fractions equals the original integrand? Since the polynomial in the numerator is of a lower degree than the denominator we KNOW we can create it through cross multiplication.*
>[!quote]
>##### *Factor form and corresponding fraction form chart*
>![[partialdecompforms.png|850]]
>- *Note: A1 and A2 are separate variables like A and B*
- After **"decomposing"** the fraction into two or more separate fractions we must re-combine them **back into single fraction by performing cross multiplication *(see more in [[Algebra]])*.
$\newline$
$\text{Step 2 - Seperate the fraction and re-combine}$
$\frac{3x+11}{(x-3)(x+2)}=\frac{A}{x-3}+\frac{B}{x+2}=\frac{A(x+2)+B(x-3)}{(x-3)(x+2)}$
$\newline$
- By moving the denominator of the original fraction across the equal sign **we can cancel out the denominator on the right side leaving only the numerators in both fractions**. Next, we must use a system of equations to solve for all of the non original variables *(A, B, C...)* such that both sides of the equation are equal.
- If the resulting equation is simple enough one way to find A and be is plug in **the x values that satisfy the factored polynomial** *(these are the values that make the polynomial equal to zero)*. In the case below, these values would be 3 and -2.
$\newline$
$\text{Step 3 - Solve for the variables}$
${\color{grey}(x-3)(x+2)\cdot}\frac{3x+11}{\cancel{(x-3)(x+2)}}=\frac{A(x+2)+B(x-3)}{\cancel{(x-3)(x+2)}}{\color{grey}(x-3)(x+2)}$
$\therefore\;\;3x+11=A(x+2)+B(x-3)$
$\newline$
$\text{}$
$3(3)+11=A(3+2)+B(3-3)\;{\color{grey}\longrightarrow}\;20=5A\;{\color{grey}\longrightarrow}\color{LightCyan}\;A=4$
$3(-2)+11=A(-2+2)+B(-2-3)\;{\color{grey}\longrightarrow}\;5=-5B\;{\color{grey}\longrightarrow}\color{LightCyan}\;B=-1$
$\small\color{grey}\text{Here we plugged in the solutions to }(x-3)(x+2)\text{ to solve for A and B}$
$\newline$
- After solving for all the variables **we can plug their results back in to the decomposed partial fraction**. Since the decomposed fraction has multiple, simple fractions separated by operators we can evaluate the integral of **each fraction separately**. This should make the integral *much* easier to solve.
$\newline$
$\text{Step 4 - Plug in values and evaluate integral}$
$\frac{A}{x-3}+\frac{B}{x+2}\;{\color{grey}\longrightarrow}\;\Huge\boxed{\color{LightCyan}\large\int\frac{4}{x-3}\,dx+\int\frac{-1}{x+2}\,dx}$
$\newline$
---
## Polynomial long division
*Note: I have used the square root sign in the following equation to **represent** the long division sign since there is none in latex*
##### *What is polynomial long division?*
- Polynomial long division is a technique that allows us **to divide two polynomials from one another**. The process is useful in situations **where the polynomial in the *numerator* of an integral's fraction is of an *equal or higher order* than the polynomial in the denominator**.
- Performing polynomial long division is results in the creation of a *new fraction* which has a polynomial **in its numerator that is of a lower order than the polynomial in it's denominator**.
- To set up polynomial long division **we re-write the term in the numerator of the fraction, under the long division symbol and re-write the polynomial in the denominator to the right of the long division symbol**.
- Just like in regular long division the **answer** will be writen out **on top of the long division symbol** on digit at a time from left to right *as we carry out the process.*
- When writing out the two polynomials **its important to make sure that both of the polynomials have a coefficient written in for *every* term between their *highest* and *lowest* degree.** If one of the polynomials is missing a term we can fix that by writing it in with a coefficient value of **zero** like the following example shows:
$\text{\color{grey}\small Example: }\;\;4x^3+2x+7\;\;\text{\color{grey}\small is missing the x squared term }$
$\text{\color{grey}\small Thus we would write it as: }\;\;4x^3+0x^2+2x+7$
$\large-======================================-$
$\text{Set up example }\longrightarrow\;\frac{2x^2+4}{4x+3}\;\longrightarrow\;\Huge\boxed{\;\large\color{lightcyan}4x+3\,\sqrt{2x^2+0x+4}\;}$
$\newline$
###### *How to perform polynomial long division*
- The first step in polynomial long division to ==**divide the first term in the "numerator" by the first term in the denominator *(recall: the numerator is the term written to the right of the long division/square root symbol and the denominator is written under the symbol)***.== Remember to record the result of each step by writing out **the result above the long division symbol, next to the associated digit, populating the answer from left to right**.
- Multiplying the first digit in the polynomial on the left by this *"result"* should give you a term that is equal to the first term in the *numerator's* polynomial *(the one under the long division symbol)*. This is an easy way of checking your work.
$\text{Polynomial long division step - 1:}$
$\Huge\boxed{\;\normalsize\begin{aligned}&\;\;\;\;\;2x^2\color{grey}\leftarrow 2x^3/x\\x+2\;&\sqrt{\;2x^3-3x^2+0x+5}\end{aligned}\;}$
$\newline$
- Next, you must multiply **all the terms** in the numerator *(the polynomial to the left of the long division symbol)* by this quotient and subtract the resulting polynomial from the denominator.
- Usually this is done by placing the resulting - **multiplied** polynomial under the *numerator's* corresponding terms. This makes the next step of subtracting easier since **you can subtract each term from the one directly above it, writing out the new result below *(just like you would do if you were performing long subtraction).*
- The leftmost subtracted term **should always cancel out with the term above it**..
$\text{Polynomial long division step - 2:}$
$\Huge\boxed{\normalsize\;\begin{aligned}&\;\;\;\;\;\;\;\;2x^2\color{grey}\\x+&2\;\sqrt{\;\cancel{2x^3}-3x^2+0x+5}\\&\;\;\;\,-\underline{(\cancel{2x^3}+4x^2)}\color{grey}\leftarrow (x\cdot 2x^2)+(2\cdot 2x^2)\\&\;\;\;\;\;\;\;\;\;\;\;\;\;=-7x^2\end{aligned}\;}$
$\newline$
- After this, we bring down the terms that weren't subtracted by anything, thus creating a *new* polynomial that **should be one degree/term less than the previous one in the numerator *(the term under the long division symbol)***. Again, we divide the left most term in our *new polynomial* by the **first term in the new numerator** and record the result above the division sign, to the right of the previously written term.
- We then **multiply the denominator by this quotient** and subtract the result from the *new numerator* which should be one term shorter than it was in previous steps. ==**We repeat this process until the polynomial under the long division symbol *(the original fraction's numerator)* is of a smaller degree than the term outside polynomial *(the original fraction's denominator)**==.
- Whatever is left over under the long division sign after this process is known **as the remainder**. The remainder will **always be a polynomial that is one degree less then the polynomial to the *left* of the long division sign** *(the term that was originally in the fraction's denominator)*.
$\text{Polynomial long division step - 3}$
$\Huge\boxed{\normalsize\;\begin{aligned}&\;\;\;\;\;\;\;\;2x^2 \;-7x\;+14\\x+&2\;\sqrt{\;\cancel{2x^3}-3x^2+0x+5}\\&\;\;\;\,\color{grey}-\underline{(\cancel{2x^3}+4x^2)}\color{grey}\\&\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\underline{\cancel{-7x^2}+0x+5}\\&\;\;\;\;\;\;\;\;\;\;\,\color{grey}\underline{-(\cancel{-7x^2}-14x)}\\&\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\underline{\cancel{14x}+5}\\&\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\,\color{grey}-\underline{(\cancel{14x}+28)}\\&\;\;\;\;\;\;\textit{the remainder}\rightarrow\color{lightcyan}-23\;\;\end{aligned}}$
- Once we have found the remainder we know that the process of **polynomial long division is complete**.
- After finding the remainder we must re-write the equation. The polynomial that was written out **on top of the long division sign** must be written out **alone** before the new fraction. The new fraction's denominator is equal to the original fraction's denominator *(which is the term written out on the left side of the long division sign)* and the fraction's **numerator is equal to the remainder**.
$\text{Result:}$
$\Huge\boxed{\large\frac{2x^3-3x^2+5}{x+2}=\color{Bisque}2x^2-7x+14-\frac{23}{x+2}}$
- The equation created as a result of **polynomial long division** should be relatively **trivial** to integrate** although you may still have to use partial fractions to find the **integral of the new fraction created**.
- Using [[Integration|integration]] rules you can separate the *lone polynomial* and the *fraction* into **two separate integrals** which often simplifies the process of integration.
---
## Calculator
>[!cite]
>---
>
><iframe src="https://dmackinnon1.github.io/polygrid/calc.html" width=850 height="800"></iframe>