This set of equations is often referred to as a system of equations.
Wikipedia page: click here
3 x_{1} + 7 x_{2} = 78 8 x_{1} + 5 x_{2} = 45 
Example 2: 3 simultaneous equations (with 3 unknowns x_{1}, x_{2} and x_{3} )
5 x_{1} + 6 x_{2}  3 x_{3} = 23 3 x_{1}  4 x_{2} + 8 x_{3} = 25 6 x_{1} + x_{2}  2 x_{3} = 19 

Example:
+ +  5 6 3  A =  3 4 8   6 1 2  + + 
+ +  a_{11} a_{12} a_{13}  A =  a_{21} a_{22} a_{23}   a_{31} a_{32} a_{33}  + + 

Example: column vector
+ +  2  x =  5   1  + + 
+ +  x_{1}  x =  x_{2}   x_{3}  + + 
+ + + +  a_{11} a_{12} a_{13}   x_{1}  A×x =  a_{21} a_{22} a_{23}  ×  x_{2}   a_{31} a_{32} a_{33}   x_{3}  + + + + + + def  a_{11}x_{1} + a_{12}x_{2} + a_{13}x_{3}  =  a_{21}x_{1} + a_{22}x_{2} + a_{23}x_{3}   a_{31}x_{1} + a_{32}x_{2} + a_{33}x_{3}  + + 
The product A×x is a vector !
Example:
5 x_{1} + 6 x_{2}  3 x_{3} = 23 3 x_{1}  4 x_{2} + 8 x_{3} = 25 6 x_{1} + x_{2}  2 x_{3} = 19 
Wikipedia page: click here

2 x_{1} + 4 x_{2} = 16 3 x_{1} + 2 x_{2} = 12 
The solution is:
x_{1} = 2 x_{1} = 3 Because: 2 × 2 + 4 × 3 = 4 + 12 = 16 3 × 2 + 2 × 3 = 6 + 6 = 12 

2 x_{1} + 4 x_{2} = 16 3 x_{1} + 2 x_{2} = 12 




It's called "trivial" because solving this system requires no effort at all...
The solution is:
x_{1} = value_{1} x_{2} = value_{2} 
2 x_{1} + 4 x_{2} = 16 3 x_{1} + 2 x_{2} = 12 

Step 1B: make all other coefficients in the first column equal to ZERO (by adding a multiple of the first row to the other rows)


Step 2B: make all other coefficients in the second column equal to ZERO (by adding a multiple of the second row to the other rows)

Resulting trivial system of simultaneous equations:
x_{1} = 2 x_{2} = 3 
Which also give the solution...


Simultaneous equations: 2 x_{1} + 4 x_{2} = 16 3 x_{1} + 2 x_{2} = 12 
In matrix/vector form: + + + + + +  2 4   x_{1}  =  16   3 2   x_{2}   12  + + + + + + 
The element 2 in the matrix is coefficient a_{11}
Simultaneous equations: x_{1} + 2 x_{2} = 8 4 x_{2} = 12 
In matrix/vector form: + + + + + +  1 2   x_{1}  =  8   0 4   x_{2}   12  + + + + + + 
The element −4 in the matrix is coefficient a_{22}


2 x_{1} + 4 x_{2} + 6 x_{3} = 14 x_{1} + 4 x_{2} + 3 x_{3} = 3 3 x_{1} + 5 x_{2} + 2 x_{3} = 2 
We do not need to write out the variable x_{1}, x_{2} and x_{3}
We can represent these simulatneous equation by the following shorter form:
+ +  2 4 6  14   1 4 3  3   3 5 2  2  + + 
Note:


x_{1} = 2 x_{2} = 2 x_{3} = 3 
double[][] A; // The Coefficient "matrix" double[] b; // The right hand side "vector" int n; // number of unknowns (and size of A and b) 
Simultaneous equations: 2 x_{1} + 4 x_{2} + 6 x_{3} = 14 x_{1} + 4 x_{2} + 3 x_{3} = 3 3 x_{1} + 5 x_{2} + 2 x_{3} = 2 
Representation: n = 3; double[][] A = new double[n][n]; double[] b = new double[n]; A[0][0] = 2; A[0][1] = 4; A[0][2] = 6; b[0] = 14; A[1][0] = 1; A[1][1] = 4; A[1][2] = 3; b[0] = 3; A[2][0] = 3; A[2][1] = 5; A[2][2] = 2; b[0] = 2; 

Read in n, A and b; for ( each row i from 0 to n1 ) do { (Step i A): Select pivot pivot = A[i][i]; (Step i B): Normalize row i for ( each element in row i ) divide element by the pivot; (Step i C): Sweep column i; for row k from 0 to n1, except row i do { factor = A[k][i]; Subtract "factor" × (row i) from (row k) } } 


import java.util.Scanner; public class Gauss1 { public static void main(String[] args) { Scanner in = new Scanner(System.in); double[][] A; // The coefficients double[] b; // The RHS double pivot, factor; int n; // Number of variables int i, j, k; System.out.print("Number of unknows: "); n = in.nextInt(); // Read in problem size A = new double[n][n]; // Reserve space for coefficient matrix b = new double[n]; // Reserve space for RHS vector /*  Read in the rows, one row at a time  */ for (i = 0; i < n; i++) { // Read in row i's coefficients for (j = 0; j < n; j++) { System.out.print("A["+i+"]["+j+"] = "); A[i][j] = in.nextDouble(); } // Read in row i's RHS System.out.print("b["+i+"] = "); b[i] = in.nextDouble(); } /*  The Gaussian elimination method  */ for (i = 0; i < n; i++) { // Process row i /*  (A) Select pivot  */ pivot = A[i][i]; /*  (B) Normalize row i  */ for (j = 0; j < n; j++) A[i][j] = A[i][j]/pivot; b[i] = b[i]/pivot; /*  (C) Sweep using row i  */ for (k = 0; k < n; k++) { if ( k != i ) { factor = A[k][i]; for (j = 0; j < n; j++) A[k][j] = A[k][j]  factor*A[i][j]; b[k] = b[k]  factor*b[i]; } } } System.out.println("======================"); System.out.println("Solution:"); for (i = 0; i < n; i++) System.out.println("x" + (i+1) + " = " + b[i]); } } 
How to run the program:



public class MathTools { public static double[] GaussianElim(double[][] A, double[] b) { double pivot, factor; int i, j, k; int n = b.length; // # unknowns /*  Gaussian elimination method  */ for (i = 0; i < n; i++) { // Process row i /*  (A) Select pivot  */ pivot = A[i][i]; /*  (B) Normalize row i  */ for (j = 0; j < n; j++) A[i][j] = A[i][j]/pivot; b[i] = b[i]/pivot; /*  (C) Sweep using row i  */ for (k = 0; k < n; k++) { if ( k != i ) { factor = A[k][i]; for (j = 0; j < n; j++) A[k][j] = A[k][j]  factor*A[i][j]; b[k] = b[k]  factor*b[i]; } } } return(b); // The answer is in double[] b } } 
public class Gauss2 { public static void main(String[] args) { Scanner in = new Scanner(System.in); double[][] A; double[] b, x; double pivot, factor; int n; // Number of variables int i, j, k; System.out.print("Number of unknows: "); n = in.nextInt(); // Read in problem size A = new double[n][n]; // Reserve space for coefficient matrix b = new double[n]; // Reserve space for RHS vector // Read in the rows, one row at a time for (i = 0; i < n; i++) { // Read in row i's coefficients for (j = 0; j < n; j++) { System.out.print("A["+i+"]["+j+"] = "); A[i][j] = in.nextDouble(); } // Read in row i's RHS System.out.print("b["+i+"] = "); b[i] = in.nextDouble(); } x = MathTools.GaussianElim(A, b); System.out.println("Solution:"); for (i = 0; i < n; i++) System.out.println("x[" + (i+1) + "] = " + x[i]); } } 
How to run the program:

Here's a sysem of 7 equations input file: click here
How to use the input:


