<s>[INST] Sine Fourier Series for $\min(x, 1 - x)$. I am currently taking a class on differential equations and only Analysis and Linear Algebra I and II were expected. In those subjects we never covered Fourier series.
In an exercise I am now expected to solve
$$
\sum_{k = 1}^{\infty} a_k \sin(\pi k x)
= \min(x, 1 - x)
$$
for the coefficients $a_k$ and for $x \in (0,1)$. 
I'd be interested if anyone could share an approach, which someone with no previous knowledge of Fourier series could understand.
for reference: the given differential equation is $u_t - u_{xx} = 0$ for $t > 0$ and $x \in (0,1)$ with $u(0,t) = u(1,t) = 0$ and $u(x,0) = \min(x, 1 - x)$. for $x \in (0,1)$
EDIT 4 - Finally Correct
\begin{align*}
    a_k
    & = 2 [1 - (-1)^k] \int_{0}^{\frac{1}{2}} x \sin(k \pi x) dx
    = 2 [1 - (-1)^k]  \left[ \frac{\sin(k \pi x)}{(k \pi )^2} - \frac{x}{k \pi } \cos(k \pi x) \right]_{x = 0}^{\frac{1}{2}} \\
    & = 2 [1 - (-1)^k] \left( \frac{\sin(\frac{1}{2} k \pi)}{(k \pi )^2} - \frac{1}{2 k \pi } \cos\left(\frac{1}{2} k \pi\right) - \left( \frac{\sin^2(0)}{(k \pi )^2} - \frac{0}{k \pi } \cos(0) \right) \right) \\
    & = \frac{[1 - (-1)^k]}{k \pi} \left[ \frac{2 \sin(\frac{1}{2} k \pi)}{k \pi} - \cos\left(\frac{1}{2} k \pi\right) \right]
\end{align*}
Therefore we have $a_2k = 0$.
For $a_{2k + 1}$ we have
\begin{align*}
    a_{2k + 1}
    & = \frac{1 - (-1)^{2k + 1}}{(2k + 1) \pi} \left( \frac{2 \sin(\frac{1}{2} (2k + 1) \pi)}{(2k + 1) \pi} - \cos\left(\frac{1}{2} (2k + 1) \pi\right) \right) \\
    & = \frac{2}{(2k + 1) \pi} \left[ \frac{2 \overbrace{\sin\left(\frac{\pi}{2} + k \pi\right)}^{= \cos(k \pi)}}{(2k + 1) \pi} - \underbrace{\cos\left(\frac{\pi}{2} + k \pi\right)}_{= - \sin(k\pi) = 0.} \right] \\
    & = \frac{4 (-1)^k}{\left((2k + 1)\pi \right)^2}.
\end{align*}
 [/INST] The sine functions $\sin(k \pi x)$ are orthogonal. Thus forming the same scalar product on both sides of the sine series expansion $\sum_n a_n\sin(nπx)=\min(x,1-x)$, that is, multiplying with $\sin(k \pi x)$ and integrating, filters out the term with the coefficient $a_k$.
$$
a_k\int_0^1\sin^2(k \pi x)\,dx=\int_0^1\min(x,1-x)\,\sin(kπx)\,dx\\
\iff a_k\int_0^1[1-\cos(2k \pi x)]\,dx=2\int_0^{1/2}[1-(-1)^k]\,x\sin(kπx)\,dx\\
$$
One can see that for even $k$ the integrand on the right is an odd function relative to the axis $x=\frac12$, thus $a_{2m}=0$ for $m\in \Bbb N$. The integral for odd $k$ is a standard application for partial integration. Use
$$
\int_0^1\cos(2πkx)\,dx=0 ~~\text{ and }~~\int x\sin(ax)\,dx =-\frac{x\cos(ax)}a+\frac{\sin(ax)}{a^2}
$$
to get
$$
a_{2m+1}=4\;\left[-\frac{x\cos((2m+1)πx)}{(2m+1)π}+\frac{\sin((2m+1)πx)}{((2m+1)π)^2}\right]_{x=0}^{x=\frac12}
=\frac{\sin(mπ+\fracπ2)}{((m+\frac12)π)^2}
=\frac{(-1)^m}{((m+\frac12)π)^2}
$$

#/usr/bin/gnuplot    
min(a,b)=(a<b)?a:b
c(k,x)=4*sin(k*pi*x)/(k*pi)**2
plot [0:1] min(x,1-x) lt 8 lw 2, c(1,x)-c(3,x)+c(5,x)-c(7,x)+c(9,x)

</s>