How to complete a set of independent vectors to a basis of a subspace? $\newcommand{\Span}{\operatorname{Span}}$Let $V$ be a vector such that $\dim V = n$, and let $v_1,\ldots,v_k \in V$ be independent vectors such that $1<k\leq n$. Now  Let $w_1,\ldots,w_r\in$ $\Span\left\{ v_1,\ldots,v_k \right\}$ be independent vectors such that $1\leq r <k$.
My question is this: How do I find the missing vectors $w_{r+1},\ldots,w_k\in \Span\left\{ v_1,\ldots,v_k \right\}$ so that $\Span\left\{w_1,\ldots,w_r,w_{r+1},\ldots,w_k\right\} = \Span\left\{ v_1,\ldots,v_k \right\}$ ?
Now I know they exist, I just don't know how I actually find them.
For example: Lets look at $\mathbb{R}^5$ and $$U=\Span\left\{  \begin{pmatrix} 5\\2\\3\\7\\3 \end{pmatrix},\begin{pmatrix} 2\\4\\4\\8\\1 \end{pmatrix} ,\begin{pmatrix} 3\\4\\7\\6\\1 \end{pmatrix},\begin{pmatrix} 5\\8\\6\\4\\8 \end{pmatrix} \right\}$$  
Those are all independent vectors. Now lets take $2$ independent vectors that are linear combination of those. lets say, $$w_1 = \begin{pmatrix} 6\\2\\11\\15\\-3 \end{pmatrix} \; w_2=\begin{pmatrix} 0\\4\\-2\\12\\1 \end{pmatrix}$$ How can we complete those two vectors to form a basis of $U$ ?
I would really like to understand the general idea of this. This is actually a general question of something I need it for, which is the process of finding a Jordan basis for matrices\transformations.
Thanks for any help
 A: Here's one method for the case of $V = \Bbb R^n$: row-reduce the matrix
$$
\pmatrix{w_1 & \cdots & w_r & v_1 & \cdots & v_k}
$$
The columns of this matrix that eventually become pivot columns are precisely those which are linearly independent to the preceding columns.  It suffices, then, to take these columns to form your basis.
A: Write $w_1,w_2$ as a linear combination of $\mathcal{B} = (v_1,v_2,v_3,v_4)$ and put the coefficients as the first two columns of a $4 \times 4$ matrix:
$$ A = \begin{pmatrix} [w_1]_{\mathcal{B}} & [w_2]_{\mathcal{B}} &  ? & ?  \end{pmatrix}. $$
Fill the third and fourth columns of $A$ in any way you want as long as the resulting matrix will be invertible (you can check it with the determinant or in many other ways - the most comfortable way will depend on the specific form of $A$ you get). Then define $w_3$ as a linear combination of the $v_i$ using the third column and similarly for $w_4$. This guarantess that $(w_1,w_2,w_3,w_4)$ will form a basis of $U = \operatorname{span} \mathcal{B}$ and any basis of $U$ in which the first two elements are $w_1,w_2$ is obtained in this way.
This also generalizes in the obvious way to the case $r < k \leq n$.
A: If I have correctly understood the question: you choose a vector of $v_i  \in Span\{v_1, ..., v_k\}$, check if it is linearly independent from $w_1$ and $w_2$, then solve the system $ \alpha w_1 + \beta w_2 + \gamma x = v_i $, where $x = (x_1, ..., x_n)$ is your new vector in $Span\{w_1,...,w_k\}$. Now, repeat.
