A basis set for L^2 (0,a)
I will assume we are dealing with continuous, real-valued functions here, as in your posted theorem. A set of functions, say \left\{ f_{n}(x)\right\}_{n=1}^{\infty}, forms a basis for L2(0,a) if and only if
for g(x)\in L^2(0,a) we have \left< f_{n}(x),g(x)\right> =0 for every n=1,2,\ldots implies that g(x)=0,
where <,> denotes the inner product on L^2(0,a) defined by \left< g(x) , h(x)\right> = \int_{0}^{a}g(x)h(x) dx
In the above requirement for a set of functions to be basis, it should be understood that
\left< f_{n}(x),g(x)\right> =0 for every n=0,1,2,\ldots
means that
\left< f_{0}(x),g(x)\right> =\left< f_{1}(x),g(x)\right> =\cdots =0
or equivalently that g(x) is orthogonal to every fn(x),
the "implies that g(x)=0," part means that and the only function g(x) for which this condition may be satisfied (if the set of functions be a basis) is the zero function.
Now since we are dealing with continuous, real-valued functions, the Stone-Weierstrass theorem (in particular, Weierstrass approximation theorem) applies and any g(x)\in L^2(0,a) can be approximated by a polynomial with arbitrary precision, hence we will test our set of functions against g(x)=c_0+c_1x+c_2x^2+\cdots +c_mx^m=\sum_{k=0}^{m}c_kx^k for m=0,1,2,\ldots, where not every ck is zero. Here it goes:
\left< f_{n}(x) , g(x)\right> = \int_{0}^{a}\left( \sum_{k=0}^{m}c_kx^k \right) \sin\left( \frac{\pi nx}{a} \right) dx = \sum_{k=0}^{m}c_k\int_{0}^{a}x^k \sin\left( \frac{\pi nx}{a} \right) dx
then prove that if the last integral is zero for every n=1,2,..., then c_k=0 for k=0,1,2,...m and you're done. You might try using \sin (x) = \frac{e^{ix}-e^{-ix}}{2i} to evaluate the integral.