I helped a buddy of mine do some MATLAB homework where you had to orthogonalize a matrix via Gram-Schmidt. I wrote a test function called isorthog that returned true or false based on whether the (orthongonalized) matrix times its transpose was equal to the identity matrix of the same size. His professor told him that this check is unnecessary. I think it is, because sometimes it would test false.
Can all $n \times n$ matrices be orthogonalized?
If so, can someone provide a hint as to how to prove it? I DO NOT want a full solution just 1 or 2 pointers to help me get started. Thanks!
You cannot orthogonalize a matrix. It's vectors that are orthogonal or not.
I conjecture that you are in the following situation:
You are given $n$ (supposedly linearly independent) vectors ${\bf a}_k \in{\mathbb R}^n$ $\ (1\leq k\leq n)$ in the form ${\bf a}_k=(a_{1k}, a_{2k}, \ldots,a_{nk})$. The data $a_{ik}$ can be organized as a matrix; but it makes no sense "to orthogonalize" this matrix. On the other hand it makes sense to apply a Gram-Schmidt-process to the vectors ${\bf a}_k$, resulting in a new $n$-tuple $({\bf e}_1,{\bf e}_2,\ldots,{\bf e}_n)$ of vectors ${\bf e}_k$ which is ${\bf by\ construction}$ orthonormal and has the additional property that the spans $\langle{\bf e}_1,\ldots,{\bf e}_k\rangle$ are equal to $\langle{\bf a}_1,\ldots,{\bf a}_k\rangle$ for $1\leq k\leq n$.
Each vector ${\bf e}_k$ has components $e_{ik}$ $\ (1\leq i\leq n)$, and the matrix $E$ of these $e_{ik}$ satisfies $E^{\rm tr}E=I$ ${\bf automatically}$, because the ${\bf e}_k$ are orthonormal.