Determine $\forall a\in\mathbb{R},$ the number of solutions to the system of equations. So the system is
$$\left\{\begin{array}{rcr}
x-y+az & = & 1 \quad \quad(1)\\
2x-y + z & = & -1 \quad \quad (2)\\
ax+y-z & = &1 \quad \quad(3)
\end{array}\right.$$
Going matrix $\mathbf{Ax} = \mathbf{b}$,
$$\begin{bmatrix}1&-1&a\\2&-1&1\\a&1&-1&\end{bmatrix}\begin{bmatrix}x\\y\\z\end{bmatrix}=\begin{bmatrix}1\\-1\\1\end{bmatrix}.$$
Row reducing by Gauss elimination. I now assume $a\neq0,$ and 


*

*multiply $(1)$ by $2$ and compute $(2)-2(1).$

*multiply $(1)$ by $a\neq0$ and compute $(3)-a(1).$


This gives
$$\begin{bmatrix}1&-1&a\\&1&(1-2a)\\&(1+a)&-(1+a^2)&\end{bmatrix}\begin{bmatrix}1\\-3\\1-a\end{bmatrix}.$$
Finally, I take $\text{row}(3)-(1+a)\cdot\text{row}(2):$
$$\begin{bmatrix}1&-1&a\\&1&(1-2a)\\& &-(1+a^2)-(1-2a)(1+a)&\end{bmatrix}\begin{bmatrix}1\\-3\\(1-a)+3(1+a)\end{bmatrix},$$
which simplifies to
$$\begin{bmatrix}1&-1&a\\&1&(1-2a)\\& &(a+2)(a-1)&\end{bmatrix}\begin{bmatrix}1\\-3\\ 2(a+2)\end{bmatrix}.$$
This implies that $$z=\frac{(a+2)(a-1)}{2(a+2)}=\frac{2}{a-1}.$$
By this we can see that 


*

*for $a=1\Rightarrow z=0$ we have no solutions.

*for $a=-2$, there are no solutions.

*for $a\in \mathbb{R} / \{1,-2\}$, there exists only one solution.


But how do I deal with my original assumption of $a\neq0?$ What should I say about it? Clearly for $a=0$ there exists a solution, but I had to assume it was not equal to zero in order to multiply with it.
 A: From your matrix row reduction (which is correct)
$$\begin{bmatrix}1&-1&a\\0&1&(1-2a)\\0&0 &(a+2)(a-1)&\end{bmatrix}\begin{bmatrix}x\\y\\ z\end{bmatrix}=\begin{bmatrix}1\\-3\\ 2(a+2)\end{bmatrix}$$
we obtain that 


*

*for $a=1$ there are NO solutions (because from the last line $0=6$).

*for $a=-2$, there are INFINITE solutions: 
$$(x,y,z)=(-2-3z,-3-5z,z)\quad \mbox{for $z\in\mathbb{R}$.}$$

*for $a\in \mathbb{R} / \{1,-2\}$, there exists only one solution:
$$(x,y,z)=\left(0,\frac{a+1}{a-1},\frac{2}{a-1}\right).$$
There is no need to consider the assumption $a\not=0$.
A: Let me call the rows $R_1$, $R_2$ and $R_3$ for better clarity.
The row transformations you perform are


*

*$R_2-2R_1$

*$R_3-aR_1$

*$R_3-(a+1)R_2$


None of these requires special assumptions; for example, the second one, in the case $a=0$ would be “do nothing” and you need nothing special for it, do you? Also the third transformation is OK and needs no assumption.
The row transformations that require special attention are those of the form “multiply row $k$ by $\lambda$” where the coefficient $\lambda$ must be different from zero.
When I teach the subject, I introduce row transformations with symbolic names:


*

*$E_i(c)$ for “multiply row $i$ by $c$

*$E_{ij}(d)$ for “sum, to row $i$, row $j$ multiplied by $d$”

*$E_{ij}$ for “swap rows $i$ and $j$


The limitations are


*

*for $E_i(c)$ we need $c\ne0$

*for $E_{ij}(d)$ we need $i\ne j$

*for $E_{ij}$ we need $i\ne j$


This is because we want the row transformations to be reversible. You go back to the previous state by doing, respectively,


*

*$E_i(c^{-1})$

*$E_{ij}(-d)$

*$E_{ij}$


and you clearly see that $d=0$ makes no problem at all.
Note that you got mixed up at the end. For $a=-2$, the last equation becomes $0=6$ (hence no solution); for $a=1$, the last equation is $0=0$ and, due to the form of the matrix, the system has infinitely many solutions.
