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. 
 A: 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}{\displaystyle \frac{1}{2\pi}-\frac{1}{{\pi}^2}}$$
A: $$
\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} 
$$
A: 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}$$
A: 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".
A: 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*}$$
