I have a problem concerning the orthogonalization of a coordinate system; this is necessary in the context of a normal mode analysis of molecular vibrations. I am working on H2O, giving me a 9-dimensional vector space, with six (orthogonal) basis vectors predetermined by describing rotational and translational motion of the entire molecule. I want to determine the three remaining vectors by a modified Gram-Schmidt process, but in my case, this somehow fails due to G-S constructing a zero vector.
As far as I understand, zero vectors from Gram-Schmidt may occur if there is linear dependency somewhere in my set of vectors, but given that my six vectors are mutually orthogonal I don't know how this might be the case (let alone how I could avoid it).
The six predetermined vectors are:
trans-x trans-y trans-z rot-xx rot-yy rot-zz
3.9994 0 0 0 0.2552 0
0 3.9994 0 -0.2552 0 0
0 0 3.9994 0 0 0
1.0039 0 0 0 -0.5084 -0.7839
0 1.0039 0 0.5084 0 0
0 0 1.0039 0.7839 0 0
1.0039 0 0 0 -0.5084 0.7839
0 1.0039 0 0.5084 0 0
0 0 1.0039 -0.7839 0 0
Can you see where the problem lies? I've been looking over this for a few days now, including trying alternative approaches at the orthogonalization problem, and I am starting to get frustrated. Given that my Gram-Schmidt algorithm produces a valid 9-dimensional orthogonal set if I use only the first three vectors (the translational coordinates), I assume my implementation to be correct and the problem to be somewhere in the rotational coordinate vectors. But I am at loss about what exactly is going wrong here. (In the end, it's probably just an example of not seeing the forest for the trees ...)
Regards
-M.
A robust approach. Let $X \in \mathbb{R}^{3N \times 6}$ be the matrix with columns as the vectors of interest. Use an orthonormal rotation $U$ ($UU^T=\mathbf{I}$) such that $$UX = \pmatrix{T \\ \mathbf{0}}$$ where $T$ is upper triangular. This is done by reducing each column from a pivot point down with Givens rotations (or planar rotations) in a triangular fashion. See below for more specific detail on doing such a rotation.
We then have $$X = U^T\pmatrix{T \\ \mathbf{0}}$$
Since $T$ is triangular, it is easy to find $P$ that is it's inverse: $$XP = U^T\pmatrix{T \\ \mathbf{0}}P = U^T\pmatrix{ \mathbf{I} \\ \mathbf{0}}$$
This $P$ then represents your orthogonalization of $X$ since we have the column mixing of it gives an orthogonal basis $U^T$. The remaining columns in $U^T$ are then your completion of the space, also orthogonal, and you are done.
Givens reduction: $$\pmatrix{c & s \\ -s & c}\pmatrix{ a \\ b}$$
If either $a$ or $b$ is non-zero, choose $$c= \frac{a}{\sqrt{a^2+b^2}} \quad \text{&}\quad s= \frac{b}{\sqrt{a^2+b^2}}$$ so that $c^2 + s^2 = 1$ and $$\pmatrix{c & s \\ -s & c}\pmatrix{ a \\ b} = \pmatrix{\sqrt{a^2+b^2} \\ 0}$$