<s>[INST] How to integrate a function of form f (x)/g (x) $\frac {(ax^n+b) dx}{cx^m+d}$ How to find $\int \frac {(ax^n+b) dx}{cx^m+d}$ (where m>n and m,n are natural numbers,and a,b,c,d are integers) ?
 [/INST] The general approach will involve:


*

*If $n\geq m$, use long division to get a polynomial plus a fraction of two polynomials where the degree of the numerator is smaller than $m$.

*Factoring $cx^m+d$ in factors with linear and quadratic terms.

*Applying partial fraction decomposition.

*Seperating all partial fractions in individual integrals.

*Applying either the ln method or the arctan method. 



$m=1$, $n=1$. Then \begin{align*} \int \frac{ax+b}{cx+d} dx &= \int \frac{a}{c} + \frac{b-\frac{da}{c}}{cx+d} dx \\ &= \int \frac{a}{c} + \frac{bc-da}{c^2x+cd} dx \\ &= \int \frac{a}{c}dx + \int  \frac{bc-da}{c^2x+cd} dx \\ &=  \frac{a}{c}x + \frac{bc-da}{c}\int  \frac{1}{cx+d} dx\end{align*}
Substitution $u=cx+d$. 
\begin{align*}\\ \frac{a}{c}x + \frac{bc-da}{c}\int  \frac{1}{cu} du &= \frac{a}{c}x + \frac{bc-da}{c^2}\int  \frac{1}{u} du \\  &= \frac{a}{c}x + \frac{bc-da}{c^2}\ln(u) \\  &= \frac{a}{c}x + \frac{bc-da}{c^2}\ln(cx+d)  \end{align*}
</s>