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?
 A: 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.
A: 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.
