Algebraic Equations and Programs

We will consider a particular case where sets of algebraic equations may be solved very simply. However, we will first discuss briefly the case of single algebraic equations.

Single Algebraic Equations

Consider the single equation:
x -3 = 0

We solve this equation by rearranging it to the form:
x = 3

This is also an equation, because it contains an `=' sign, but it is addtionally a formula because it is written so as to enable an unknown quantity, here x to be calculated explicitly. The original form of the equation did not have this property.

Not all single equations in single unknowns may be easily rearranged to provide formulas. For example:
x² - 3x - 4 = 0
can be rewritten as formula, but not particularly easily, although the form is a standard one. It also yields more than one possible value for x which can sometimes complicate matters.

x³ - x² - 3x - 4 = 0
can be rewritten only as a complicated formula, and so is seldon solved in this way.

x - log x = 0
This cannot be rewritten as a formula and so must be solved by a trial and error method.

In general, we can rewrite an algebraic equation as a formula only when one of the following is true:

Programming languages, including spreadsheet programs, are able to evaluate formulas, and so can solve single algebraic equations which can be suitably rearranged. In this introduction to modelling we will not consider problems where equations cannot be rearranged in this way.

Sets of Equations Suitable for `Direct' Solution

Consider the pair of equations:
x - 3 = 0
y - 4 x + 1 = 0

This is a set of two equations in two unknowns ( x and y) and can therefore, in principle, be solved for both its unknowns.

For any set of equations to be solvable, there must be exactly as many unknowns as equations.

It is also fairly obvious how these equations can be solved. The first can be rearranged to give a formula for x:
x = 3

The second can be rearranged to give a formula for y, so that when x is known, y can also be calculated:
y = 4 x - 1

The multiequation/multvariable equivalent of the condition for solving a single equation by rearrangement to a formula, which we will describe as direct solution is in fact two conditions. The first of these should be obvious from the above example.

For direct solution, it must be possible to rearrange the equations so that a formula can be written for every unknown.

The second condition is less obvious but may be illustrated by a case where it is not satisfied. consider the two equations:
y - 4 x + 1 = 0
- = 0

Since neither equation contains either x or y on its own, it is not possible to to solve immediately for either of the unknowns. To be able to do this it would be necessary for one equation to contain only one of the unknowns, it would not matter which, and the other could contain both. In general, a set of n equations to be solved this way must be triangular , i.e. one must contain no more than one unknown, another no more than two, another no more than 3 and so forth.

The occurence of these must also be in the correct pattern so that it is possible for the equations to be both rearranged and reordered so that they can be written, for example for a set of n equations in unknowns x1 to xn:

x1 = constant expression
x2 = f(x1, constants)
x3 = f(x1, x2, constants)
x4 = f(x1, x1, x2, x3, constants)
.
.
.
xn = f(x1 ... xn, constants)

There are a number of computer algorithms for testing and reordering sets of equations for solution in this way. Most modern spredsheet systems will employ them automatically. There are also algorithms which will carry out the rearrangement, but these are not widely available. When using a simple program or spreadsheet the user will thus need to carry out the rearrangement, which normally will involve checking that a suitable order for diect solution does in fact exist.

General Methods for Sets of Algebraic Equations

Many, indeed probably most, serious modelling problems give rise to sets of equations cannot be solved by the above methods and so iterative, trial-and-error solution is required, usually for several, sometimes for all of the unknowns. Discussion of these methods is beyond the scope of this introductory course, but modern computers in fact have little difficulty in handling very large sets of algebraic equations.

As two special cases, we have provided a simple iterative solver fo single algebraic equations and a standard solver for sets of linear equations.