Gram-Schmidt: Tying together matrices and functions
Different topics in mathematics are normally taught separately with very little discussion of how the topics are connected. Granted most of the time the connection requires a very deep understanding of the topics and possibly other unrelated topics. However, in some cases, the connection presents itself to be obvious.
Gram-Schmidt Orthogonalization
The Gram-Schmidt orthogonalization is a process that transforms a set of vectors (or functions) into a set of orthogonal (or orthonormal, depending on formulation) vectors. It is an useful procedure if you want to perform the QR decomposition of matrices, where Q is the matrix of orthonormal vectors derived from applying Gram-Schmidt to the matrix.
Consider a matrix A with columns ai. We want to generate a matrix Q with columns qi, such that the columns are orthonormal. In other words
Gram-Schmidt gives us a procedure to get from A to Q. It is as follows. Let
The choice of the first vector (with respect to which all other vectors will be orthonormal to) is arbitrary. So,
Now, to get the next orthogonal vector, we need to essentially remove any part of the vector a2 that is parallel to the vector A1. This can be done simply by