compute the Fourier series for $f(s)=\min(s,t)$, where $t \in[0, \pi]$ is fixed Fix $t \in[0, \pi]$. I want to compute the Fourier series for the function $f(s)=s \wedge t$, where $s \in[0, \pi]$. The textbook I am reading (Richard F. Bass's stochastic process chapter 6) says that the answer is $s \wedge t=\frac{s t}{\pi}+\frac{2}{\pi} \sum_{k=1}^{\infty} \frac{\sin k s \sin k t}{k^{2}}$, but I just cannot get it.
 A: A Fourier series (in terms of $\cos ns, \sin ns$) defined on $[0,\pi]$ is not unique as we need to choose an extension to a $2\pi$ interval; from the form required, here we use the odd extension to $[-\pi,\pi]$ and we get a sine series with coefficients $$c_n=\frac{2}{\pi}\int_0^{\pi}f(s)\sin ns ds, n \ge 1$$
But $f(s)=s, 0 \le s \le t$ and $f(s)=t, t \le s \le \pi$
Splitting the integral and integrating by parts the first integral from $0$ to $s$ is $\frac{\sin nt}{n^2}-t\frac{\cos nt}{n}$, while integral from $t$ to $\pi$ is straightforward $t\frac {\cos nt}{n}-t(-1)^n/n$ so putting things together we get that $$f(s)=\frac{2}{\pi}\sum_{n\ge 1}(\frac{\sin nt \sin ns}{n^2}-t\frac{(-1)^n\sin ns}{n})$$
But for $-\pi <s<\pi$ we have that $$\frac{s}{2}=\sum_{n\ge 1}\frac{(-1)^{n+1}\sin ns}{n}$$
So we get the required result by substituting the above in the expression for $f$
Edit per comment question: explanation about extensions of functions defined on an interval of length $\pi$ to get good Fourier series for them
Using $\sin nx, \cos nx$ as a basis, the Fourier series is uniquely determined only by a periodic integrable function on a $2\pi$ length interval, so if one has a function defined on $[0, \pi]$, one can extend it in infinitely many ways to a $2\pi$ interval as essentially it can be anything (integrable) on $[-\pi,0]$ say and so one gets infinitely many potential series, all distinct, though of course all agreeing on the points of convergence on $[0, \pi]$ which depend only on the original $f$ (this showing that a Fourier series is a "global" object with nice local properties true, but still global, not a local one like a power series); now of course one wants the Fourier series to reflect best $f$ in this case so one usually chooses an extension that tells something about $f$ and the preferred ones are either odd or even to $[-\pi,\pi]$, so getting  a Fourier sine series or a Fourier cosine series; if $f$ is nice and $f(0)=0$ then the odd extension works well, but if $f(0) \ne 0$, the odd extension will be discontinuous at $0$ so the even extension may be better; of course, it all depends on the purposes one wants the Fourier series for and sometimes for a function on $[0, \pi]$ one specifies that one wants its sine series or its cosine series from the beggining as we can get either as noted
