0% found this document useful (0 votes)
15 views

Lecture 9

1) Linear systems of equations occur naturally in engineering problems and computers allow engineers to solve increasingly large linear systems. This has made linear systems one of the most important tools in engineering. 2) A linear system of equations can be represented by an augmented matrix containing only numbers, which computers can solve more easily than variables. The key steps are Gaussian elimination and back substitution. 3) Gaussian elimination transforms the augmented matrix into an upper triangular matrix which allows the system to be solved efficiently using back substitution. MATLAB's \ command performs Gaussian elimination and back substitution to solve systems.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Lecture 9

1) Linear systems of equations occur naturally in engineering problems and computers allow engineers to solve increasingly large linear systems. This has made linear systems one of the most important tools in engineering. 2) A linear system of equations can be represented by an augmented matrix containing only numbers, which computers can solve more easily than variables. The key steps are Gaussian elimination and back substitution. 3) Gaussian elimination transforms the augmented matrix into an upper triangular matrix which allows the system to be solved efficiently using back substitution. MATLAB's \ command performs Gaussian elimination and back substitution to solve systems.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Lecture 9

Introduction to Linear Systems

How linear systems occur

Linear systems of equations naturally occur in many places in engineering, such as structural anal-
ysis, dynamics and electric circuits. Computers have made it possible to quickly and accurately
solve larger and larger systems of equations. Not only has this allowed engineers to handle more
and more complex problems where linear systems naturally occur, but has also prompted engineers
to use linear systems to solve problems where they do not naturally occur such as thermodynamics,
internal stress-strain analysis, fluids and chemical processes. It has become standard practice in
many areas to analyze a problem by transforming it into a linear systems of equations and then
solving those equation by computer. In this way, computers have made linear systems of equations
the most frequently used tool in modern engineering.

In Figure 9.1 we show a truss with equilateral triangles. In Statics you may use the “method of
1
joints” to write equations for each node
√ of the truss . This set of equations is an example of a linear
system. Making the approximation 3/2 ≈ .8660, the equations for this truss are:

.5 T1 + T2 = R1 = f1
.866 T1 = −R2 = −.433 f1 − .5 f2
−.5 T1 + .5 T3 + T4 = −f1
.866 T1 + .866 T3 = 0 (9.1)
−T2 − .5 T3 + .5 T5 + T6 = 0
.866 T3 + .866 T5 = f2
−T4 − .5 T5 + .5 T7 = 0,

where Ti represents the tension in the i-th member of the truss.

You could solve this system by hand with a little time and patience; systematically eliminating
variables and substituting. Obviously, it would be a lot better to put the equations on a computer
and let the computer solve it. In the next few lectures we will learn how to use a computer
effectively to solve linear systems. The first key to dealing with linear systems is to realize that they
are equivalent to matrices, which contain numbers, not variables.

As we discuss various aspects of matrices, we wish to keep in mind that the matrices that come up
in engineering systems are really large. It is not unusual in real engineering to use matrices whose
dimensions are in the thousands! It is frequently the case that a method that is fine for a 2 × 2 or
3 × 3 matrix is totally inappropriate for a 2000 × 2000 matrix. We thus want to emphasize methods
that work for large matrices.
1
See http://en.wikipedia.org/wiki/Truss or http://en.wikibooks.org/wiki/Statics for reference.

32
33

f1 - r r
4
B D

1 3 5 7

C
R1  uA 2 r 6 E u
6 ? 6
R2 f2 R3

Figure 9.1: An equilateral truss. Joints or nodes are labeled alphabetically, A, B, . . . and
Members (edges) are labeled numerically: 1, 2, . . . . The forces f1 and f2 are applied loads
and R1 , R2 and R3 are reaction forces applied by the supports.

Linear systems are equivalent to matrix equations

The system of linear equations,

x1 − 2x2 + 3x3 = 4
2x1 − 5x2 + 12x3 = 15
2x2 − 10x3 = −10,

is equivalent to the matrix equation,


    
1 −2 3 x1 4
 2 −5 12   x2  =  15  ,
0 2 −10 x3 −10

which is equivalent to the augmented matrix,


 
1 −2 3 4
 2 −5 12 15  .
0 2 −10 −10

The advantage of the augmented matrix, is that it contains only numbers, not variables. The reason
this is better is because computers are much better in dealing with numbers than variables. To solve
this system, the main steps are called Gaussian elimination and back substitution.

The augmented matrix for the equilateral truss equations (9.1) is given by:
 
.5 1 0 0 0 0 0 f1
 .866 0 0 0 0 0 0 −.433f 1 − .5 f2

 
 −.5 0 .5 1 0 0 0 −f 1

 
 .866 0 .866 0 0 0 0 0 . (9.2)
 
 0 −1 −.5 0 .5 1 0 0 
 
 0 0 .866 0 .866 0 0 f2 
0 0 0 −1 −.5 0 .5 0

Notice that a lot of the entries are 0. Matrices like this, called sparse, are common in applications
and there are methods specifically designed to efficiently handle sparse matrices.
34 LECTURE 9. INTRODUCTION TO LINEAR SYSTEMS

Triangular matrices and back substitution

Consider a linear system whose augmented matrix happens to be:


 
1 −2 3 4
 0 −1 6 7  . (9.3)
0 0 2 4

Recall that each row represents an equation and each column a variable. The last row represents
the equation 2x3 = 4. The equation is easily solved, i.e. x3 = 2. The second row represents the
equation −x2 + 6x3 = 7, but since we know x3 = 2, this simplifies to: −x2 + 12 = 7. This is easily
solved, giving x2 = 5. Finally, since we know x2 and x3 , the first row simplifies to: x1 − 10 + 6 = 4.
Thus we have x1 = 8 and so we know the whole solution vector: x = h8, 5, 2i. The process we just
did is called back substitution, which is both efficient and easily programmed. The property that
made it possible to solve the system so easily is that A in this case is upper triangular. In the next
section we show an efficient way to transform an augmented matrix into an upper triangular matrix.

Gaussian Elimination

Consider the matrix:  


1 −2 3 4
A =  2 −5 12 15  .
0 2 −10 −10
The first step of Gaussian elimination is to get rid of the 2 in the (2,1) position by subtracting 2
times the first row from the second row, i.e. (new 2nd = old 2nd - (2) 1st). We can do this because
it is essentially the same as adding equations, which is a valid algebraic operation. This leads to:
 
1 −2 3 4
 0 −1 6 7 .
0 2 −10 −10

There is already a zero in the lower left corner, so we don’t need to eliminate anything there. To
eliminate the third row, second column, we need to subtract −2 times the second row from the third
row, (new 3rd = old 3rd - (-2) 2nd):
 
1 −2 3 4
 0 −1 6 7  .
0 0 2 4

This is now just exactly the matrix in equation (9.3), which we can now solve by back substitution.

Matlab’s matrix solve command

In Matlab the standard way to solve a system Ax = b is by the command:


> x = A\b
This command carries out Gaussian elimination and back substitution. We can do the above com-
putations as follows:
> A = [1 -2 3 ; 2 -5 12 ; 0 2 -10]
> b = [4 15 -10]’
> x = A\b
35

Next, use the Matlab commands above to solve Ax = b when the augmented matrix for the system
is:  
1 2 3 4
 5 6 7 8 ,
9 10 11 12
by entering:
> x1 = A\b Check the result by entering:
> A*x1 - b
You will see that the resulting answer satisfies the equation exactly. Next try solving using the
inverse of A:
> x2 = inv(A)*b
This answer can be seen to be inaccurate by checking:
> A*x2 - b
Thus we see one of the reasons why the inverse is never used for actual computations, only for
theory.

Exercises

9.1 Set f1 = 1000N and f2 = 5000N in the equations (9.1) for the equailateral truss. Input the
coefficient matrix A and the right hand side vector b in (9.2) into Matlab. Solve the system
using the command \ to find the tension in each member of the truss. Save the matrix A
as A_equil_truss and keep it for later use. (Enter save A_equil_truss A.) Print out and
turn in A, b and solution x.
9.2 Write each system of equations as an augmented matrix, then find the solutions using Gaussian
elimination and back substitution. Check your solutions using Matlab.
(a)

x1 + x2 = 2
4x1 + 5x2 = 10

(b)

x1 + 2x2 + 3x3 = −1
4x1 + 7x2 + 14x3 = 3
x1 + 4x2 + 4x3 = 1

You might also like