# How does the matrix size affect gram schmidt algorithm?

I want to know some very basics of Gram-Schmidt algorithm used to create orthonormal set of vectors. I tried to search on internet but got confused. So kindly help me.

1. Is Gram-Schmidt algorithm applied only to a set of linearly independent vectors?
2. Does that mean, linearly dependent vectors can not be made othornormal?
3. Suppose we have a matrix of linearly independent vectors of size

m*n

, where m is no. of rows and n is no. of columns,then will all the vectors be made orthonormal, if

(i). m > n

(ii). m < n

(iii). m = n

or a subset of the set of vectors?

1. Does matlab function ,qr, works for linearly dependent as well as independent set of vectors?

2.) A set of linearly dependent vectors cannot be made orthonormal, but it can be made /orthogonal/, so Gram-Schmidt is still useful and still applies to linearly dependent sets. It's just the normalization process that we can't do. If Gram-Schmidt (forgetting normalization for now) is applied to a set of linearly dependent vectors, you will get an orthogonal set that has the same span as the original. Note: orthogonal, not orthonormal, because if your set has $m$ vectors, and spans a subspace of dimension $n$, Gram-Schmidt will give you the zero vector for $v_{n+1}, ... , v_{m}$. This set is still orthogonal by definition, but I can't multiply the zero vector by a scalar to give it unit length. However, I can just throw away $v_{n+1}, ... , v_{m}$, and /then/ it can be made orthonormal, as the remaining vectors are orthogonal and nonzero, and at that point I get an orthonormal basis for the subspace spanned by my linearly dependent set.
3.) This is answered by (1) and (2). However, your question here is hard for me to interpret, because if you are viewing the vectors as columns of the matrix, you can't have $m$ linearly independent vectors when your matrix has $n$ rows when $m > n$.