Gram-Schmidt procedure gives null vector as solution.

So I am trying to find an orthonormal basis of a subspace, defined as

$U := \{x \in \mathbb{R}^4 | x_1 + 2x_2 - x_4 = 0 \} \subset \mathbb{R}^4$

I choose $w_1=\pmatrix{0\\0\\1\\0},w_2=\pmatrix{1\\0\\0\\1},w_3=\pmatrix{1\\0\\1\\1}$

The Gram-Schmidt procedure lead to the following vectors $v_1=\pmatrix{0\\0\\1\\0},v_2=\pmatrix{1\\0\\0\\1},v_3=\pmatrix{0\\0\\0\\0}$

But I suspect $v_3$ not to be a valid solution. So what did I wrong here? (Is $w_1$ not allowed?)

Additionally, how do I check vectors to be a basis of a linear subspace?

• You need to initialize Gram-Schmidt with a basis, but your $\{w_1,w_2,w_3\}$ is dependent. – vadim123 May 3 '13 at 20:37
• $w_1 = w_3 - w_2$. The starting set of vectors needs to be linearly independent. – Ayman Hourieh May 3 '13 at 20:37
• thanks to you two. So I have to choose a different starting set. But how can I check afterwards whether my solution is correct? – Angelo.Hannes May 3 '13 at 20:40
• Verify that the resulting set is orthonormal and spans the original space. Write each one of the original vectors as a linear combination of the resulting vectors. – Ayman Hourieh May 3 '13 at 20:46
• @Angelo.Hannes : You are trying to find an orthonormal basis, not "the basis". Your first sentence is incorrect because (a) there are infinitely many bases, and (b) you are trying to find an orthonormal basis, not just any basis. Eventually you say what you mean, but you should make a habit of being precise because being imprecise sometimes causes confusion. Also, I am not sure if the term "linear subspace" is correct. I honestly don't know. I've never heard it, and I don't think there is any other kind of subspace. Almost anyone would just say "subspace". – Stefan Smith May 4 '13 at 1:40

Recall the definition of a basis:

Let $V$ be a vector space. Then a set of vectors $B$ is said to be a basis of $V$ if $lin(B) = V$ and is linearly independent.

The vectors you chose do not fit the linear independence definition as $w_1=w_3-w_2$. For that reason, the subspace spanned by your vectors actually only describe a two-dimensional object in $\mathbb{R}^4$

We can see that U is a three-dimensional object in $\mathbb{R}^4$.

An example of three linearly independent vectors in $U$ is $w_1=\pmatrix{0\\0\\1\\0},w_1=\pmatrix{2\\-1\\0\\0},w_1=\pmatrix{1\\0\\0\\1}$.

We check for linear independence:

If $\alpha\pmatrix{0\\0\\1\\0}+\beta\pmatrix{2\\-1\\0\\0}+\gamma\pmatrix{1\\0\\0\\1}=\pmatrix{0\\0\\0\\0}$, then clearly $\alpha=\beta=\gamma=0$.

From there you can carry on the Gram-Schmidt procedure, and you should get your desired result.

• This check must also hold true for my resulting vectors, right? – Angelo.Hannes May 4 '13 at 7:13
• The Gram–Schmidt process takes a finite, linearly independent set of vectors (here w1, w2, w3) and generates an orthogonal set of vectors that spans the same subspace. So, if the vectors you initially chose are linearly independent, it has to be that your resulting vectors are linearly independent too. – Yuee Sun May 4 '13 at 17:44

Your original vector $w_3$ is a linear combination of the previous two; in fact, $w_3 = w_1 + w_2$. Whenever that happens, the Gram-Schmidt process will spit out the zero vector. (Because $v_3$ will be forced to be in the span of $w_1$ and $w_2$, but also orthogonal to $w_1$ and $w_2$, the only possibility for $v_3$ is $0$.)

Go back and produce a basis for your subspace, then apply the Gram-Schmidt process and you'll have an orthogonal basis as desired.