I have found that $U=\{1/2\pmatrix{1\\1\\1\\1},1/2\pmatrix{-1\\-1\\1\\1},\frac{1}{\sqrt{2}}\pmatrix{-1\\1\\0\\0},\frac{1}{\sqrt{2}}\pmatrix{0\\0\\1\\-1}\}$ is an orthogonal basis for $\mathbb{R}^4$.
Now I want to write $(-1,1,2,2)^T$ as a linear combination of the elements of $U$.
As far as I can see, I can now write that
$\frac{\alpha_1}{2}\pmatrix{1\\1\\1\\1}+\frac{\alpha_2}{2}\pmatrix{-1\\-1\\1\\1}+\frac{\alpha_3}{\sqrt{2}}\pmatrix{-1\\1\\0\\0}+\frac{\alpha_4}{\sqrt{2}}\pmatrix{0\\0\\1\\-1}=\pmatrix{-1\\1\\2\\2}$.
But I still need to determine the alphas, so I see that I have four equations with four unknowns, which I solve with ERO's:
$\pmatrix{1 & -1 & -1 & 0 & -1\\1 & -1 & 1 & 0 & 1\\1 & 1 & 0 & 1 & 2\\1 & 1 & 0 & -1 & 2}\sim\pmatrix{1 & 0 & 0 & 0 & 0\\0 & 1 & 0 & 0 & 0\\0 & 0 & 1 & 0 & 0\\0 & 0 & 0 & 1 & 0}$.
Now I get that $\alpha_1=1,\alpha_2=1,\alpha_3=1,\alpha_4=0$. So
$(\frac{1}{2}\pmatrix{1\\1\\1\\1}+\frac{1}{2}\pmatrix{-1\\-1\\1\\1}+\frac{1}{\sqrt{2}}\pmatrix{-1\\1\\0\\0}+\frac{0}{\sqrt{2}}\pmatrix{0\\0\\1\\-1}=\pmatrix{-1\\1\\2\\2}$.
But this seems to be wrong. Where did I go wrong?
EDIT: I think I wrote out the alphas wrong. I think they are $\alpha_1=2,\alpha_2=2,\alpha_3=\sqrt{2},\alpha_4=0$. Is this correct?
It is much easiar to use the following method: if $\{e_1,,e_2,\ldots,e_n\}$ is an orthonormal basis of a vector space $V$ endowed with an inner product $\langle\cdot,\cdot\rangle$ and if $v\in V$, then if you want to write $v$ as $\alpha_1e_1+\alpha_2e_2+\cdots+\alpha_ne_n$, all you have to do is to take $\alpha_k=\langle v,e_k\rangle$, for each $k\in\{1,2,\ldots,n\}$.