TITLE: How to calculate this Integral which function is defined by parts
QUESTION [6 upvotes]: Let $k:[0,1]\times [0,1] \to \mathbb{R}$ defined as:
$k(x,y) =
\left\{
 \begin{array}{ll}
  y(1-x)  & \mbox{if } 0\leq y\leq x \le 1,\\
  x(1-y)  & \mbox{if } 0\leq x\leq y \le 1.
 \end{array}
\right.$
If we denote $u_n(x):=\sin(n\pi x), \forall n\in \mathbb{N}$. Prove that: $\int_0^1k(x,y)u_n(y) dy=\dfrac{\sin(n\pi x)}{n^2\pi^2}.$
My attempt was integrating by parts, and see that $k(x,0)=k(x,1)=0$ and $k'(x,y)=f(y)$ i.e the derivate of $f$ doesn't deppends of the value of $x$ at all, but is defined by parts.
But what I got using the previous facts was that:
$\int_0^1k(x,y)u_n(y) dy= \dfrac{-x\sin(n\pi)}{n^2\pi^2}=0, $ since $n\in \mathbb{N}.$
So... What I'm doing wrong, maybe Integrating By Parts in a function defined my parts, or maybe I may use theorems about compactness or convergent sub-sequences because $(u_n)$ is bounded and k is uniformly continuous. Any idea will be appreciated.

REPLY [3 votes]: Proceed as follows
\begin{align}\int_0^1k(x,y)u_n(y) dy
=& 
\int_0^1k(x,y)\sin(n\pi y)dy\\
=& \>(1-x)\int_0^x y \sin(n\pi y)dy
 + x\int_x^1 (1-y) \sin(n\pi y)dy\\
\overset{ibp}=&\>
(1-x)\left( -\frac{x\cos n\pi x}{n\pi}+\int_0^x \frac{\cos n\pi y}{n\pi}dy\right)\\
&\hspace{5mm}+x\left( \frac{(1-x)\cos n\pi x}{n\pi}-\int_x^1\frac{\cos n\pi y}{n\pi}dy\right)
\\=&\>(1-x)\int_0^x \frac{\cos n\pi y}{n\pi}dy -x\int_x^1 \frac{\cos n\pi y}{n\pi}dy \\
= &\>\int_0^x \frac{\cos n\pi y}{n\pi}dy -x\int_0^1 \frac{\cos n\pi y}{n\pi}dy \\
=&\>\dfrac{\sin(n\pi x)}{n^2\pi^2}
\end{align}