For which values of $a,b$ the following integral is an elementary function, and which elementary function?
$$\int \frac{x^2+ax+b}{(x-1)^2}\,e^x\, dx$$
I tried to solve this integral but it is too hard, someone can help me please, thanks for your time and help.
$$\frac{d}{dx}\frac{e^x}{(x-1)} = \frac{(x-2)}{(x-1)^2}e^{x} $$ hence if $$ \frac{x^2+ax+b}{(x-1)^2} = 1+k\frac{x-2}{(x-1)^2} $$ i.e. $\color{red}{2a+b = -3}$, we have an elementary integral, $\color{red}{\left(1+\frac{a+2}{x-1}\right)e^x}$.
Some differential Galois theory is required to prove that the previous if is in fact an iff.