Java - 522 434 228 213 chars
Solves by systematically checking all possible integer n-tuples by direct multiplication until one is found that works.
Function takes augmented matrix, A, trial solution vector, x, and dimension, n, as input - outputs solution vector, x. Note that the vector x is actually one larger than the dimension to help step through possible solutions. (If I declared variables A,x,n,j,k,s as instance variables, the function would be 31 chars shorter - for a total of 182, but that feels like bending the rules too far.)
int[]Z(int[][]A,int[]x,int n){int j,k,s;for(;;){for(j=0;j<n;j++){for(k=s=0;k<n;s+=A[j][k]*x[k++]);if(s!=A[j][n])j+=n;}if(j==n)return x;for(j=0;j<=n;j++)if(x[j]!=x[n]||j==n){x[j]++;for(k=0;k<j;x[k++]=-x[n]);j=n;}}}
Program for testing (somewhat ungolfed):
import java.util.*;
class MatrixSolver{
public MatrixSolver() {
Scanner p=new Scanner(System.in); //initialize everything from stdin
int j,k,n=p.nextInt(),A[][]=new int[n][n+1],x[]=new int[n+1];
for(j=0;j<n;j++)for(k=0;k<=n;A[j][k++]=p.nextInt());
x=Z(A,x,n); //call the magic function
for(j=0;j<n;j++) System.out.print(x[j]+" "); //print the output
}
public static void main(String[]args){
new MatrixSolver();
}
int[]Z(int[][]A,int[]x,int n){
int j,k,s;
for(;;){
for(j=0;j<n;j++){ //multiply each row of matrix by trial solution and check to see if it is correct
for(k=s=0;k<n;s+=A[j][k]*x[k++]);
if(s!=A[j][n])j+=n;
}
if(j==n)return x; //if it is correct return the trial solution
for(j=0;j<=n;j++)if(x[j]!=x[n]||j==n){//calculate the next trial solution
x[j]++;
for(k=0;k<j;x[k++]=-x[n]);
j=n;
}
}
}
}
Program takes input from stdin as space separated integers as follows: first, the dimension of the problem, second, the entries of the augmented matrix by row.
Sample run:
$java -jar MatrixSolver.jar
3 2 1 -1 8 -3 -1 2 -11 -2 1 2 -3
2 3 -1
I shaved several characters by following Victor's advice about loops and "public", storing the RHS in the augmented matrix instead of separately, and adding an extra entry to my trial solution to simplify the generation of each new trial solution. The OP also said that a function is enough - no need to count the entire program.
0x=0
or0x=5
; 4) Cases where the number of equations is different than the number of variables; 5) Contradictory cases likex+5y=7, x+5y=8
; 6) Cases without linear independency, likex+3y=6, 2x+6y=12
. Am I right? \$\endgroup\$