Completeness of energy eigenfunctions of the infinite potential well vs Fourier series 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.
 A: In fact, these are just two different bases for the same space. Any function on a compact interval $[0,a]$ can be written as a sum of sines, cosines, or both.
In the language of Fourier series, what we’re doing is taking the function defined on $[0,a]$ and extending it to a periodic function on the entire real line in three different ways.

*

*We can extend the original function to an odd function on $[-a,a]$ and then copy and paste that function across the rest of the real line. Because this function is odd the Fourier expansion includes only sines.

*If we first extend the original function to an even function on $[-a,a]$, then the corresponding expansion will include only cosines.

*If we don’t bother with the initial extension and just copy and paste our original function as-is, then the expansion will include both sines and cosines.

Note that in the first two cases, the periodic function being expanded has period $2a$, and so the arguments of the trig functions will look like $\frac{2n\pi x}{2a}=\frac{n\pi x}{a}$. In the third, the function will be periodic with period $a$ and so the arguments will take the form $\frac{2n\pi x}{a}$.

From a physical perspective, this can be understood by noting that $$b_1=\left\{\sin\left(\frac{n\pi x}{a}\right)\right\}_{n=1}^\infty \qquad b_2=\left\{\cos\left(\frac{n\pi x}{a}\right)\right\}_{n=0}^\infty$$
$$b_3=\left\{1,\sin\left(\frac{2n\pi x}{a}\right),\cos\left(\frac{2n\pi x}{a}\right)\right\}_{n=1}^\infty$$
are sets of eigenfunctions corresponding to three different self-adjoint operators:

*

*$b_1$ corresponds to the operator $-\frac{d^2}{dx^2}$ which may act on twice (weakly) differentiable functions with Dirichlet boundary conditions (i.e. $f(0)=f(a)=0$). This is often taken to be the Hamiltonian of a free particle confined to a box because it is the set of bound states for the finite potential well when the height of the walls goes to infinity.

*$b_2$ corresponds to the operator $-\frac{d^2}{dx^2}$ which may act on twice (weakly) differentiable functions with Neumann boundary conditions (i.e. $f'(0)=f'(a)=0$). This is an alternative Hamiltonian which also confines the particle to the box without demanding that energy eigenstates vanish at the edges, and is in some sense more natural; note that the uniform wavefunction $\psi(x)=1/\sqrt{a}$ is an energy eigenstate with zero energy and therefore evolves trivially with time, whereas if we choose the Hamiltonian with Dirichlet boundary conditions $\psi$ would distort very rapidly with time.

*$b_3$ corresponds to the operator $-i\frac{d}{dx}$ which may act on (weakly) differentiable functions with periodic boundary conditions (i.e. $f(0)=f(2\pi)$). This is the (angular) momentum operator for a particle on a ring of circumference $a$.

