Section 3.6: Systematic Methods for Sets of Linear Equations

A set of equations which is linear in all its unknowns has the special property, like a single linear equation, that it has what is effectively an analytical solution.

It is not usual to attempt to write out such a solution, for a system of more than two equations it becomes very cumbersome, but the systematic procedure which enables an analytical solution to be found can more conveniently be used to compute the numerical values of the unknowns.

Definitions

These properties formally exist only for a set of equations which is linear in all its unknowns. A set of equations is linear if and only if all its unknowns appear only as first powers.

In general, if any unknown appears to a power other than unity, or as the argument of a function such as log or exp, then the whole set of equations becomes nonlinear and in general cannot be solved in this way. However, we will identify some special cases where a subset of the equations, in fact a partition (section 3.5.1) of the set, is entirely linear then it will be possible to solve a set of equations with a `head' and `tail' which are nonlinear.

We will describe a set of equations with an independently solvable linear subset as partially linear. These will be dealt with in connection with a process case study (section 3.7.2).

Example

If x, y, z are unknowns, then the following comprise a set of 3 linear equations:

x - y + 2 z = 2

2 x + 2 y = 4

x + 3 y + z = 0

Each equation as written is of the form:

(coeff. of 1st variable) (1st variable) +/- (coeff. of 2nd variable) (2ndvariable) +/- ...... = constant

This is the only form possible if the equation is linear in all its variables. (Although the constant could have been written on the LHS with zero on the RHS as has been the usual practice with previous equations, it is conventional to write linear equations in this way.)

The regular arrangement of the equations and variables lends itself to a tabular representation as shown below.
x y z   Constant
Equation 1 1 -1 2   2
Equation 2 2 2 0 = 4
Equation 3 1 3 1   0

We can think of the set of equations as being represented by:

If we let a single symbol stand for each of these entities, e.g.

Then the set of equations can be written as symbols in matrix-vector notation:

A u = b

Written in full this becomes:

Or more usually with square brackets throughout (see notes on vectors (section 1.1.1) ) as:

The individual matrix coefficients may be referred to if required, ( notes on matrices (section 1.2.1.1) as:

ar,c

where r is the row number and c is the column number.

Solution of Linear Equations

The solution of sets of linear equations is a standard problem and many computer programs are available to perform it. It is extremely unlikely that you should ever have to write such a program, and so we will not spend time on describing the methods in detail.

However, a summary of the method is available in section 3.6.1 along with an algorithm in the form of a Fortran program.

To solve a set of linear equations with specified numerical coefficients and constant values we have provided access to such a program in section L1.2

One of the things that spreadsheet systems cannot conveniently do is solve sets of linear equations. However, we have developed ways of doing this. If you would like to download a linear solver for up to 12 equations which can be loaded into an Excel spreadsheet, then save this link in your local memory and load it. The file is in Microsoft Sylk ASCII format which is acceptable to a number of spreadsheets.

There are a number of more sophisticated options available for making spreadsheet based linear solvers which you can find out about in section L2.4 .

Failure of Linear Solution Procedures

Two things may go wrong in the course of attempts to solve a set of linear equations.

The set of equations may not have a solution. For example, consider the following, all of which can be written as sets of equations, and indeed have coefficients and constants entered into one of the solvers, but none of which have valid solutions. You can check this by trying them with a solver.

x = 3
2x = 4
The two equations are are inconsistent.

x1 = 3
2x1 = 6
The equations are consistent, but if intended for solution in two unknowns, i.e. x1 and x2, the second equation provides no information additional to the first, and so there is no means of solving for x2.

x1 + x2 = ..
x1 + x1 = ..
Depending on the values on the RHS the two equations are either inconsistent or one is redundant. In neither case can a solution be found.

x1 + x2 = ..
2x1 + 2x1 = ..
This is the same situation, although slightly less obvious.

In all the above situations the equations are said to be linearly dependent. This occurs whenever one LHS is a multiple of that of another equation. More generally this occurs if any LHS can be constructed from any linear combination of another, i.e. by adding together multiples of right hand sides. The solution procedure will fail for such a set of equations regardless of the values on the RHS.

The problem is not always obvious:
x1 + x2 + x3 = 1
3 x1 -2 x2 + x3 = 2
5 x1 + 3 x3 = 2
The 3rd LHS is equal to twice the first plus the second.

The above are all examples of equations sets which are said to be singular . This depends only on the structure or numerical values of the coefficient matrix, which is also said to be singular.

Another problem can occur during the solution procedure (section 3.6.1), because this involves adding and subtracting coefficients, if the coefficients are are very different sizes. Because computers work to a limited numerical precision, if a very small number is added to a very large one. This can also happen if the values of the solutions are very different, e.g. one is a small mole fraction (say 0.0001) and another is an enthalpy (say 100,000).

In these circumstances it is a good idea to scale the problem variables to get them within the same 2 or 3 orders of magnitude.

Numerical accuracy also becomes significant if the equations are nearly singular.




Return to Section 3 Index

Course Organiser
Last Modified 2/9/00