I was trying to prove the following theorem:
Theorem: Let $\phi$ be symmetric bilinear form in $V$, where $V$ a real inner product vector space with dimension $n$. Then there exists a orthonormal basis $B$ of $V$, such that the matrix associated to $\phi$ in that basis is diagonal.
This is the way I "proved" it:
Let $C$ be the canonical basis of $V$, $C'$ the canonical basis of $\mathbb{R}^n$, $A=M_C(\phi)$ the matrix associated to $\phi$ in that basis and $T$ an operator in $\mathbb{R}^n$defined as $T(v)=Av$. We have that $[T]_{C'}=A$ is a symmetric real matrix, so $T$ is selfadjoint and hence there exists some orthonormal basis $B$ of $\mathbb{R}^n$ for which the matrix associated to $T$ is a diagonal matrix $D$. So $$D=Q^{-1}AQ,$$ where $Q$ is the change of basis matrix from $B$ to $C'$. Since $C'$ is the canonical basis, the columns of $Q$ are just the vectors of $B$, so $Q$ is an orthogonal matrix and hence $D$ is not just similar but also congruent to $A$.
At this point I would like to conclude "since $A$ is congruent to $D$ then $D$ is the matrix associated to $\phi$ in an orthogonal basis". The problem is that $B$ is not a basis of $V$ but a basis of $\mathbb{R}^n$, so how can I define an orthonormal basis of $V$ in terms of $B$? I think I'm looking for some kind of isomorphism between $V$ and $\mathbb{R}^n$ preserving orthonormality (an isometry?), is there a sandard one? Also does it make sense to talk about a canonical basis in an arbitrary real inner product space with finite dimension? I'm quite confussed, maybe my "proof" doesn't even make sense.
For any reasonable definition of "canonical" (and certainly for the usual definition from category theory), "(emphatically) no". There's not even a way to pick a single non-zero element in a way that's "equivariant with respect to vector space isomorphisms".
Instead, you'll need to start with existence of some basis of your finite-dimensional real inner-product space and use this basis to construct an orthonormal basis, such as by applying the Gram-Schmidt algorithm.