2023 MIT Integration Bee Regular Season Problem 6 How do we solve $$\int\left(\frac{x^6+x^4-x^2-1}{x^4}\right)e^{x+\frac{1}{x}}dx$$? This is an integral in the 2023 MIT integration bee. I thought that maybe this is a consequence of the chain rule, but that is not the case. Then I thought there is a product rule hiding in the integrand, but it doesn't seem like it.

First, factor the integrand:
$$\frac{x^6+x^4-x^2-1}{x^4}=\frac{(x^4-1)(x^2+1)}{x^4}=\left(\frac{x^2+1}{x}\right)^2\left(1-\frac1{x^2}\right).$$
Now, let $y=x+1/x$; we have $dy=(1-1/x^2)dx$, so our integral becomes
$$\int \left(\frac{x^2+1}{x}\right)^2e^ydy=\int y^2e^ydy.$$
A standard integration by parts gives
$$\int y^2e^ydy=(y^2-2y+2)e^y+C,$$
so we have the answer
$$\left(\left(x+\frac1x\right)^2-2\left(x+\frac1x\right)+2\right)e^{x+1/x}+C.$$
