# Simon Willison’s Weblog

## Maths for Apps lecture 1

These notes are for Dr Daniel Richardson’s course “Mathematics for Applications I” at the University of Bath.The required text book is “Linear Algebra with Applications” by G. Williams, published by Jones and Bartlett

### Linear Equations

An equation such as:

x + 3y = 9

is called a linear equation.

The solution is the collection of pairs of real numbers x and y for which that equation is true. The graph of the solution is a straight line on the xy plane.

Consider a system of two equations in x and y, for example:

x + 3y = 9
-2x + y = -4

A pair (x, y) satisfying both equations is a solution of the system. Typically, there will be a single solution where the two graphs intersect.

For systems of 2 equations in 2 unknowns there are three possibilities:

1. The two lines intersect, giving one solution
2. The two lines are parallel, giving no solution
3. The two lines are identical, giving many solutions

So, for two equations with two unknowns you can not have any result that is not covered by the above scenarios.

#### 3 dimensional case

The solution of one equation, 3 unknowns:

ax + by + cz = d

a, b, c and d are constants

The solution is a plane in xyz space.

Now try a system of 3 equations in 3 unknowns:

a11x + a12y + a13z = b1
a21x + a22y + a23z = b2
a31x + a32y + a33z = b3

This typically has a single unique solution, as there are 3 intersecting planes in xyz space. This can be imagined by visualising two intersecting planes (which intersect along a line) and then visualising the third plane intersecting that line at a point. Again we can have one solution, no solutions (for parallel planes) or many solutions. The many solutions case has several possibilities, including:

• Two planes intersect to form a line, the other plane is parallel to and intersects that line
• All planes are the same

This one, many or none model works no matter how many equations or unknowns are involved.

In general, we will study systems of n linear equations in m unknowns using the following notation:

a11x1 + a12x2 + ... + a1mxm = b1
.
.
.
an1x1 + an2x2 + ... + anmxm = bn

So aij is the coefficient of xj in equation i.

We will represent such systems using matrices.

### Matrices

A matrix us a rectangular array of numbers. The numbers in the array are caled elements.

#### Example:

```      (columns)
C1  C2  C3
[2   1   5] R1  (rows)
A = [3   4   6] R2
```

A[i, j] = the element in row i, column j e.g A[2, 3] = 6 in the above example.

A submatrix is a matrix obtained by delting some rows and/or columns from a matrix.

#### Terminology:

Square Matrix
A matrix with the same number of rows and columns
Identity Matrix

Square matrix with 1s on the diagonal (top-left to bottom-right) and 0s elsewhere, i.e:

```          { 1 if i == j
I[i, j] = { 0 if i != j
```
Row matrix
One row, [a1 ... am]
Column matrix:
One column

We can use matrices to describe systems of equations:

```3x + 2y + z = 1                               [ 3   2   1 ]
x  - y  + z = 0   has matrix of coefficients  [ 1  -1   1 ]
2x + y  - z = 3                               [ 2   1  -1 ]
```

This can be extended to create the augmented matrix for the system, which adds an extra column showing the equation results:

```[ 3   2   1   1 ]
[ 1  -1   1   0 ]
[ 2   1  -1   3 ]
```

Elementary transformations are used to change a system of equations in to another simpler system with the same solution. These correspond to elementary row operations on matrices.

The elementary row operations are things you can do to the augmented matrix that will not change the solution. They are:

1. Interchange two rows (obviously has no effect)
2. Multiply a row by a non-zero constant
3. Subtract a multiple of one row from another

The third ELO will alter the goemetry of the system (as visualised in xyz space) but it will not change the solution of the system.

#### Notation

A => B means A can be changed to B by one ELO.

A =>* B means A can be changed to B by a sequence of ELOs.

A =>* B is reversible, as each of the ELOs can be easily reversed.

This is Maths for Apps lecture 1 by Simon Willison, posted on 23rd September 2002.