# Integral from yesterdays test: $\int_0^\pi {{1+\sin^2x}\over{6-\cos^2x+\left|\cos x\right|}} \sin x \cdot x \, dx$

This was the integral we had on the test yesterday:

$$\int_0^\pi {{1+\sin^2x}\over{6-\cos^2x+\left|\cos x\right|}} \sin x \cdot x \, dx$$

None of my friends including me managed to solve it. Does anyone know how to solve this integral? I tried literally everything but couldn't manage to solve it ... By the way, do you think that this integral is way too hard to be on the test? (First year of college, 90 min test )

• It looks rather tough I'd suggest converting the $sin^2(x)$ in the top to a $1-cos^2(x)$ then letting $cos(x)=u$ – Faust Jun 11 '18 at 3:06
• It's more challenging than a typical test question but it's within reach of freshman-calculus techniques. – Michael Hardy Jun 11 '18 at 3:17

Let me write $$f(x)={{1+\sin^2x}\over{6-\cos^2x+\left|\cos x\right|}} \sin x$$ and $$I=\int_0^\pi f(x) x\,dx.$$ Since $\sin(\pi-x)=\sin x$ and $\cos(\pi-x)=-\cos x$, we have $f(\pi-x)=f(x)$. So, making the substitution $u=\pi-x$ in the integral, we have $$I=\int_{\pi}^0f(u)(\pi-u)(-du)=\pi\int_0^\pi f(u)\,du-\int_0^\pi f(u)u\,du=\pi\int_0^\pi f(u)\,du-I$$ and so $$2I=\pi\int_0^\pi f(u)\,du.$$ The identity $f(\pi-x)=f(x)$ furthermore gives that $$\int_0^\pi f(x)\,dx=2\int_0^{\pi/2}f(x)\,dx.$$ So, it suffices to compute the integral $$J=\int_0^{\pi/2}f(x)\,dx$$ and then we will have $I=\pi J$.

To compute $J$, first observe that $\cos x$ is always nonnegative for $x\in[0,\pi/2]$ so we may ignore the absolute value in $f(x)$. We now make the substitution $u=\cos x$ to get $$J=\int_1^0\frac{2-u^2}{6-u^2+u}(-du)=\int_0^1\frac{2-u^2}{-(u-3)(u+2)}\,du$$ (here we use the fact that $\sin^2 x=1-\cos^2 x$ to write the numerator in terms of $u$). Now we use partial fractions to write the integrand as $$1+\frac{7/5}{u-3}-\frac{2/5}{u+2}$$ which we can now integrate straightforwardly to find that $$J=1+\frac{7}{5}(\log2-\log 3)-\frac{2}{5}(\log 3-\log 2)=1+\frac{9}{5}\log\frac{2}{3}.$$

We conclude that $$I=\pi\left(1+\frac{9}{5}\log\frac{2}{3}\right).$$

(For confirmation that I have managed to not make any small mistake, WolframAlpha computes both the integral and my answer to be approximately $0.848741$.)

I was about to say there is a certain symmetry that implies that the integral from $0$ to $\pi/2$ cancels out the integral from $\pi/2$ to $\pi,$ since the function is symmetric about the point $(\pi/2,0).$ But that is not true, because of the multiplication by $x,$ so just skip this paragraph unless you want to see if you can figure out a subtler version of that argument.

However: $${{1+\sin^2x}\over{6-\cos^2x+\left|\cos x\right|}} \sin x \, dx = \frac{2-\cos^2 x}{6-\cos^2 x + \left|\cos x\right|} (\sin x\,dx) = \frac{2-w^2}{6-w^2+|w|}\,dw$$ On the interval from $0$ to $\pi/2$ you have $\cos x\ge0$ so you can drop the absolute value sign. Then you have $6-w^2+w=-(w-3)(w+2).$ And on the interval from $\pi/2$ to $\pi$ you have $6-w^2-w = -(w+3)(w-2).$

So first use partial fractions and write $du = \dfrac{2-w^2}{6-w^2+w}\,dw$ or else the version with $6-w^2-2,$ and integrate to find out what $u$ is, and then you have $$\int x \left( \frac{2-w^2}{6-w^2+w} \, dw \right) = \underbrace{\int x\, du = xu - \int u\, dx}_\text{integration by parts}$$ and work separately on the interval from $\pi/2$ to $\pi,$ in a similar way.

• There is indeed a subtler version of the symmetry argument that works--see my answer. At least, it works well enough to let you skip the integration by parts at the end of your approach. – Eric Wofsey Jun 11 '18 at 3:42