<s>[INST] Solve the following system of linear equations for any values of real parameter $a$... For any values of parameter $a$ solve the following system of linear equations:
$$\begin{cases} x+y+2z=1 \\ 2x+ay-z=4 \\ 3x+y+3z=1 \end{cases} $$
Calculating the value of determinant I found out, after I equalled it with zero, that $a$ has the value $-4\over 3$. So I thought that if it's required to solve this equation for any $a$ , then first of all I had to suppose that $D=0$, this means that $a={-4\over 3}$. For this value I found out that there is an infinite number of solutions for this system. But now my question is: what do I have to do with the case when $D\neq 0$? 
Thank you!
 [/INST] Why not simply using Gaussian elimination for the remaining case? You should notice that some steps are only valid if $3a+4\ne0$.
I think that good advice when you are doing this with matrices containing some parameters is: Try to avoid dividing by expressions containing parameters (or any other things including parameters) as long as possible. That's why I have started by working with the first and the third row, since these two rows do not contain the parameter $a$.
$$\left(\begin{array}{ccc|c}
1 & 1 & 2 & 1\\
2 & a &-1 & 4\\
3 & 1 & 3 & 1
\end{array}\right)\sim
\left(\begin{array}{ccc|c}
1 & 1 & 2 & 1\\
2 & a &-1 & 4\\
0 &-2 &-3 &-2
\end{array}\right)\sim
\left(\begin{array}{ccc|c}
1 & 1 & 2 & 1\\
2 & a &-1 & 4\\
0 & 1 & \frac32 & 1
\end{array}\right)\sim
\left(\begin{array}{ccc|c}
1 & 0 & \frac12 & 0\\
2 & a &-1 & 4\\
0 & 1 & \frac32 & 1
\end{array}\right)\sim
\left(\begin{array}{ccc|c}
1 & 0 & \frac12 & 0\\
0 & a &-2 & 4\\
0 & 1 & \frac32 & 1
\end{array}\right)\sim
\left(\begin{array}{ccc|c}
1 & 0 & \frac12 & 0\\
0 & a+\frac43 & 0 & \frac{16}3\\
0 & 1 & \frac32 & 1
\end{array}\right)\sim
\left(\begin{array}{ccc|c}
1 & 0 & \frac12 & 0\\
0 & 1 & 0 & \frac{16}{3a+4}\\
0 & 1 & \frac32 & 1
\end{array}\right)\sim
\left(\begin{array}{ccc|c}
1 & 0 & \frac12 & 0\\
0 & 1 & 0 & \frac{16}{3a+4}\\
0 & 0 & \frac32 & \frac{3a-12}{3a+4}
\end{array}\right)\sim
\left(\begin{array}{ccc|c}
1 & 0 & \frac12 & 0\\
0 & 1 & 0 & \frac{16}{3a+4}\\
0 & 0 & 1 & \frac{2a-8}{3a+4}
\end{array}\right)\sim
\left(\begin{array}{ccc|c}
1 & 0 & 0 & \frac{4-a}{3a+4}\\
0 & 1 & 0 & \frac{16}{3a+4}\\
0 & 0 & 1 & \frac{2a-8}{3a+4}
\end{array}\right)
$$
</s>