Are $\sin(n\pi x /L)$ a basis of $L^2[0,L]$? I'm studying a book "Applied linear algebra" by Sadun. The book deals linear algebra and functional analysis somewhat informally. Here is a quote from the book. I have some questions about the italicized sentences (italicizing is mine, not of the author).

What we have done is exhibit three orthogonal bases for the same space ($L^2[0,L]$). One orthogonal basis is the set of functions $\sin(n \pi x/L)$. A second orthogonal basis is the set of functions $\sin(2n\pi x/L)$ together with the functions $\cos(2n\pi x/L)$. Closely related to the second basis is the third basis $\{\exp(2n\pi xi /L)\}$ with $n$ now ranging from $-\infty$ to $\infty$. These bases are in turn obtained as the eigenfunctions of the three different operators on $L^2[0,L]$. The first operator is $d^2/dx^2$ with Dirichlet boundary conditions, whose eigenvalues are $-n^2\pi^2/L^2$, and whose eigenfunctions are the functions $\sin(n\pi x/L)$ $\cdots$

i) Are $\sin(n\pi x/L)$ really a basis for $L^2[0,L]$? How can a function whose value is nonzero at the boundaries be represented as a linear combination of them? ii) I'm not comfortable with defining an operator with boundary conditions. Are such definitions of an operator with boundary conditions conventional or usual? I think it is more appropriate to define a subspace by the boundary condition and define an operator on the subspace. Then $\sin(n\pi x/L)$ can be a basis for the subspace in which functions vanish at the boundaries.
I'm not much familiar with rigorous functional analysis nor linear algebra, but the sentences in the book are somewhat wiered for me.
 A: The "linear combination" is actually an infinite series, which converges in the $L^2$ norm but not necessarily pointwise.  Thus for example the constant function $1$ is represented by the series
$$ \sum_{n=1}^\infty c_n \sin(n \pi x/L)$$
where $c_n = 4/(n \pi)$ if $n$ is odd, $0$ if $n$ is even.  
Here is a plot of $1$ and the partial sum $\sum_{n=1}^{25} c_n \sin(n \pi x/L)$ in the case $L=1$:

The approximation $a_{25}(x)$ is not close to the function $1$ near the endpoints $0$ and $1$, but it is close over most of the interval, so that the $L^2$ norm
$$ \|1 - a_{25}\| = \left( \int_0^1 (1 - a_{25}(x))^2\; dx \right)^{1/2}$$
is small.  In the limit as $N \to \infty$, $\|1 - a_{N}\|$ goes to $0$.
A: Those are good questions! 
(I) Even though the boundary values of each finite combination of the Basis functions are zero, this does not need to hold for the $ L^2$  limit.
(II) The operator that sends a right hand side $ f\in L^2$ to the solution of 
$$
\Delta u=f\\
u=0 \text{ on the boundary}
$$
is a compact operator from $ L^2$ to $ L^2$. When the domain is a one dimensional interval, it's eigenfunctions are the first basis in your post.
A: You can choose endpoint conditions for $\frac{d^2}{dx^2}$ of the following type
$$
        \cos\alpha f(0)+\sin\alpha f'(0) = 0,\\
        \cos\beta f(L)+\sin\beta f'(L) = 0, \\
          \alpha,\beta \in \mathbb{R},
$$
and you still end up with an orthonormal basis of eigenfunctions for $L^2[0,L]$. Most of these will not have evenly-spaced trig argument multipliers. This can be very different from the simple case where $f(0)=f(L)=0$. And the story gets increasingly strange. The function $f(x)=e^{-x}$ satisfies
$$
                  \frac{d^2}{dx^2}f(x)=f(x), \\
                    f(0)+f'(0)=0, \\
                    f(L)+f'(L)=0.
$$
That means that some of the selfadjoint problems require that you to toss in an exponential function amongst the trig functions in order to achieve completeness. Usually only one, but I think I recall that there can be two; I'm not sure on that.
