Prove or disprove that $\int_{-1}^{1}\left(x+\frac1x\right)\cos x\,dx=0$ Prove or disprove that $\int_{-1}^{1}\left(x+\frac1x\right)\cos x\, dx=0$
My working: If $f(x)$ is an odd function, then $\int_{-a}^{a}f(x)dx=0$
As $\left(x+\frac1x\right)\cos x$ is odd, $\int_{-1}^{1}\left(x+\frac1x\right)\cos x\, dx=0$
Is this okay
My objections:
(i) At $0$ our function is not defined and (ii) $\lim_{x\to 0^+}\left(x+\frac1x\right)\cos x=\infty.$ Under these situation can we use our odd function result!!
 A: If a function $f$ is not defined at $x_0$, and $x_0\in(a,b)$, then the improper integral $\int_{a}^{b}f(x) \, dx$ is typically defined as
$$
\lim_{t\to x_0^-}\int_{a}^{t}f(x) \, dx+\lim_{t\to x_0^+}\int_{t}^{b}f(x) \, dx \, ,
$$
provided that both of these limits exist or are infinite, and their sum is also defined.
In your example, $\int_{-1}^{1}\left(x+\frac{1}{x}\right)\cos(x) \, dx$ equals
$$
\lim_{t\to 0^-}\int_{-1}^{t}\left(x+\frac{1}{x}\right)\cos(x) \, dx + \lim_{t\to0^+}\int_{t}^{1}\left(x+\frac{1}{x}\right) \cos(x) \, dx
$$
provided that the above expression is defined. As it turns out, however, the above expression is not defined, and so $\int_{-1}^{1}\left(x+\frac{1}{x}\right)\cos(x) \, dx$ does not mean anything according to the standard definition of improper integrals. To prove this, we note that
$$
\left(x+\frac{1}{x}\right)\cos(1)\le\left(x+\frac{1}{x}\right)\cos(x)
$$
for all $x\in(0,1]$, and so
$$
\lim_{t\to0^+}\int_{t}^{1}\left(x+\frac{1}{x}\right) \cos(1) \, dx \le \lim_{t\to0^+}\int_{t}^{1}\left(x+\frac{1}{x}\right) \cos(x) \, dx \, .
$$
Since the improper integral on the LHS evaluates to $\infty$, so does the improper integral on the RHS. By symmetry, $\lim_{t\to 0^-}\int_{-1}^{t}\left(x+\frac{1}{x}\right)\cos(x) \, dx=-\infty$, and since $-\infty + \infty$ is undefined, so too is $\int_{-1}^{1}\left(x+\frac{1}{x}\right)\cos(x) \, dx$. Note that symmetry rules can only be applied in certain contexts—more about this here. This was the mistake that you made.
That being said, the fact that $\int_{-1}^{1}\left(x+\frac{1}{x}\right)\cos(x) \, dx$ has no meaning according to the standard definition of improper integrals should not stop you from considering other definitions. In fact, the Cauchy principal value of your integral is $0$. If we explicitly state that this definition is the one we are using, then it is perfectly correct to write
$$
\int_{-1}^{1}\left(x+\frac{1}{x}\right)\cos(x) \, dx = 0 \, .
$$
