Original matrix:
[ 1 2 -1 0 2 ]
[ 1 2 0 2 5 ]
[ 2 4 -1 2 7 ]
Note we start with four unknowns and only three equations, so we are going to need at least one parameter to describe the solution set; and of course describing the solution set using parameters means there are an infinite number of solutions.
We have a 1 in row 1 column 1, so leave row 1 alone and use the 1 in row 1 column 1 to get 0's in column 1 in rows 2 and 3:
Replace row 2 with row 2 minus row 1; replace row 3 with row 3 minus 2 times row 1.
[ 1 2 -1 0 2 ]
[ 0 0 1 2 3 ]
[ 0 0 1 2 3 ]
We are stuck with the 2 in row 1 column 2; there is no way to get rid of it.
We have a 1 as the first nonzero entry in row 2, so keep row 2 and use the 1 in row 2 column 3 to get 0's in column 3 rows 1 and 3:
Replace row 1 with row 1 plus row 2; replace row 3 with row 3 minus row 2.
[ 1 2 0 2 5 ]
[ 0 0 1 2 3 ]
[ 0 0 0 0 0 ]
The last row gives us no useful information, so the system only has two independent equations. That means we will need to describe the solution set using two parameters.
The two non-zero rows of the matrix tell us
x+2y+2w = 5
z+2w = 3
Let t=w be one parameter. Then use the second equation to get z+2w=3, z = 3-2w, and z=3-2t.
w=t; z=3-2t
Substitute those in the first equation:
x+2y+2t = 5
x+2y = 5-2t
We need another parameter. Let u=y be the second parameter. Then
x = 5-2t-2y = 5-2t-2u.
y=u; x=5-2t-2u
The solution set is
x=5-2t-2u
y=u
z=3-2t
w=t
Check that the three original equations are satisfied....
x + 2y - z = (5-2t-2u) + 2u - (3-2t) = 5-2t-2u+2u-3+2t = 2 yes
x + 2y + 2w = (5-2t-2u) + 2u + 2t = 5 yes
2x + 4y - z + 2w = (10-4t-4u) + 4u - (3-2t) + 2t = 10-4t-4u+4u-3+2t+2t = 7 yes