# gram-schmidt orthogonal basis

• Apr 5th 2008, 03:59 PM
deragon999
gram-schmidt orthogonal basis
I have a question asking for an orthogonal basis for the subspace, S, of R^3 spanned by the two column vectors:
[-1;0;3] and [2;1;-1]

Im pretty sure the only method im am allowed to use is the gram-schmidt method

(I don't know how to write vertically sorry.)
• Apr 5th 2008, 04:54 PM
roy_zhang
Yes, the Gram-Schmidt Process will give you the orthogonal basis. Please take a look of the following link for the detail of the G-S process:

Gramâ€“Schmidt process - Wikipedia, the free encyclopedia

In you case, let $\vec{x}_1=\begin{bmatrix} -1\\0\\3\end{bmatrix}$ and $\vec{x}_2=\begin{bmatrix} 2\\1\\-1\end{bmatrix}$. Now follow the process:

1) define $\vec{v}_1=\vec{x}_1=\begin{bmatrix} -1\\0\\3\end{bmatrix}$

2) define $\vec{v}_2=\vec{x}_2-\frac{\vec{x}_2\cdot\vec{v}_1}{\vec{v}_1\cdot\vec{ v}_1}\vec{v}_1=\begin{bmatrix} 2\\1\\-1\end{bmatrix}-\frac{-5}{10}\begin{bmatrix} -1\\0\\3\end{bmatrix}=\begin{bmatrix} 3/2\\1\\1/2\end{bmatrix}$

Then $\{\vec{v}_1,\vec{v}_2\}$ is an orthogonal basis for the given subspace.

Roy
• Apr 5th 2008, 05:06 PM
deragon999
Thanks..but thats not all =0
OK u proved my method that i used correct..but in my working i put a negative in 1 of the vectors..oops..but yes your answer is correct..also how do you decide which vector to use as X1? as if you use the other 1 you get a different answer..

however..the question is longer:

do either of the vectors: p=[3;2;-3] and q=[5;4;5] belong to S...if so write the vector in terms of the orthogonal basis vectors...

this is where i really got lost..
• Apr 5th 2008, 05:41 PM
roy_zhang
Quote:

Originally Posted by deragon999
do either of the vectors: p=[3;2;-3] and q=[5;4;5] belong to S...if so write the vector in terms of the orthogonal basis vectors...

this is where i really got lost..

OK. So your S is a the subspace of R^3 spanned by the two column vectors: $\vec{x}_1=\begin{bmatrix} -1\\0\\3\end{bmatrix}$ and $
\vec{x}_2=\begin{bmatrix} 2\\1\\-1\end{bmatrix}$
.

Realize that to check whether $\vec{p}\in S$ means that can you write the vector $\vec{p}$ as a linear combination of vectors $\vec{x}_1$ and $\vec{x}_2$, which means are you able to find $c_1,c_2$ such that $c_1\begin{bmatrix}-1 \\0 \\3 \end{bmatrix}+c_2 \begin{bmatrix}2\\1 \\-1 \end{bmatrix}=\begin{bmatrix}3 \\2 \\-3 \end{bmatrix}$. In another word, you need to make sure the following system is consistent (i.e. has solution):

$\begin{bmatrix}-1 & 2\\0 & 1\\3 & -1\end{bmatrix}\begin{bmatrix} c_1\\c_2\end{bmatrix}=\begin{bmatrix}3\\2\\-3\end{bmatrix}$

By row reduction, you can find that the above system does NOT have solution $c_1,c_2$. So $\vec{p}\not\in S$.

Now you do the same thing to vector $\vec{q}$ by solving the system:

$\begin{bmatrix}-1 & 2\\0 & 1\\3 & -1\end{bmatrix}\begin{bmatrix} c_1\\c_2\end{bmatrix}=\begin{bmatrix}5\\4\\5\end{b matrix}$

This time it is consistent and the solutions are $c_1=3,\;c_2=4$. Hence $\vec{q}\in S$. And it is easy to see that $\begin{bmatrix}5\\4\\5\end{bmatrix}=\vec{v}_1+4\ve c{v}_2$

Roy
• Apr 5th 2008, 05:56 PM
roy_zhang
Quote:

Originally Posted by deragon999
also how do you decide which vector to use as X1? as if you use the other 1 you get a different answer..

The goal here is to find an orthogonal basis for the given subspace S, and the orthogonal basis is NOT unique. So yes, if you choose the other vector as $\vec{x}_1$, you will get another set of vectors which also forms an orthogonal basis to the subspace S.

Roy
• Apr 5th 2008, 08:30 PM
deragon999
one last question...
Ive understood all you are saying and i know how to do row reduction to solve systems of linear equations..but how does it work here? do i write it as a set of 3 equations to solve? ..but then what goes in the space below c2...

Sigh..nows when teachers come in handy =P
• Apr 5th 2008, 08:54 PM
roy_zhang
Here we have three equations and two unknowns, you could try to solve it by writing it as a set of 3 equations. But I prefer to solve the system by writing the system as an augmented matrix, then perform row reduction to it and see whether the system is consistent. In our example, you have

$\begin{bmatrix}-1&2&3\\0&1&2\\3&-1&-3\end{bmatrix}\sim\begin{bmatrix}-1&2&3\\0&1&2\\0&0&-4\end{bmatrix}$

consider the last row of row echelon form of the augmented matrix, it is impossible to find any $c_1,\,c_2$ such that $0\cdot c_1+0\cdot c_2=-4$, which means the system is inconsistent.

Similarly you have

$\begin{bmatrix}-1&2&5\\0&1&4\\3&-1&5\end{bmatrix}\sim\begin{bmatrix}-1&2&5\\0&1&4\\0&0&0\end{bmatrix}$

in this case the last row gives $0=0$ which is valid. Then you can further determine $c_1=3,\;c_2=4$

Roy
• Apr 5th 2008, 09:00 PM
deragon999
er..
I really don't understand what you are doing here. Any chance of the long version, should give my brain a rest...
• Apr 5th 2008, 09:09 PM
deragon999
Im an idiot
I hope you haven't been trying to write an answer..did it by myself, just the way you wrote it as the matrix.[c1;c2] before had me confused...i got it now
Thank you very much for all your help.