# Evaluate $\int_{0}^{\frac{1}{2}}\ x\cos(\pi x)\,\mathrm{d}x$

Evaluate$$\displaystyle\int_{0}^{\frac{1}{2}}\ x\cos(\pi x)\,\mathrm{d}x$$

My $u = x$ and my $du = dx$

$dv = \cos(\pi x)\, dx$

$v=\sin(\pi x)$

The answer book however has $v=\frac{1}{\pi}\sin(\pi x)$

Now the only formula I have for integral for $\cos(x)$ is:

$\int \cos(x)\, dx=\sin(x) + C$

Where did the $\frac{1}{\pi}$ come from?

I do not see a chain rule in this formula.

• $dv = \color{blue}{\pi}\cos (\pi x)$ Oct 10, 2015 at 3:37
• $$(f(k x))'=k\times f'(k x)$$ Oct 10, 2015 at 3:37
• @Sunny If your interested I can teach you a much easier way of integrating by parts, without having to define $u$, $dv$ etc. It's also much faster. I used it in my answer below. Oct 10, 2015 at 4:12
• Please don't use \displaystyle in formulas in the subject, since it takes a lot of vertical space in the list of questions. I've taken that away this time. Oct 10, 2015 at 8:45
• A generalization of this question: Improper Integral $\int_0^\frac{1}{2}x^n\cot(\pi x)\,dx$. Found using Approach0. Jan 9, 2017 at 6:57

Integrating by parts we have $$\displaystyle\int_0^{\frac{1}{2}}\ x\cos(\pi x)\ dx$$

$$=\displaystyle \left.\vphantom{\frac 1 1}\frac{1}{\pi}x\sin(\pi x)\right|_{x=0}^{x=\frac{1}{2}}-\frac{1}{\pi}\int_{x=0}^{x=\frac{1}{2}}\ \sin(\pi x)\ dx$$

$$=\displaystyle \frac{1}{2\pi}+\left.\vphantom{\frac 1 1}\frac{1}{{\pi}^2} \cos(\pi x)\right|_{x=0}^{x=\frac{1}{2}}$$

$$=\color{blue}\frac{1}{2\pi}-\frac{1}{{\pi}^2}$$

• @Sunny Can you now see where the $\cfrac{1}{\pi}$ comes from? Oct 10, 2015 at 4:06

$$\mathrm{d}v = \cos(\pi x)\ \mathrm{d}x \implies v = \int \cos(\pi x)\ \mathrm{d}x$$ if you call $y=\pi x$ then $\mathrm{d}y = \pi \mathrm{d}x => \mathrm{d}x = \frac{\mathrm{d}y}{\pi}$ then $$\int \cos(\pi x)\ \mathrm{d}x = \int \cos(y)\ \frac{\mathrm{d}y}{\pi} = \frac{1}{\pi}\int \cos(y)\ \mathrm{d}y = \frac{\sin(y)}{\pi} =\frac{\sin(\pi x)}{\pi}$$

An alternative to the methods already shown so far.

Let $$f(y) = \int_{0}^{1/2} \sin (yx) dx = \frac{1}{y}-\frac{1}{y}\cos \frac{y}{2}$$ Differentiate w.r.t y, we get, $$f'(y) = \int_{0}^{1/2} x\cos (yx) dx = -\frac{1}{y^2} + \frac{1}{y^2}\cos \frac{y}{2} + \frac{1}{2y}\sin \frac{y}{2}$$ Evaluating at $y = \pi$, we get, $$f'(\pi) = \int_{0}^{1/2} x\cos (\pi x) dx = -\frac{1}{\pi^2} + \frac{1}{2\pi}$$

In fact, we have $$\int_{x} \cos \pi x = \pi^{-1}\int_{x} \cos \pi x D\pi x = \pi^{-1}\int_{u:=\pi x}D\sin u = \pi^{-1}\sin \pi x + \text{some constant},$$ where the second equality is due to the "chain rule".

It is not difficult to guess that a primitive of $x\cos(x)$ is given by $x\sin(x)$ plus something simple, that is: $$\int x\cos(x)\,dx = x\sin(x)+\cos(x).\tag{1}$$ $(1)$ is straightforward to check through differentiation. From the previous line: $$\begin{eqnarray*} \int_{0}^{\frac{1}{2}}x\cos(\pi x)\,dx = \frac{1}{\pi^2}\int_{0}^{\pi/2}x\cos(x)\,dx &=& \frac{1}{\pi^2}\left.\left(x\sin x+\cos x\right)\right|_{0}^{\pi/2}\\&=&\color{red}{\frac{1}{\pi^2}\left(\frac{\pi}{2}-1\right)}.\tag{2}\end{eqnarray*}$$