# Evaluate $\frac{1}{T} \int_{-T}^{T} x\cos\left(\frac{n\pi x}{T}\right)\mathrm{d}x$

How do you evaluate the integral

$$\frac{1}{T} \int_{-T}^{T} x\cos\left(\frac{n\pi x}{T}\right)\, \mathrm{d}x?$$

I am trying to integrate this, however I don't seem to get the correct answer, which is

$$\frac{-2T}{\pi^{2}n^{2}}( 1 - \cos(n\pi )).$$

I tried integration by parts with

\begin{align} u &= x, &\mathrm{d}u &= 1; \\ \mathrm{d}v &= \cos\left(\frac{n\pi x}{T}\right)\,\mathrm{d}x, & v &= \frac{T}{n\pi} \sin\left(\frac{n\pi x}{T}\right). \end{align}

• Looks good so far. What did you do then? – Daniel Fischer Jun 14 '15 at 20:02
• You got all the things you need, just apply the formula (: – Chee Han Jun 14 '15 at 20:09

The integrand is an odd function. Since the interval of integration is symmetric around $0$, the integral is equal to $0$.

Hint:

When integrating $u'v$ by parts, the integral will become $uv'$. You need to choose what is $u'$ in such a way that you can integrate it, and that the product $uv'$ is simpler to process.

In the case at hand, omitting all the constants for conciseness,

$$\int x\cos(x)\,dx$$ you can choose $u'=x$, then $u=x^2$ leading to $$\int x^2\sin(x)\,dx,$$ not really easier.

Or you can choose $u'=\cos(x)$, then $u=\sin(x)$ leading to

$$\int \sin(x)\,dx,$$the right choice.