This question says
Showing $\sin(nx)$ is a complete orthonormal system
Merely $\sin(nx)$ forms a complete orthonormal system for $L^2(0,\pi)$, which I thought was interesting. Can the same be said for $\cos(nx)$? I tried to follow the above question and tried to make up an even function but somehow did not work out.
Suppose $A,B$ are real constants that are not both $0$, and suppose $C,D$ are also real constants that are not both $0$. Consider the system $$ y''+\lambda y = 0 \\ Ay(0)+By'(0) = 0,\\ Cy(\pi)+Dy'(\pi)=0. $$ Note that $y=0$ is always a solution of the above problem. There are non-trivial solutions of the above equation only for a discrete sequence of real $\lambda$ values $$ \lambda_1 < \lambda_2 < \lambda_3 < \cdots. $$ For each such $\lambda_k$, the non-trivial solution $y_k(x)$ is unique up to a non-zero multiplicative constant, and the solutions $\{ y_k \}$ form a complete orthonormal basis of $L^2[0,\pi]$.
Sine Example: Let $A=1,B=0$, $C=1,D=0$. The non-trivial solutions of $$ y''+\lambda y =0 \\ y(0)=0,\;\; y(\pi)=0, $$ are $\sin(nx)$, corresponding to $\lambda_n=n^2$ for $n=1,2,3,\cdots$. These form an orthogonal basis of $L^2$.
Cosine Example: Let $A=0,B=1,C=0,D=1$. The non-trivial solutions of $$ y''+\lambda y = 0, \\ y'(0)=0,\; y'(\pi)=0, $$ are $\cos(nx)$, corresponding to $\lambda_n=n^2$ for $n=0,1,2,3,\cdots$. These form an orthogonal basis of $L^2[0,\pi]$.
Half-Angle Sine Example: Let $A=0,B=1, C=1,D=0$. The non-trivial solutions of $$ y''+\lambda y = 0, \\ y(0)=0,\; y'(\pi) =0, $$ are $\sin((n+1/2)x)$, corresponding to $\lambda_n = (n+1/2)^2$ for $n=0,1,2,3,\cdots$. These functions must also form an orthogonal basis of $L^2[0,\pi]$.
General Examples There are general cases where the $\sqrt{\lambda_n}$ terms are not evenly spaced, and are solutions of a transcendental equation. The corresponding solutions must still form a complete orthogonal basis of $L^2[0,\pi]$. These cases cannot be handled directly from the ordinary Fourier basis.