TITLE: Does every inner product space has an orthogonal basis?
QUESTION [5 upvotes]: It is proved that every inner product space has a basis $W$, but I am not sure if every inner product space has an orthogonal basis? It is known that every inner space has a maximal orthogonal set $S$, so if I want to prove the conclusion, we need to show that if $w\in W$ is linearly independent to $S$, then we can construct a vector that is orthogonal to $\mbox{span}\{S\}$, which leads to contradiction, but it seems needs the condition that the space is complete.
If not, can anyone give me a counterexample?

REPLY [3 votes]: Note: Edits made November 2016 are correcting a wrong statement pointed out by Pp.. (then overlooked) and more recently by Nate Eldredge.

In the finite dimensional case, yes.  
In the infinite dimensional case, a maximal orthogonal set is not a basis in the usual sense.  You can only be sure that [added: in the complete case] the linear span of a maximal orthogonal set is dense.  [Added: In the incomplete case this need not be true.  See comments of Pp. from Feb 2015 and Nate Eldredge from Oct 2016.]
For example, in the inner product space $\ell^2$ of square summable sequences, the set of vectors with a $1$ in one component and $0$ elsewhere is a maximal orthogonal set, but it is not a basis, because for example, $(1,1/2,1/3,1/4,\ldots)$ is not in its span.    However, in a Hilbert space like $\ell^2$, every vector has a unique series expansion in terms of a maximal othogonal set. 
Here is a Wikipedia reference: http://en.wikipedia.org/wiki/Hilbert_space#Orthonormal_bases 
A maximal set of pairwise orthogonal vectors with unit norm in a Hilbert space is called an orthonormal basis, even though it is not a linear basis in the infinite dimensional case, because of these useful series representations.  Linear bases for infinite dimensional inner product spaces are seldom useful.