Find an orthonormal basis for a given basis and give its orthonormal projection The given basis of the vector space $V$ is $B=\{(1,1,1,1)^T,(1,0,1,0)^T,(2,1,1,2)^T\}$. Find the orthnormal basis $W=\{w_1,w_2,w_3\}$. I apply Gramm-Schmidt as follows:
Let $w_1=v_1$. Then $w_2=(1,0,1,0)^T - \frac{(1,0,1,0)^T\cdot (1,1,1,1)^T}{(1,1,1,1)^T\cdot (1,1,1,1)^T}\cdot (1,1,1,1)^T=(1,0,1,0)^T-\frac{1}{2}\cdot (1,1,1,1)^T=(1,0,1,0)^T-(1/2,1/2,1/2,1/2)^T=(1/2,-1/2,1/2,-1/2)^T.$
$w_3= (2,1,1,2)^T-\frac{(2,1,1,2)^T\cdot (1,1,1,1)^T}{(1,1,1,1)^T\cdot (1,1,1,1)^T}\cdot(1,1,1,1)^T-\frac{(2,1,1,2)^T\cdot (1/2,-1/2,1/2,-1/2)^T}{(1/2,-1/2,1/2,-1/2)^T\cdot (1/2,-1/2,1/2,-1/2)^T}\cdot (1/2,-1/2,1/2,-1/2)^T=(2,1,1,2)^T-(3/2,3/2,3/2,3/2)^T-0=(1/2,-1/2,-1/2,1/2)^T.$
Therefore the orthonormal basis is given by $W=\{(1,1,1,1)^T,(1/2,-1/2,1/2,-1/2)^T,(1/2,-1/2,-1/2,1/2)^T\}$.

Did I do this correctly? I hope so. I also have 2 further questions:


*

*How would I find the orthogonal projection of a vector $a=(1,2,3,4)^T$ for this?

*Given some $\text{span}\{v_1,v_2,v_3,v_4\}$, how would I find the orthonormal basis then? Does the process differ from that of a given basis?


Close. You neglected to normalize the result of each iteration of the Gram-Schmidt process. It happens that two of the vectors that it generated were unit vectors, anyway, but you usually won’t be that lucky. Start with $w_1=v_1/\|v_1\|$ and normalize the output at each stage. You won’t have to divide by $w_i\cdot w_i$, either, if you do this since you’ll then be working with unit vectors.  
You already know how to compute the orthogonal projection onto the span of an orthogonal set of vectors, but you might not realize it. It’s what you did in every iteration of the Gram-Schmidt process: the vector that you subtract from $v_i$ is in fact the orthogonal projection of $v_i$ onto the span of $\{w_1,\dots,w_{i-1}\}$.  
You can of course apply the Gram-Schmidt process to any finite set of vectors to produce an orthogonal or orthonormal basis for its span. If the vectors aren’t linearly independent, you’ll end up with zero as the output of G-S at some point, but that’s OK—just discard it and continue with the next input.
