<s>[INST] Definite integral of cosine times a quotient of two quartic polynomials If $f(x)=\frac{\left(x^2+x+1\right)^2+\left(x^4+x^2+1\right)}{\left(x^2+x+1\right)^2-\left(x^4+x^2+1\right)}$,then find $\int_{-\pi}^{\pi}\cos x\cdot f(x)dx$
Let $I=\int_{-\pi}^{\pi}\cos x\cdot f(x)dx=\int_{-\pi}^{\pi}\cos x\cdot\frac{\left(x^2+x+1\right)^2+\left(x^4+x^2+1\right)}{\left(x^2+x+1\right)^2-\left(x^4+x^2+1\right)}dx$
$I=\int_{-\pi}^{\pi}\cos x\cdot\frac{\left(x^2-x+1\right)^2+\left(x^4+x^2+1\right)}{\left(x^2-x+1\right)^2-\left(x^4+x^2+1\right)}dx$
But there seems no way for simplification,Please help me in solving this integral.
 [/INST] The function $f$ simplifies to $f(x)=x+1/x$, so
$$
\int_{-\pi}^\pi \cos(x)f(x)\,dx
$$
diverges.
Addition
This addition was asked for in a comment. The integrals
$$
\int_{-\pi}^0 (x+1/x)\cos x\,dx\quad\text{and}\quad \int_0^{\pi}(x+1/x)\cos x\,dx
$$
both diverges. To see this, we note that $x+1/x\approx 1/x$ and $\cos x\approx 1$ as $x\approx 0$ (you should make this more precise using a comparison theorem as it is stated in your book), so your function behaves like $1/x$ when $x\approx 0$. Since, for any $a>0$, the integrals
$$
\int_{-a}^0\frac{1}{x}\,dx\quad\text{and}\quad\int_0^a\frac{1}{x}\,dx
$$
both diverges, the integrals under inspection diverge.
</s>