Let us suppose we have a, say, 10 dimensional real space with 3 orthogonal unit vectors given. How do I complete this orthonormal system with 7 additional vectors into a complete ONS in a way that is numerically stable?


An approach I could think of is to take a random vector, then perform a step in the Gram-Schmidt method to obtain a random unit vector that is orthogonal to all the previous ones. But I am concerned that choosing such a vector arbitrarily can introduce numerical errors which continue growing until I add the last vector to the system.


Is there a way I can choose the additional vectors in a way that I minimize numerical error?



Augmenting orthonormal system into complete orthonormal system in a numerically stable way
Don't use Gram-Schmidt; simply take a QR factorization of your matrix $U$. If your starting matrix was exactly orthogonal, then the top $3\times 3$ block $R\_1$ of $R$ will be orthogonal as well (hence also diagonal, since it's upper triangolar -- if it's not the case and you know the initial data was correct, then you can fix the numerical errors by changing the small off-diagonal elements to zero). Then just multiply $Q$ by $\operatorname{diag}(R\_1,I\_7)$ to get an orthogonal matrix whose first rows are $U$.


