with(linalg): A := matrix(5,5); num := rand(-5..5); # random numbers between -5 and 5 for i in {2,4,5} do for j from 1 to 5 do A[i,j] := num(); # random entry od: od: # col 1 is lin dep for j from 1 to 5 do A[1,j] := 2*A[2,j]-3*A[4,j]+A[5,j]; od: # col 3 is lin dep for j from 1 to 5 do A[3,j] := A[2,j]+2*A[4,j]-2*A[5,j]; od: print(A); # a single solution x := matrix(5,1,[1,2,3,-2,1]); # right hand vector b := evalm(A &* x); linsolve(A,b);