<s>[INST] $ \int \frac{1}{(x-a)(x+b)} dx $ Could you please explain how to integrate this integral:
$$   \int \frac{1}{(x-a)(x+b)} dx   $$
 [/INST] $$\int\frac1{(x-a)(x+b)}dx$$
Use partial fractions
$$\int\frac1{x(a+b)-a(a+b)}+\frac1{-x(a+b)-b(a+b)}dx$$
Integrate the sum by term
$$\int\frac1{x(a+b)-a(a+b)}dx+\int\frac1{-x(a+b)-b(a+b)}dx$$
Substitute $u=-x(a+b)-b(a+b)$ and $du=(-a-b)dx$
$$\int\frac1{x(a+b)-a(a+b)}dx +  \frac1{-a-b}\int\frac1u du$$
Since $\int\frac1u du=\log u$
$$\int\frac1{x(a+b)-a(a+b)}dx +  \frac{\log u}{-a-b}$$
Substitute $s=x(a+b)-a(a+b)$ and $ds=(a+b)dx$
$$\frac1{a+b}\int\frac1sds +  \frac{\log u}{-a-b}$$
Since $\int\frac1s ds=\log s$
$$\frac{\log s}{a+b} +  \frac{\log u}{-a-b}+C$$
Substitute back for $s$ and $u$
$$\frac{\log ((a+b)(x-a))}{a+b} +  \frac{\log (-(a+b)(b+x))}{-a-b}+C$$
This is equivalent to
$$\frac{\log(x-a)-\log(b+x)}{a+b}$$
Assuming $x-a>0$ and $b+x>0$ this is the same as
$$\frac{\log\frac{x-a}{b+x}}{a+b}$$
</s>