In what infinite-dimensional vector spaces do Pythagoras's identity apply? This question stemmed from when I was trying to understand Parseval's identity and understanding how we could exchange the sum and integral in the proof.
In general, I understand that two of the properties of an inner product space are
$$\left\langle a_1\vec{x_1}+a_2\vec{x_2},\,\vec{y}\right\rangle=a_1\left\langle\vec{x_1}, \vec{y}\right\rangle+a_2\left\langle\vec{x_2},\vec{y}\right\rangle$$
and
$$\left\langle\vec{x},\,b_1\vec{y_1}+b_2\vec{y_2}\right\rangle=\overline{b_1}\left\langle\vec{x}, \vec{y_1}\right\rangle+\overline{b_2}\left\langle\vec{x},\vec{y_2}\right\rangle$$
So for an $n$-dimensional vector space, we have orthonormal unit vectors $\hat e_1, \hat e_2, \cdots, \hat e_n$ spanning the space, allowing to represent any vector as
$$\vec{v}=\sum^n_{i=1}a_i\hat e_i$$
Which resultingly tells us that
$$\left\|\vec v\right\|^2=\left\langle\vec{v},\vec{v}\right\rangle=\left\langle\sum^n_{i=1}a_i\hat e_i,a_j\hat e_i\right\rangle=\sum^n_{i=1}\sum^n_{j=1}a_i\left\langle\hat e_i,\sum^n_{j=1}a_j\hat e_j\right\rangle=\sum^n_{i=1}\sum^n_{j=1}a_i\overline{a_j}\left\langle\hat e_i,\hat e_j\right\rangle=\sum^n_{i=1}\left|a_i\right|^2$$
Which is Pythagoras's identity.
This works because we can apply the above properties a finite amount of times.
However, what I fail to understand is why this is also true for vector spaces of infinite dimensions. While orthonormal bases exist if AC, it isn't necessarily the case that a property of a function holds when it is applied infinitely many times (c.f. Riemann's series theorem). This problem seems even worse when you look at uncountably infinite dimensional spaces. And yet (at least with functions on a real interval/on the complex plane) this identity holds via Parseval's identity/theorem.
Therefore, my question is: under what conditions can we write
$$\vec{v}=\sum_i a_i\hat e_i\Rightarrow \left\|\vec{v}\right\|^2=\sum_i|a_i|^2$$
 A: This is true in any Hilbert space (that is, any complete inner product space), as long as your axioms (typically, choice, but something weaker for the separable case) give you an orthonormal basis (that is, a maximal orthonormal set).
Given a Hilbert space with orthonormal basis $\{e_j\}$, one can work as this:

*

*show that if $\sum_j|a_j|^2<\infty$, then the series $\sum_ja_je_j$ converges.


*consider the set $$K=\{\sum_ja_je_j:\ \sum_j|a_j|^2<\infty\}.$$ It is easy to show that $K^\perp=\{0\}$. For any element in $K$ the continuity of the inner product allows one to do
$$
\langle\sum_ja_je_j,\sum_ja_je_j\rangle=\sum_{k,j}a_j\overline{a_k}\langle e_j,e_k\rangle=\sum_j|a_j|^2.
$$


*show that $K$ is closed. This usually requires to see that $K$ is isometrically isomorphic to $\ell^2(J)$, and because this latter Hilbert space is rather explicit, one can show that it is complete.


*Now $$H=\{0\}^\perp=K^{\perp\perp}=\overline K=K.$$

Edit: clarifications based on the comments.

*

*$H=\{0\}^\perp$, simply because all elements are orthogonal to $0$.


*One can define series over any index set, countable or not. The series is still defined as the limit of the partial sums, but now the partial sums are considered over the net of all finite sets, ordered by inclusion. This is often called unconditional convergence. In the case of numerical series it is equivalent to absolute convergence. But it is the right notion to consider when doing series over arbitrary index sets.


*$\ell^2(J)=\{a:J\to\mathbb C|\ \sum_J|a_j|^2<\infty\}$. One considers this as an inner product space with $\langle a,b\rangle=\sum_Ja_j\overline{b_j}$. There is a standard proof that it is complete, often appearing in measure theory texts, as this space is $L^2(J)$ with the counting measure.
