## Three Equations in Three Unknowns, a Numerical Solution Utility

This page contains a routine that numerically solves a system of three equations in three unknowns.

References:

Author: E. A. Voorhees, Los Alamos National Laboratory (LANL)

Dongarra, J. J.;   J.R. Bunch;   C.B. Moler;   and G.W. Stewart.
"LINPACK User's Guide"
1979

The utility posted on this page is based on the program "SGEFS.F", written by E. A. Voorhees (LANL).
"SGEFS.F" is part of the SLATEC library of programs, and its original code (written in FORTRAN) can be viewed there.
Before being posted on this page, "SGEFS.F" was translated to Javascript and edited. Although all care was taken to ensure that it was translated accurately, some errors may have crept into the translation. These errors are mine; the original FORTRAN routines have been thoroughly tested and work properly. Please contact the webmaster to report any errors.

The system takes the following form:

 a11 x1 + a12 x2 + a13 x3 = b1 a21 x1 + a22 x2 + a23 x3 = b2 a31 x1 + a32 x2 + a33 x3 = b3

where the a and b values are known constants. Knowing these constants, the task is then to solve for the values of x that satisfy this system.

This system can be rearranged into matrix form:

[A](x) = (b)

where [A] is a square matrix and (x) and (b) are column vectors. In the present case,

 a11 a12 a13 [A] = a21 a22 a23 a31 a32 a33

 x1 (x) = x2 x3

 b1 (b) = b2 b3

To use this utility, you should have the a and b values ready to enter. If any of the b values are zero, then this utility is not necessary; the values of x that solve the system can be found by a couple simple calculations. If you have all the data ready, simply enter it, click the Solve button, and it will calculate the values of x that solve the system.

IMPORTANT: Make sure that Error Code is greater than 0; if it is not, the solution is meaningless.
If Error Code > 0, it represents a rough estimate of the number of digits of accuracy in the solution, (x).
If Error Code < 0, there are errors:
Error Code = -1: Fatal Error. [A] is computationally singular. No solution was computed.
Error Code = -2: Warning. Solution has no significance. The solution may be inaccurate, or [A] may be poorly scaled.

In addition, rcond is output, which is an estimate of 1/cond(A).

 a11 a12 a13 b1 a21 a22 a23 b2 a31 a32 a33 b3