Determine the rank of this matrix (one variable inside) 
What's the rank of the matrix $M=\begin{pmatrix} 1 & 0 & 1\\  1 & 1 &
0\\  0 & 1 & \alpha \end{pmatrix}$ where $\alpha \in \mathbb{R}$?

I'm not sure how this is solved correctly, when it's dependent from $\alpha$.
Here is what I tried:
Multiply second line with $-1$ and add the first line to it, we get:
$\begin{pmatrix}
1 &  0 & 1\\ 
0 & -1 & 1\\ 
0 &  1 & \alpha
\end{pmatrix}$
Now take second line and add it to third line:
$\begin{pmatrix}
1 &  0 & 1\\ 
0 & -1 & 1\\ 
0 &  0 & \alpha+1
\end{pmatrix}$
$\text{rank}(M)=2$ if $\alpha=-1$, else $\text{rank}(M)=3$

I hope this is alright?
 A: For
$$M = \left( {\begin{array}{*{20}{c}}
  1&0&1 \\ 
  1&1&0 \\ 
  0&1&\alpha  
\end{array}} \right)$$
it's determinant is
$$\left| M \right| = 1 + \alpha $$.
For $\alpha  = -1$ we have two linear independent rows or columns.
For $\alpha  \ne -1$ we have three linear independent rows or
columns.
It depends on $\alpha$.
A: This is correct. The definition of rank can be

The rank of a matrix $A$ defined by $\text{rank}(A)$ is the number of lines in the matrix, after putted in echelon form, that don't have all elements zero

So for example if you use Gauss elimination as you did above and get a matrix such that one of the lines have all elements zero you would have that this line doesn't count on the rank.  Other, completely equivalent, and more theoretical, definition is that 

The rank is the dimension of the vector space generated by the matrix columns

This is the same, you could take the columns as vectors in a vector space and see if they are linearly independent, form a base and see the dimension of the space formed. 

Thinking in the definition what you did is completely correct because that you used Gauss elimination to put the matrix in echelon form and then counted the number of lines with all elements equal zero depending on what $\alpha$ is
