Finding rank of a matrix depending on parameters $a,b$ We have the matrix:
$$A=\begin{bmatrix}b & b & b-a\\a-b & -b & a \\ a+b & b & 0\end{bmatrix}\in\Bbb{R}^{3,3}$$
and we want to find the rank of this matrix depending on parametres a,b.
How to solve something like that? Preferably without determinants (I haven't had them in my material yet). Here's what I tried:
So we can do some elementary operations on rows of our matrix and it won't change the basis. So let's add second row to the first row, third row to second row, and second row to the third one. In other words, the transfomation will look like this (where $C_i$ is a row):
$$\begin{bmatrix}C_1 \\ C_2 \\ C_3 \end{bmatrix}\rightarrow\begin{bmatrix}C_1+C_2 \\ C_2+C_3 \\ C_3+C_2 \end{bmatrix}$$
We get something like this:
$$\begin{bmatrix}a & 0 & b\\2a & 0 & a \\ 2a & 0 & a\end{bmatrix}$$
So we see that $rank(A)\le2$. We now want to check linear indepence of the 1st and 3rd column depending on $a,b$. So if $a=0$ and $b=0$ we have $rank(A)=0$. Let's check other cases. If the 1st and 2nd column are linearly dependent, we have $rank(A)=1$ and if they're independent we have $rank(A)=2$. So  let's check for which $a,b$ 1st and 3rd column are linearly independent. We want the following system of equations to be solvable only by $\alpha =\beta =0$:
$\alpha a+\beta b=0$
$\alpha 2a+\beta a=0$
From the 2nd equation we have $\alpha a=\frac{-\beta a}{2}$ and plugging that in into 1st equation we get $\beta(b-\frac{a}{2})=0$ so for $b\neq\frac{a}{2}$ we are forced to conclude that $\beta=0$ and plugging that in into 2nd equation again we get $\alpha a=0$ so for $a\neq 0$ and $b\neq\frac{a}{2}$ we get $\alpha = \beta = 0$ so when parametres meet these conditions $rank(A)=2$ otherwise it's $1$.
Is it correct? Could it be done better, faster? I'll be grateful for any tips.
 A: By performing some row operations, you get 
$$\begin{pmatrix} b&b&b-a\\
a&0&b\\0&0&a-2b\\
\end{pmatrix}$$
Now let us assume that $a-2b \neq 0$. Then we can get 
$$\begin{pmatrix} b&b&0\\
a&0&0\\0&0&a-2b\\
\end{pmatrix}$$
Now further assume $a\neq 0$. Then we have 
$$\begin{pmatrix} 0&b&0\\
a&0&0\\0&0&a-2b\\
\end{pmatrix}$$
thus assuming that $b\neq 0$, we see that the rank is $3$.
Now study the cases $a=2b$, $a=0$, $b=0$. 
I only treat the first: if $a=2b$ the matrix above  is 
$$\begin{pmatrix} b&b&-b\\
2b&0&b\\0&0&0\\
\end{pmatrix}$$
with some operations,
$$\begin{pmatrix} 3b&b&0\\
2b&0&b\\0&0&0\\
\end{pmatrix}$$ has rank $2$ unless $b=0$. The other cases are similar. Thus the rank is $3$ except when one of $a=2b$, $a-0$ or $b=0$ happen then the rank is $2$. If all are zero the rank is zero.
A: Instead of the original matrix
$$A=
\begin{pmatrix}
  b & b &b-a\\
 a-b&-b & a \\
 a+b& b & 0
\end{pmatrix}
$$
we can work with the transpose
$$A^T=
\begin{pmatrix}
  b &a-b&a+b\\
  b &-b & b \\
 b-a& a & 0 \\
\end{pmatrix}
$$
since $A$ and $A^T$ have the same rank. See: Is the rank of a matrix the same of its transpose? If yes, how can I prove it?
Using row operations we get
$$A^T=
\begin{pmatrix}
  b &a-b&a+b\\
  b &-b & b \\
 b-a& a & 0 
\end{pmatrix}\sim
\begin{pmatrix}
  0 & a & a \\
  b &-b & b \\
 b-a& a & 0
\end{pmatrix}\overset{(*)}\sim
\begin{pmatrix}
  0 & 1 & 1 \\
  1 &-1 & 1 \\
 b-a& a & 0
\end{pmatrix}\sim
\begin{pmatrix}
  0 & 1 & 1 \\
  1 &-1 & 1 \\
  0 & b &a-b
\end{pmatrix}\sim
\begin{pmatrix}
  0 & 1 & 1 \\
  1 &-1 & 1 \\
  0 & b &a-b
\end{pmatrix}\sim
\begin{pmatrix}
  0 & 1 & 1 \\
  1 &-1 & 1 \\
  0 & 0 &a-2b
\end{pmatrix}
$$
Notice that the step marked $(*)$ is only valid if $a\ne0$, $b\ne0$.
We get that if $a\ne2b$ and $a,b\ne0$ (in the other words, if $a-2b,a,b\ne0$) then the rank is $3$. I will leave the remaining cases to you.
