Expanding a linearly independent set to a basis I am given a set $V = \{ x_1,x_2\}$ of vectors, where $$x_1=(1,3,1,1), \qquad x_2=(3,1,2,1),$$ and I have to extend it to a basis of $\mathbb{R}^4$.
Is there any particular algorithm to do that? Do I have to just pick any two vectors from $R_4 $, check if they are linearly independent and add them, or do I have to check if $V $ spans  $\mathbb{R}^4$, and if not, take any linearly independent vector from  $\mathbb{R}^4 \setminus V$?
Which is the easiest way to find that linearly independent vector?
 A: Given an ordered, linearly independent set $S := (s_1, \ldots, s_k)$ of vectors in a finite-dimensional vector space $\Bbb V$, one can always extend $S$ to a basis of $\Bbb V$ by fixing any basis $(v_1, \ldots, v_n)$ of $\Bbb V$, forming the ordered set $(s_1, \ldots, s_k, v_1, \ldots, v_n)$. Then, for each $i \in \{1, \ldots, n\}$ (in order), remove $v_i$ from the ordered set iff $v_i$ is in the span of all the earlier elements in the set. In particular, once we have checked and kept $n - k$ of the $v_i$, we can discard the remaining $v_i$, leaving a basis $$(s_1, \ldots, s_k, v_{i_1}, \ldots, v_{i_{n - k}})$$ that extends $S$.
If $\Bbb V = \Bbb R^n$, it is computationally convenient to take the standard basis $(e_a)$ of $\Bbb R^n$. If we do that in our example, we produce the basis
$(x_1, x_2, e_1, e_2)$.
A: I assume the easiest way to expand these vectors to a basis would be to check which two basis vectors are linearly independent with the two you already have, and add them.
By definition of the dimension of such a vector space, four linearly independent vectors span a four-dimensional space, so then you're done.
A: I think the two methods you mentioned are quite good.
A systematic way to chack linear independence is to use Gram-Smidt orthogonalisation. Orthogonalise two given vectors and choose a third and forth (random) vector. If the Gram-Schmidt orthogonalisation does not stop with the null vector, then these four vectors are a basis of the $\mathbb{R}^4$. If the orthogonalisation stops with a null vector the choosen vectors have to be changed.
A: Be sure that the given vectors are linearly independent (this is your case), now take the two vectors and change one component for each of them ( not the same) to $0$. In you case we can do:
$$
(1,3,1,1) \to (1,0,1,1) \qquad (3,1,2,1) \to (0,1,2,1)
$$
The two new vectors are linearly independent from the first two. 
A: First method: Form the matrix $A$ with the given vectors as columns. Row reduce without swaps. Add the elementary vectors corresponding to the rows of zeroes (the rows without pivots). 
Second method: Add a basis of $NullSp(A^T) = (CollSp(A))^{\bot}$
