# Engineering Handbook/Calculus/Integration/rational functions

    $\int (ax+b)^{n}\,dx={\frac {(ax+b)^{n+1}}{a(n+1)}}+C\qquad {\text{(for }}n\neq -1{\mbox}}\,\!$ (Cavalieri's quadrature formula)
    $\int {\frac {c}{ax+b}}\,dx={\frac {c}{a}}\ln \left|ax+b\right|+C$
    $\int x(ax+b)^{n}\,dx={\frac {a(n+1)x-b}{a^{2}(n+1)(n+2)}}(ax+b)^{n+1}+C\qquad {\text{(for }}n\not \in \{-1,-2\}{\mbox}}$
    $\int {\frac {x}{ax+b}}\,dx={\frac {x}{a}}-{\frac {b}{a^{2}}}\ln \left|ax+b\right|+C$
    $\int {\frac {x}{(ax+b)^{2}}}\,dx={\frac {b}{a^{2}(ax+b)}}+{\frac {1}{a^{2}}}\ln \left|ax+b\right|+C$
    $\int {\frac {x}{(ax+b)^{n}}}\,dx={\frac {a(1-n)x-b}{a^{2}(n-1)(n-2)(ax+b)^{n-1}}}+C\qquad {\text{(for }}n\not \in \{1,2\}{\mbox}}$
    $\int {\frac {f'(x)}{f(x)}}\,dx=\ln \left|f(x)\right|+C$
    $\int {\frac {x^{2}}{ax+b}}\,dx={\frac {b^{2}\ln(\left|ax+b\right|)}{a^{3}}}+{\frac {ax^{2}-2bx}{2a^{2}}}+C$
    $\int {\frac {x^{2}}{(ax+b)^{2}}}\,dx={\frac {1}{a^{3}}}\left(ax-2b\ln \left|ax+b\right|-{\frac {b^{2}}{ax+b}}\right)+C$
    $\int {\frac {x^{2}}{(ax+b)^{3}}}\,dx={\frac {1}{a^{3}}}\left(\ln \left|ax+b\right|+{\frac {2b}{ax+b}}-{\frac {b^{2}}{2(ax+b)^{2}}}\right)+C$
    $\int {\frac {x^{2}}{(ax+b)^{n}}}\,dx={\frac {1}{a^{3}}}\left(-{\frac {(ax+b)^{3-n}}{(n-3)}}+{\frac {2b(ax+b)^{2-n}}{(n-2)}}-{\frac {b^{2}(ax+b)^{1-n}}{(n-1)}}\right)+C\qquad {\text{(for }}n\not \in \{1,2,3\}{\mbox}}$
    $\int {\frac {1}{x(ax+b)}}\,dx=-{\frac {1}{b}}\ln \left|{\frac {ax+b}{x}}\right|+C$
    $\int {\frac {1}{x^{2}(ax+b)}}\,dx=-{\frac {1}{bx}}+{\frac {a}{b^{2}}}\ln \left|{\frac {ax+b}{x}}\right|+C$
    $\int {\frac {1}{x^{2}(ax+b)^{2}}}\,dx=-a\left({\frac {1}{b^{2}(ax+b)}}+{\frac {1}{ab^{2}x}}-{\frac {2}{b^{3}}}\ln \left|{\frac {ax+b}{x}}\right|\right)+C$
    $\int {\frac {1}{x^{2}+a^{2}}}\,dx={\frac {1}{a}}\arctan {\frac {x}{a}}\,\!+C$
    $\int {\frac {1}{x^{2}-a^{2}}}\,dx={\begin{cases}\displaystyle -{\frac {1}{a}}\,\mathrm {arctanh} {\frac {x}{a}}={\frac {1}{2a}}\ln {\frac {a-x}{a+x}}+C&{\text{(for }}|x|<|a|{\mbox}}\\[12pt]\displaystyle -{\frac {1}{a}}\,\mathrm {arccoth} {\frac {x}{a}}={\frac {1}{2a}}\ln {\frac {x-a}{x+a}}+C&{\text{(for }}|x|>|a|{\mbox}}\end{cases}}$
For $a\neq 0:$
    $\int {\frac {1}{ax^{2}+bx+c}}dx={\begin{cases}\displaystyle {\frac {2}{\sqrt {4ac-b^{2}}}}\arctan {\frac {2ax+b}{\sqrt {4ac-b^{2}}}}+C&{\text{(for }}4ac-b^{2}>0{\mbox}}\\[12pt]\displaystyle -{\frac {2}{\sqrt {b^{2}-4ac}}}\,\mathrm {arctanh} {\frac {2ax+b}{\sqrt {b^{2}-4ac}}}+C={\frac {1}{\sqrt {b^{2}-4ac}}}\ln \left|{\frac {2ax+b-{\sqrt {b^{2}-4ac}}}{2ax+b+{\sqrt {b^{2}-4ac}}}}\right|+C&{\text{(for }}4ac-b^{2}<0{\mbox}}\\[12pt]\displaystyle -{\frac {2}{2ax+b}}+C&{\text{(for }}4ac-b^{2}=0{\mbox}}\end{cases}}$
    $\int {\frac {x}{ax^{2}+bx+c}}\,dx={\frac {1}{2a}}\ln \left|ax^{2}+bx+c\right|-{\frac {b}{2a}}\int {\frac {dx}{ax^{2}+bx+c}}+C$
    $\int {\frac {mx+n}{ax^{2}+bx+c}}\,dx={\begin{cases}\displaystyle {\frac {m}{2a}}\ln \left|ax^{2}+bx+c\right|+{\frac {2an-bm}{a{\sqrt {4ac-b^{2}}}}}\arctan {\frac {2ax+b}{\sqrt {4ac-b^{2}}}}+C&{\text{(for }}4ac-b^{2}>0{\mbox}}\\[12pt]\displaystyle {\frac {m}{2a}}\ln \left|ax^{2}+bx+c\right|-{\frac {2an-bm}{a{\sqrt {b^{2}-4ac}}}}\,\mathrm {arctanh} {\frac {2ax+b}{\sqrt {b^{2}-4ac}}}+C&{\text{(for }}4ac-b^{2}<0{\mbox}}\\[12pt]\displaystyle {\frac {m}{2a}}\ln \left|ax^{2}+bx+c\right|-{\frac {2an-bm}{a(2ax+b)}}+C&{\text{(for }}4ac-b^{2}=0{\mbox}}\end{cases}}$
    $\int {\frac {1}{(ax^{2}+bx+c)^{n}}}\,dx={\frac {2ax+b}{(n-1)(4ac-b^{2})(ax^{2}+bx+c)^{n-1}}}+{\frac {(2n-3)2a}{(n-1)(4ac-b^{2})}}\int {\frac {1}{(ax^{2}+bx+c)^{n-1}}}\,dx+C$
    $\int {\frac {x}{(ax^{2}+bx+c)^{n}}}\,dx=-{\frac {bx+2c}{(n-1)(4ac-b^{2})(ax^{2}+bx+c)^{n-1}}}-{\frac {b(2n-3)}{(n-1)(4ac-b^{2})}}\int {\frac {1}{(ax^{2}+bx+c)^{n-1}}}\,dx+C$
    $\int {\frac {1}{x(ax^{2}+bx+c)}}\,dx={\frac {1}{2c}}\ln \left|{\frac {x^{2}}{ax^{2}+bx+c}}\right|-{\frac {b}{2c}}\int {\frac {1}{ax^{2}+bx+c}}\,dx+C$
    $\int {\frac {dx}{x^{2^{n}}+1}}=\sum _{k=1}^{2^{n-1}}\left\{{\frac {1}{2^{n-1}}}\left[\sin \left({\frac {(2k-1)\pi }{2^{n}}}\right)\arctan \left[\left(x-\cos \left({\frac {(2k-1)\pi }{2^{n}}}\right)\right)\csc \left({\frac {(2k-1)\pi }{2^{n}}}\right)\right]\right]-{\frac {1}{2^{n}}}\left[\cos \left({\frac {(2k-1)\pi }{2^{n}}}\right)\ln \left|x^{2}-2x\cos \left({\frac {(2k-1)\pi }{2^{n}}}\right)+1\right|\right]\right\}+C$
Any rational function can be integrated using the above equations and partial fractions in integration, by decomposing the rational function into a sum of functions of the form:
    ${\frac {a}{(x-b)^{n}}}$, and ${\frac {ax+b}{\left((x-c)^{2}+d^{2}\right)^{n}}}.$