system of linear equations with parameter over $\mathbb{R}$ and $\mathbb{Z_5}$ we have a system of linear equations as such:
$$ x+2y+(a-1)z=1\\-x-y+z=0\\-ax-(a+3)y-az=-3\\-ax-(a+2)y +0\cdot z=a^2 -5a-2$$
and i have to find the solution in $\mathbb{R}$ and $\mathbb{Z_{5}}$ so i have no problem for $\mathbb{R}$ i get the matrix
$$ \left(\begin{matrix}
1 & 2 & a-1 & 1 \\
0 & 1 & a & 1 \\
0 & 0 & a & 0 \\
0 & 0 & a & a^2-5\cdot a
\end{matrix}\right)$$ but the questions i have are as follows:

*

*can i use what i found for the augmented matrix and the discussion by parameter a  in $\mathbb{R}$ to deduce $\mathbb{Z_5}$?

2.or is there some other way i must reduce to row echelon form for $Z_5$ and then have the discussion for parameter a?


*If i had an 3x3 or 4x4 system to solve over a low prime $\mathbb{Z_{p_{1}}}$ and $\mathbb{Z_{p_{2}}}$ (eg 5 and 7) how would i go about doing it with the matrix gauss elimination?could i use the same augmented matrix and reduce it to row echelon over $\mathbb{R}$ and then use that augmented matrix for the rest like above or not?

4.if i recall correctly there was a theorem about the rank of the original matrix and augmented that says something about the number of solutions but i do not recall how that would help me find solutions just eliminate the a's where there is none?
 A: Your matrix $M=\left(\begin{matrix}
1 & 2 & a-1  \\
0 & 1 & a \\
0 & 0 & a \\
0 & 0 & a \cdot a
\end{matrix}\right)$ is an element of $M_{4\times 3}(\Bbb{Z}[a])$ where $\Bbb{Z}[a]$ is a ring of polynomials in the indeterminate $a$, its pseudo-inverse is an element $N$ of $M_{3\times 4}(\Bbb{Z}[a,\det(M^\top  M)^{-1}])$
where $\det(M^\top  M)^{-1}$ is a rational function in $a$.
The question is if $p=5$ has an inverse in that ring $\Bbb{Z}[a,\det(M^\top M)^{-1}]$. If not then (the natural image of) $N$ is the pseudo-inverse of $M$ both over $\Bbb{R}[a])$ and $\Bbb{F}_p[a]$.
Next you can replace $a$ by any element $c$ of the field such that $\det(M_{a=c})$ is not $0$, the pseudo-inverse of $M_{a=c}$ will be $N_{a=c}$.
A: If in producing the echelon form you only used multiplication or division by integers, provided you never divided by a multiple of $5$, the same steps would produce the echelon form over $\mathbb{Z}_5$.
Assuming this is the case, the system over $\mathbb{Z}_5$ has solution if and only if the last column is not a pivot one. We need to distinguish the cases $a\ne0$ and $a=0$. If $a\ne0$, you can go on with Gaussian elimination to
\begin{pmatrix}
1 & 2 & a-1 & 1 \\
0 & 1 & a & 1 \\
0 & 0 & 1 & 0 \\
0 & 0 & 0 & 1
\end{pmatrix}
and the last column is a pivot column.
If $a=0$, the matrix is
\begin{pmatrix}
1 & 2 & -1 & 1 \\
0 & 1 & 0 & 1 \\
0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0
\end{pmatrix}
and the system has solutions, with $z$ being a free variable (so five distinct solutions).
