Linear algebra problem - linear independence/basis 
Determine the values of $k$ and $\lambda$ such that the following set of elements in $\mathbb{R}^3$ contains a basis of $\mathbb{R}^3$: $$\{(1,0,\lambda), (0,1,\lambda), (1,0,k), (0,1,k) \}$$ 

A solution to this problem and whether my approach is correct/wrong would be very helpful, thank you! 
My approach: 
Any three linearly independent vectors in $\mathbb{R}^3$ will be a basis. So, require $\{(1,0,\lambda), (0,1,\lambda), (1,0,k)\}$ to be linearly independent. Then, $$\begin{vmatrix} 1 & 0 & \lambda \\0 & 1 & \lambda \\1 & 0 & k \end{vmatrix}=0 \Rightarrow \lambda = 1$$ 
If these form a basis, then $(0,1,k)$ must be a linear combination of these vectors, so $$\begin{pmatrix} 0 \\ 1 \\ k \end{pmatrix}=a\begin{pmatrix} 1 \\ 0 \\ 1 \end{pmatrix}+b\begin{pmatrix} 0 \\ 1 \\ 1 \end{pmatrix}+c\begin{pmatrix} 1 \\ 0 \\ k \end{pmatrix}$$ for some constants $a, b,c \in \mathbb{R}$. Second row shows $b=1$. First row gives $a=-c$. Last row gives $k=a+1-ak$. Since we have one degree of freedom, pick $a=1$, then $k=1$. 
Why I think it is wrong
My last choice of $a$ - I'm not sure if that's valid. 
 A: The idea of your approach is correct, but the result is wrong.
The determinant in the first step is $k-\lambda$ so it is null if $k=\lambda$,  and In this case the three vectors are linearly dependent.  
For any $k \ne \lambda$ the three vectors are linearly independnet, so you can chose, e.g. $\lambda=0$ and $k=1$ and you have:
$$\begin{pmatrix} 0 \\ 1 \\ k \end{pmatrix}=\begin{pmatrix} 0 \\ 1 \\ 1 \end{pmatrix}=-1\begin{pmatrix} 1 \\ 0 \\ 0 \end{pmatrix}+1\begin{pmatrix} 0 \\ 1 \\ 0 \end{pmatrix}+1\begin{pmatrix} 1 \\ 0 \\ 1 \end{pmatrix}$$
A: Make a matrix from the four column vectors and apply Gaussian elimination, exploiting the fact that elementary row operations don't change the rank of a matrix:
\begin{align}
A=\begin{bmatrix}
1 & 0 & 1 & 0 \\
0 & 1 & 0 & 1 \\
\lambda & \lambda & k & k
\end{bmatrix}
&\to
\begin{bmatrix}
1 & 0 & 1 & 0 \\
0 & 1 & 0 & 1 \\
0 & \lambda & k-\lambda & k
\end{bmatrix}
&&R_3\gets R_3-\lambda R_1
\\&\to
\begin{bmatrix}
1 & 0 & 1 & 0 \\
0 & 1 & 0 & 1 \\
0 & 0 & k-\lambda & k-\lambda
\end{bmatrix}
&&R_3\gets R_3-\lambda R_2
\end{align}
It is apparent now that the matrix has rank $3$ if and only if $k-\lambda\ne0$.

Your set of vectors contains a basis if and only if the above matrix $A$ has rank $3$, because in this case it will be a spanning set. Recall that a set of vectors contains a basis if and only if it is a spanning set. The rank of a matrix is exactly the dimension of the subspace spanned by its columns.
An advantage of Gaussian elimination is that it also allows to extract the basis, by taking the vectors in the given set corresponding to the pivot columns (in this case, for $k\ne\lambda$), the first, second and third).
A: This example is really too easy; here is an ad hoc method. When $\lambda=k$ then you've got only two distinct vectors, which can never form a basis. On the other hand if $\lambda\neq k$, then you can form $(0,0,1)$ as linear combination of the first and the third vector (or of the second and the fourth). But then you can make the third entry of the other vectors zero, and it is obvious that your set contains a basis. The presence of the fourth vector makes no difference to the answer, which is: the set contains a basis if and only if$~\lambda\neq k$.
A: Since $\{(1,0,\lambda), (0,1,\lambda), (1,0,k)\}$ is your basis, it is obvious, that $(0,1,k)$ is a lineare kombination of these vectors, since every base of $\mathbb{R}^3$ contains 3 vectors.
But your task is to compute all possible $\lambda$ and $k$. Since $\{(1,0,\lambda), (0,1,\lambda)\}$ and $\{(1,0,k), (0,1,k)\}$ are lineare independent, you have to consider $\{(1,0,\lambda), (0,1,\lambda), (1,0,k)\}$, $\{(1,0,\lambda), (0,1,\lambda), (0,1,k)\}$, $\{(1,0,k), (0,1,k), (1,0,\lambda)\}$ and $\{(1,0,k), (0,1,k), (0,1,\lambda)\}$ and compute for each case the valid $\lambda$ and $k$ such that the vectors are linear independent.
