Related to matrix Find the values of $a$ and $b$ for which the equations are consistent
$$\begin{cases}
X+aY+Z=3 \\
X+2Y+2Z =b \\
X+5Y+3Z=9 \\
\end{cases}$$
I tried solving it although my phone is not uploading the snap of attempt I made.  But I get to a point where I have to apply 
$R_3-(R_2+\lambda)$
Is this valid?
 A: Consider equations$$(1)\qquad x+ay+z=3\\(2)\qquad x+2y+2z=b\\(3)\qquad x+5y+3z=9$$$(2)$ and $(3)$ are obviously linearly independent. Here we have two different cases:
Case 1: $(1)$ is independent from $(2)$ and $(3)$
At this case the determinant of $\begin{pmatrix} 1 & a &1 \\ 1 & 2 &2 \\1 & 5 &3 \\\end{pmatrix}$ is nonzero and the equations are consistent with unique solution for any $b$. The determinant is $-a-1$ so for $a\ne -1$ and $b$ free Case 1 would be achieved.
Case 2: $(1)$ is dependent to $(2)$ and $(3)$.
This happens when $a=-1$ therefore we have $$(1)=2*(2)-(3)$$ and it is consistent iff $$3=2b-9$$ or $b=6$.
In other words for $a\ne -1$, $b$ is free and for $a=-1$, $b=6$
Alternative way (using elementary row transformations): 
Consider the matrix $\begin{pmatrix} 1 & a &1&3 \\ 1 & 2 &2&b \\1 & 5 &3&9 \\\end{pmatrix}$ and the following steps:$$\begin{pmatrix} 1 & a &1&3 \\ 1 & 2 &2&b \\1 & 5 &3&9 \\\end{pmatrix}$$$R_2-R_1\to R_2\\R_3-R_1\to R_3$$$\begin{pmatrix} 1 & a &1&3 \\ 0 & 2-a &1&b-3 \\0 & 5-a &2&6 \\\end{pmatrix}$$$R_1-R_2\to R_1\\R_3-2R_2\to R_3$ $$\begin{pmatrix} 1 & 2a-2 &0&6-b \\ 0 & 2-a &1&b-3 \\0 & 1+a &0&12-2b \\\end{pmatrix}$$Look at $R_3$. If $a+1\ne 0$ then there exists an answer and if $a+1=0$ there should forcibly be that $12-2b=0$ or $b=6$
