From Graham-Schmidt To SO(n)
Previously, I wanted to write about a rotation calculation technique but realised that I should first write about generating random rotation matrices, hence my post: Graham Schmidt Orthogonalisation
Actually, that post didn't quite cover generating rotation matrices since the Graham Schmidt Orthogonalisation can only generate orthonormal/orthogonal matrices but doesn't guarantee the +1 determinant. The matrix could end up having -1 determinant in which case the matrix performs mirroring on at least one of the axes. Let's settle this potential discrepancy by using one of the properties of square matrix determinants namely:
det(AB) = det(A) * det(B)
So if our candidate orthogonal matrix A has a determinant -1, all we have to do to make it a proper rotation matrix, is multiply it by an orthogonal matrix B which also has determinant -1. We could even choose B to be A itself since it would meet the requirements. Note that we need the second matrix B to also be orthogonal, so as to obtain a resultant matrix which is still in the orthogonal group.
Say our rotation matrix R = A A, where A is some orthogonal matrix generated by the Graham-Schmidt procedure. We have that
det(R) = det(A) * det(A)
Since det(A) = ±1, det(R) = +1.
This is a small change from the previous post and the results look as follows:
For details about the changes, check this out: