Q:

Question on Fourier series $\sum_{n=1}^\infty a_n \sin ( \pi nx) = f(x)$

Assume $\sum_{n=1}^\infty a_n \sin ( \pi nx) = f(x)$ where $f: [0,1] \rightarrow \mathbb R$ continuous is and $f(0) = f(1)$. Can I then recorver the $a_n$ by using somehow the Fourier series of $f$ ?
This question arises from some differential equation problem which is as follows:
Let $\Omega := \{0 < x < 1, 0<y\} \subseteq \mathbb R^2$. We then are looking for a function $u: \overline \Omega \rightarrow \mathbb C$ s.t.

$u \in C(\overline \Omega), u \in C^2(\Omega)$
$\Delta u = 0$ on $\Omega$
$\lim_{y \rightarrow \infty} u(x,y)  = 0$ for all $x \in [0,1]$.
$u(0,y) = u(1,y) = 0$ for all $y \geq 0$
$u(x,0) = f(x)$ for all $x \in [0,1]$.

This lead me to
$$
u(x,y) = \sum_{n \geq 1} a_n \sin (n \pi x) e^{-\pi n y}
$$ But now I have to calculate the $a_n$ with my last properity.

A:

Use $u(x,0)=f(x)$.  Then because the functions $\sin{(n \pi x)}$ form an orthogonal basis set, you may simply write that, for $n \gt 0$,
$$a_n = \frac{\displaystyle \int_0^1 dx \, f(x) \, \sin{(n \pi x)}}{\displaystyle\int_0^1 dx \,  \sin^2{(n \pi x)}} = 2 \int_0^1 dx \, f(x) \, \sin{(n \pi x)}$$

