The energy eigenfunctions $\varphi_n(x)=\sqrt{\frac{2}{a}} \sin(\frac {n\pi x}{a})$ are said to be complete (and form a basis) within the interval $(0,a)$ meaning any square integrable function can be expanded as
\begin{equation}\tag{*}\label{*} f(x)=\sum_{n=1}^{\infty} c_n \sqrt{\frac{2}{a}} \sin(\frac {n\pi x}{a}). \end{equation}
Note that I have excluded the boundary points because all the basis functions are zero there by construction. However, here is my confusion: the Fourier series theorem when applied to a function with period $2a$ gives us the expansion
\begin{equation}\tag{**}\label{**} f(x)=a_0+\sum_{n=1}^{\infty}a_n \sin(\frac {n\pi x}{a})+ b_n \cos(\frac {n\pi x}{a}). \end{equation} where the set of functions $\{1,\sin(\frac {n\pi x}{a}),\cos(\frac {n\pi x}{a})\}$ form the basis. So, my question is why do coefficients $a_0$ and all the $b_n$'s go to zero in the Fourier series (see \ref{**}) for the functions under consideration in the first expression (see \ref{*})?
Edit: Quoting from Wikipedia,
Sines and cosines form an (orthonormal) Schauder basis for square-integrable functions on a finite domain. As a particular example, the collection: $$\{\sqrt{2} \sin (2 \pi n x) \mid n \in \mathbb{N}\} \cup\{\sqrt{2} \cos (2 \pi n x) \mid n \in \mathbb{N}\} \cup\{1\}$$ forms a basis for $L^2[0,1]$.
Again, this basis set is larger than the supposed basis set just consisting of $\sin$ functions.