# Rational Functions
A rational function in algebra is a function whose value represents the ratio of two [[Polynomials]]. For example, function $f(x)$, represents a ratio of polynomial $h(x)$ and $g(x)$, where $h$ and $g$ are polynomials.
$
f(x) = \frac{h(x)}{g(x)} = \frac{x^2-2x-1}{x+1}
$
A useful technique for dealing with rational functions is partial fraction decomposition. ![[Partial Fractions#^ill539]]
## Rational Function Derivative
$\frac d {dx} \left[ \frac {f(x)} {g(x)} \right] = \frac {f'(x)g(x) - f(x) g'(x)} {g(x)^2}$ ^mmdg5g
### Proof
Recall the product and reciprocal rules:
![[The Derivative Product Rule#^a1ucyf]]
![[The Derivative Chain Rule#^1vw3jd]]
$
\begin{align}
\frac d {dx} \left[ \frac {f(x)} {g(x)} \right] &= \frac d {dx} \left[ f(x) \frac 1 {g(x)} \right] \\
&=f'(x)\cdot \frac 1 {g(x)} +f(x)\left(-\frac{g'(x)}{g(x)^2}\right)\\
&= \frac{f'(x)}{g(x)} - \frac {f(x)g'(x)}{g(x)^2}\\
&=\frac {f'(x)g(x)-f(x)g'(x)} {g(x)^2}
\end{align}$
## Rational Function Antiderivative
[[Partial Fractions|Partial fraction decomposition]] can be used to determine the antiderivative of rational functions. First apply the decomposition and then take take the integral of each partial fraction individually.
Before attempting decomposition it's a good idea to attempt a substitution of $u= Q(x)$ where $Q$ is the fraction denominator to see if that would help.
^8s7sar
## Asymptotes
Rational functions can have horizontal, vertical and slant asymptotes.
### Vertical Asymptotes
A vertical asymptotes occurs when a specific value of $x$ would lead to a denominator that equals 0 and hence division by 0. As we approach that value (from the left or the right), we're consequently approaching positive or negative infinity.
Graphs of rational functions can thus never actually cross a vertical asymptote, as that would lead to division by 0.
### Horizontal Asymptotes
A horizontal asymptote is a line the function's graph approaches as $x$ values approach positive or negative infinity.
If the power of the numerator is lesser than the power of the denominator, the asymptote is always $y=0$ because the denominator will grow much more quickly than the numerator as $x$ approaches infinity.
Another way to get a horizontal asymptote is if the two powers are the same. In this case the asymptote can be determined by dividing the leading coefficients. The other terms can be ignored as they have little impact as $x$ approaches infinity.
### Slant Asymptotes
If a rational function does not have a horizontal asymptote, and its numerator's power is greater from its denominator's power by exactly 1, then the function will have a slant asymptote.
The equation that represents the slant asymptote can be determined by dividing the numerator by the denominator and ignoring the remainder, as it will have little baring as $x$ approaches infinity.
If the division leads to no reminder, the function will not have an asymptote, it will be a linear instead, but be undefined at the point where the denominator is 0.