The rank is the number of nonzero rows of a (reduced) row echelon form matrix of the given matrix.

We apply elementary row operations as follows.
\begin{align*}
&\begin{bmatrix}
a & 1 & 2 \\
1 &1 &1 \\
-1 & 1 & 1-a
\end{bmatrix}
\xrightarrow{R_1 \leftrightarrow R_2}
\begin{bmatrix}
1 &1 &1 \\
a & 1 & 2 \\
-1 & 1 & 1-a
\end{bmatrix}
\xrightarrow[R_3+R_1]{R_2-aR_1}
\begin{bmatrix}
1 &1 &1 \\
0 & 1-a & 2-a \\
0 & 2 & 2-a
\end{bmatrix}\\[8pt]
&\xrightarrow{R_2\leftrightarrow R_3}
\begin{bmatrix}
1 &1 &1 \\
0 & 2 & 2-a\\
0 & 1-a & 2-a
\end{bmatrix}
\xrightarrow{R_3-\frac{1-a}{2}R_2}
\begin{bmatrix}
1 &1 &1 \\
0 & 2 & 2-a\\
0 & 0 & (2-a) (a+1)/2
\end{bmatrix}.
\end{align*}

The last matrix is in row echelon form.
Therefore, if $a \neq -1, 2$, then $(3, 3)$-entry of the last matrix is not zero. From this we see that the rank is $3$ when $a \neq -1, 2$.

On the other hand, when $a=-1$ or $a=2$ the third row is a zero row, hence the rank is $2$.

Find a Matrix that Maps Given Vectors to Given Vectors
Suppose that a real matrix $A$ maps each of the following vectors
\[\mathbf{x}_1=\begin{bmatrix}
1 \\
1 \\
1
\end{bmatrix}, \mathbf{x}_2=\begin{bmatrix}
0 \\
1 \\
1
\end{bmatrix}, \mathbf{x}_3=\begin{bmatrix}
0 \\
0 \\
1
\end{bmatrix} \]
into the […]

Determine When the Given Matrix Invertible
For which choice(s) of the constant $k$ is the following matrix invertible?
\[A=\begin{bmatrix}
1 & 1 & 1 \\
1 &2 &k \\
1 & 4 & k^2
\end{bmatrix}.\]
(Johns Hopkins University, Linear Algebra Exam)
Hint.
An $n\times n$ matrix is […]

Subspace Spanned By Cosine and Sine Functions
Let $\calF[0, 2\pi]$ be the vector space of all real valued functions defined on the interval $[0, 2\pi]$.
Define the map $f:\R^2 \to \calF[0, 2\pi]$ by
\[\left(\, f\left(\, \begin{bmatrix}
\alpha \\
\beta
\end{bmatrix} \,\right) \,\right)(x):=\alpha \cos x + \beta […]

If Two Matrices Have the Same Rank, Are They Row-Equivalent?
If $A, B$ have the same rank, can we conclude that they are row-equivalent?
If so, then prove it. If not, then provide a counterexample.
Solution.
Having the same rank does not mean they are row-equivalent.
For a simple counterexample, consider $A = […]

Given a Spanning Set of the Null Space of a Matrix, Find the Rank
Let $A$ be a real $7\times 3$ matrix such that its null space is spanned by the vectors
\[\begin{bmatrix}
1 \\
2 \\
0
\end{bmatrix}, \begin{bmatrix}
2 \\
1 \\
0
\end{bmatrix}, \text{ and } \begin{bmatrix}
1 \\
-1 \\
0
[…]

Find a Row-Equivalent Matrix which is in Reduced Row Echelon Form and Determine the Rank
For each of the following matrices, find a row-equivalent matrix which is in reduced row echelon form. Then determine the rank of each matrix.
(a) $A = \begin{bmatrix} 1 & 3 \\ -2 & 2 \end{bmatrix}$.
(b) $B = \begin{bmatrix} 2 & 6 & -2 \\ 3 & -2 & 8 \end{bmatrix}$.
(c) $C […]

Quiz 7. Find a Basis of the Range, Rank, and Nullity of a Matrix
(a) Let $A=\begin{bmatrix}
1 & 3 & 0 & 0 \\
1 &3 & 1 & 2 \\
1 & 3 & 1 & 2
\end{bmatrix}$.
Find a basis for the range $\calR(A)$ of $A$ that consists of columns of $A$.
(b) Find the rank and nullity of the matrix $A$ in part (a).
Solution.
(a) […]

Find the Inverse Matrices if Matrices are Invertible by Elementary Row Operations
For each of the following $3\times 3$ matrices $A$, determine whether $A$ is invertible and find the inverse $A^{-1}$ if exists by computing the augmented matrix $[A|I]$, where $I$ is the $3\times 3$ identity matrix.
(a) $A=\begin{bmatrix}
1 & 3 & -2 \\
2 &3 &0 \\
[…]