numerical solutions of linear systems of equationsengr of linear equation… · numerical solutions...

21
EE 216 Class Notes Pages 1 of 21 Numerical Solutions of Linear Systems of Equations Linear Dependence and Independence An equation in a set of equations is linearly independent if it cannot be generated by any linear combination of the other equations. If an equation in a set of equations can be generated by a linear combination of the other equations then it is called a dependent equation. In order to have a unique solution for a set of unknowns, the number of independent equations must be at least equal to the number of unknowns. Therefore, to solve for three unknowns in a unique way, we need at least three independent equations. Let us consider the following set of equations. 2x - 4y + 5z = 36 … … (1) - 3x + 5y + 7z = 7 … … (2) 4x - 8y + 10z = 72 … … (3) It can be easily noticed that Eqn. (3) can be generated by multiplying Eqn. (1) by 2. Therefore, Eqn. (3) is a linearly dependent equation. Let us consider the following set of equations. 2x - 4y + 5z = 36 … … (1) - 3x + 5y + 7z = 7 … … (2) - x + y + 12z = 43 … … (3) In the above set, Eqn. (3) can be generated by adding Eqn. (1) to Eqn. (2). Therefore, Eqn. (3) is a dependent equation. Let us consider the following set of equations. 2x – 4y + 5z = 36 … … (1) - 6x + 8y + 43z = 136 … … (2) - 3x + 5y + 7z = 7 … … (3)

Upload: buikhuong

Post on 26-Mar-2018

217 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Numerical Solutions of Linear Systems of Equationsengr of Linear Equation… · Numerical Solutions of Linear Systems of Equations Linear Dependence and Independence An equation in

EE 216 Class Notes

Pages 1 of 21

Numerical Solutions of Linear Systems of Equations

Linear Dependence and Independence An equation in a set of equations is linearly independent if it cannot be generated by any linear combination of the other equations. If an equation in a set of equations can be generated by a linear combination of the other equations then it is called a dependent equation. In order to have a unique solution for a set of unknowns, the number of independent equations must be at least equal to the number of unknowns. Therefore, to solve for three unknowns in a unique way, we need at least three independent equations. Let us consider the following set of equations.

2x - 4y + 5z = 36 … … (1)

- 3x + 5y + 7z = 7 … … (2)

4x - 8y + 10z = 72 … … (3)

It can be easily noticed that Eqn. (3) can be generated by multiplying Eqn. (1) by 2. Therefore, Eqn. (3) is a linearly dependent equation. Let us consider the following set of equations.

2x - 4y + 5z = 36 … … (1)

- 3x + 5y + 7z = 7 … … (2)

- x + y + 12z = 43 … … (3)

In the above set, Eqn. (3) can be generated by adding Eqn. (1) to Eqn. (2). Therefore, Eqn. (3) is a dependent equation. Let us consider the following set of equations.

2x – 4y + 5z = 36 … … (1)

- 6x + 8y + 43z = 136 … … (2)

- 3x + 5y + 7z = 7 … … (3)

Page 2: Numerical Solutions of Linear Systems of Equationsengr of Linear Equation… · Numerical Solutions of Linear Systems of Equations Linear Dependence and Independence An equation in

EE 216 Class Notes

Pages 2 of 21

In the above set of equations, Eqn. (2) can be generated by adding 3 times of Eqn. (1) to 4 times of Eqn. (3).

3 X Eqn. (1): 6x – 12y + 15z = 108

4 X Eqn. (3): -12x + 20y + 28z = 28

- 6x + 8y + 43z = 136 Therefore, Eqn. (2) is a dependent equation. Dependent equations do not add any new information to the solution process. Let us consider the following set of equations.

2x - 4y + 5z = 36 … … (1)

- 3x + 5y + 7z = 7 … … (2)

5x + 3y - 8z = - 31 … … (3) All three equations in the above set are linearly independent with respect to each other. These three equations should provide a unique solution for the three unknowns: x, y and z. The solution is:

x = 2 y = -3 z = 4

Page 3: Numerical Solutions of Linear Systems of Equationsengr of Linear Equation… · Numerical Solutions of Linear Systems of Equations Linear Dependence and Independence An equation in

EE 216 Class Notes

Pages 3 of 21

GAUSS ELIMINATION The operations in the Gauss elimination are called elementary operations. Elementary operations for equations are:

(I) Interchange of two equations.

(II) Multiplication of an equation by a nonzero constant.

(III) Addition of a constant multiple of one equation to another equation.

Let us consider the set of linearly independent equations.

2x - 4y + 5z = 36 … … (1)

- 3x + 5y + 7z = 7 … … (2)

5x + 3y - 8z = - 31 … … (3) Augmented matrix for the set is:

−−−−−−−−−−−−

−−−−

31835775336542

Step 1

Eliminate x from the 2nd and 3rd equation.

212 RR23R ++++→→→→′′′′

313 RR25R ++++−−−−→→→→′′′′

Page 4: Numerical Solutions of Linear Systems of Equationsengr of Linear Equation… · Numerical Solutions of Linear Systems of Equations Linear Dependence and Independence An equation in

EE 216 Class Notes

Pages 4 of 21

Step 2

Eliminate y from the 3rd equation.

323 RR13R ++++→→→→′′′′

From Row 3, 168z = 672 Therefore, z = 672/168 = 4

From Row 2, -y + 14.5z = 61

or, - y + 14.5 (4) = 61

or, y = - 3 From Row 1, 2x – 4y + 5z = 36

or, 2x – 4 (- 3) + 5 (4) = 36

or, x = 2

Let us consider another set of linearly independent equations.

- 4x + 3y + 2z = - 5 … … (1)

−−−−−−−−−−−−−−−−

1215.20130615.141036542

2x – 4y + 5 = 36 - y + 14.5z = 61 13y –20.5z = - 121

−−−−−−−−

67216800615.141036542

2x – 4y + 5 = 36 - y + 14.5z = 61

168z = 672

Page 5: Numerical Solutions of Linear Systems of Equationsengr of Linear Equation… · Numerical Solutions of Linear Systems of Equations Linear Dependence and Independence An equation in

EE 216 Class Notes

Pages 5 of 21

5x + y - 3z = 32 … … (2)

3x - 4y + z = - 15 … … (3)

The augmented matrix for this set is:

−−−−−−−−−−−−

−−−−−−−−

1514332315

5234

Step 1 Eliminate x from the 2nd and 3rd equation.

212 R4R5R ++++→→→→′′′′ 313 R4R3R ++++→→→→′′′′

Step 2 Eliminate y from the 3rd equation.

323 R19R7R ++++→→→→′′′′

- 4x + 3y + 2z = - 5 19y - 2z = 103

- 7y + 10z = - 75

−−−−−−−−−−−−

−−−−−−−−

7510701032190

5234

−−−−−−−−

−−−−−−−−

704176001032190

5234

- 4x + 3y + 2z = - 5 19y - 2z = 103

176z = - 704

Page 6: Numerical Solutions of Linear Systems of Equationsengr of Linear Equation… · Numerical Solutions of Linear Systems of Equations Linear Dependence and Independence An equation in

EE 216 Class Notes

Pages 6 of 21

From Row 3, 176z = -704 Therefore, z = - 704/176 = - 4 From Row 2, 19y – 2z = 103 or, 19y – 2 (- 4) = 103 or, y = 5 From Row 1, - 4x + 3y + 2z = -5 or, - 4x + 3 (5) + 2 (- 4) = -5 or, x = 3 Elementary operations for equations and matrices are:

(I) Interchange of two equations.

(II) Multiplication of an equation by a nonzero constant.

(III) Addition of a constant multiple of one equation to another equation.

When would you interchange two equations (rows)?

Let us consider the following set of equations.

3y + 2z = 16 … … (1)

4x + 2y - 3z = - 10 … … (2)

3x + 4y + z = 9 … … (3)

The corresponding augmented matrix is:

−−−−−−−−9143

1032416230

Page 7: Numerical Solutions of Linear Systems of Equationsengr of Linear Equation… · Numerical Solutions of Linear Systems of Equations Linear Dependence and Independence An equation in

EE 216 Class Notes

Pages 7 of 21

Eqn. (1) (Row 1) cannot be used to eliminate x from Eqns. (2) and (3) (Rows 2 and 3).

Interchange Row 1 with Row 2.

The augmented matrix becomes:

−−−−−−−−

91431623010324

Now follow the steps mentioned earlier to solve for the unknowns.

The solution is:

x = - 3

y = 4

z = 2

Let us consider the following set of linear equations.

Gauss elimination suggests doing elementary row operations from top to bottom. A slightly modified form, known as Gauss-Jordan elimination suggests doing elementary row operations from bottom to top as well.

2x1 – 4x2 + 5x3 = 36 … … (1)

- 3x1 + 5x2 + 7x3 = 7 … … (2)

5x1 + 3x2 – 8x3 = - 31 … … (3)

Page 8: Numerical Solutions of Linear Systems of Equationsengr of Linear Equation… · Numerical Solutions of Linear Systems of Equations Linear Dependence and Independence An equation in

EE 216 Class Notes

Pages 8 of 21

−−−−−−−−

−−−−

−−−−

31

7

36

835

753

542

313212 25

23 RRRRRR ++++−−−−→→→→′′′′++++→→→→′′′′

−−−−

−−−−

−−−−

121-

61

36

241130

22910

542

33 131 RR →→→→′′′′

−−−−

−−−−

−−−−

121/13-

61

36

264110

22910

542

323 RRR ++++→→→→′′′′

−−−−

−−−−

672/13

61

36

1316800

22910

542

33 16813 RR →→→→′′′′

−−−−

−−−−

4

61

36

100

22910

542

322311 229 5 RRRRRR −−−−→→→→′′′′−−−−→→→→′′′′

−−−−

−−−−

4

3

16

100

010

042

Page 9: Numerical Solutions of Linear Systems of Equationsengr of Linear Equation… · Numerical Solutions of Linear Systems of Equations Linear Dependence and Independence An equation in

EE 216 Class Notes

Pages 9 of 21

211 4RRR −−−−→→→→′′′′

−−−−

4

3

4

100

010

002

)...()...()...(

34 2314 2

3

2

1

========−−−−====

xx

x

Definitions

Homogeneous system

3y + 2z = 0 … … (1)

4x + 2y - 3z = 0 … … (2)

3x + 4y + z = 0 … … (3)

Notice the values on the right hand side of each equation.

Non-homogeneous system

3y + 2z = 16 … … (1)

4x + 2y - 3z = 0 … … (2)

3x + 4y + z = 0 … … (3)

At least one equation with a nonzero element on the right hand side makes a system non-homogeneous. If a system is homogeneous, it has at least the trivial solution of x = 0, y = 0 and z = 0.

Page 10: Numerical Solutions of Linear Systems of Equationsengr of Linear Equation… · Numerical Solutions of Linear Systems of Equations Linear Dependence and Independence An equation in

EE 216 Class Notes

Pages 10 of 21

SYSTEMS OF LINEAR EQUATIONS Solution by Cramer’s Rule

Consider the following set of linear equations.

1313212111 bxaxaxa ====++++++++ … … (1)

2323222121 bxaxaxa ====++++++++ … … (2)

3333232131 bxaxaxa ====++++++++ … … (3)

The system of equations above can be written in matrix form as:

====

3

2

1

3

2

1

333231

232221

131211

bbb

xxx

aaaaaaaaa

[A][x] = [B]

where

[[[[ ]]]]

====

333231

232221

131211

Aaaaaaaaaa

[[[[ ]]]] [[[[ ]]]]

====

====

3

2

1

3

2

1

Bbbb

andxxx

x

If 0≠≠≠≠D , then the system has a unique solution as shown below (Cramer’s Rule).

DDx

DDx

DDx 3

32

21

1 and, ============

Page 11: Numerical Solutions of Linear Systems of Equationsengr of Linear Equation… · Numerical Solutions of Linear Systems of Equations Linear Dependence and Independence An equation in

EE 216 Class Notes

Pages 11 of 21

where

333231

232221

131211

aaaaaaaaa

D ====

33323

23222

13121

1

aabaabaab

D ====

33331

23221

13111

2

abaabaaba

D ==== 33231

22221

11211

3

baabaabaa

D ====

Let us consider the following set of linear equations.

2x1 – 4x2 + 5x3 = 36 … … (1)

- 3x1 + 5x2 + 7x3 = 7 … … (2)

5x1 + 3x2 – 8x3 = - 31 … … (3)

[A][x] = [B]

where

[[[[ ]]]]

−−−−−−−−

−−−−====

835753542

A

[[[[ ]]]] [[[[ ]]]]

−−−−====

====317

36B

3

2

1

andxxx

x

Page 12: Numerical Solutions of Linear Systems of Equationsengr of Linear Equation… · Numerical Solutions of Linear Systems of Equations Linear Dependence and Independence An equation in

EE 216 Class Notes

Pages 12 of 21

336835753542

−−−−====−−−−

−−−−−−−−

====D

67283317575436

1 −−−−====−−−−−−−−

−−−−====D

100883157735362

2 ====−−−−−−−−

−−−−====D

13443135753

3642

3 −−−−====−−−−

−−−−−−−−

====D

23366721

1 ====−−−−−−−−========

DDx

3336

100822 −−−−====

−−−−========

DDx

4336

134433 ====

−−−−−−−−========

DDx

Page 13: Numerical Solutions of Linear Systems of Equationsengr of Linear Equation… · Numerical Solutions of Linear Systems of Equations Linear Dependence and Independence An equation in

EE 216 Class Notes

Pages 13 of 21

Solve the following set of linear equations.

x1 + x2 + x3 = 2 … … (1)

2x1 + 5x2 + 3x3 = 11 … … (2)

- x1 + 2x2 + x3 = 3 … … (3)

Solution by Matrix Inversion

Consider the following set of linear equations.

1313212111 bxaxaxa ====++++++++ … … (1)

2323222121 bxaxaxa ====++++++++ … … (2)

3333232131 bxaxaxa ====++++++++ … … (3)

The system of equations above can be written in matrix form as:

====

3

2

1

3

2

1

333231

232221

131211

bbb

xxx

aaaaaaaaa

[A][x] = [B]

where

[[[[ ]]]]

====

333231

232221

131211

Aaaaaaaaaa

Page 14: Numerical Solutions of Linear Systems of Equationsengr of Linear Equation… · Numerical Solutions of Linear Systems of Equations Linear Dependence and Independence An equation in

EE 216 Class Notes

Pages 14 of 21

[[[[ ]]]] [[[[ ]]]]

====

====

3

2

1

3

2

1

Bbbb

andxxx

x

If 0≠≠≠≠D , then the system has a unique solution.

[x] = [A]-1[B]

A Traffic Light Assembly

6 m

3 m

6 m

3 m

3 m

4 m

4 m

4 m4 m

x

y

h

z

A

B

C

D

Figure 1.1 A traffic light assembly

The mass of the traffic light assembly is 20 kg and h = 3.5 m. For equilibrium, the forces acting on the light assembly in all three directions (x, y and z) should equal to zero.

0=∑ xF , 0=∑ yF and 0=∑ zF

Page 15: Numerical Solutions of Linear Systems of Equationsengr of Linear Equation… · Numerical Solutions of Linear Systems of Equations Linear Dependence and Independence An equation in

EE 216 Class Notes

Pages 15 of 21

Based on the above, a set of equations in terms of the three unknown forces can be written as:

07960.08381.05970.0 ====++++−−−− ADACAB FFF … … (1)

05970.04191.07960.0 ====−−−−−−−− ADACAB FFF … … (2)

2.1960995.03492.00995.0 ====++++++++ ADACAB FFF … … (3)

[A][F] = [B]

where

[[[[ ]]]]

−−−−−−−−−−−−

====0995.03492.00995.05970.04191.07960.07960.08381.05970.0

A

[[[[ ]]]] [[[[ ]]]]

====

====2.19600

BandFFF

F

AD

AC

AB

[[[[ ]]]] [[[[ ]]]]B]A[ 1−−−−====F

[[[[ ]]]]

−−−−−−−−−−−−====

−−−−

8867.06207.06799.01056.20421.02948.07737.17685.03547.0

A1

[[[[ ]]]]

−−−−−−−−−−−−====

2.19600

8867.06207.06799.01056.20421.02948.07737.17685.03547.0

F

Page 16: Numerical Solutions of Linear Systems of Equationsengr of Linear Equation… · Numerical Solutions of Linear Systems of Equations Linear Dependence and Independence An equation in

EE 216 Class Notes

Pages 16 of 21

[[[[ ]]]]

====

====978.173126.413997.347

AD

AC

AB

FFF

F

Therefore, FAB = 347.997 N, FAC = 413.126 N and FAD = 173.978 N

An Electrical Circuit

Based on the principles of voltage drops (Kirchoff’s voltage law) and current flow

(Kirchoff’s current law), the following equations can be written in terms of the unknown current flow.

I1 I2

I3

20 ohms 15 ohms

12 ohms80 V

+

-120 V

+

-

Figure 2.1 An electrical circuit

801220 31 ====++++ II … … (2.1)

1201215 32 ====++++ II … … (2.2)

0321 ====−−−−++++ III … … (2.3)

The set of equations can be solved by substitution method in the following manner.

Page 17: Numerical Solutions of Linear Systems of Equationsengr of Linear Equation… · Numerical Solutions of Linear Systems of Equations Linear Dependence and Independence An equation in

EE 216 Class Notes

Pages 17 of 21

[A][C] = [B]

where

[[[[ ]]]]

−−−−====

1111215012020

A

[[[[ ]]]] [[[[ ]]]]

====

====0

12080

B

3

2

1

andIII

C

[[[[ ]]]] [[[[ ]]]]B]A[ 1−−−−====C

[[[[ ]]]]

−−−−−−−−

−−−−====

−−−−

4167.00278.00208.03333.00444.00167.02500.00167.00375.0

A1

[[[[ ]]]]

−−−−−−−−

−−−−====

0120

80

4167.00278.00208.03333.00444.00167.02500.00167.00375.0

C

[[[[ ]]]]

====

====541

3

2

1

III

C

Therefore, I1 = 1 A, I2 = 4 A and I3 = 5 A.

Page 18: Numerical Solutions of Linear Systems of Equationsengr of Linear Equation… · Numerical Solutions of Linear Systems of Equations Linear Dependence and Independence An equation in

EE 216 Class Notes

Pages 18 of 21

Flow Through a Piping Network

A

B

C

D

0.03 m3/s

0.06 m3/s

0.09 m3/sd = 0.5 mL = 150 m

d = 0.5 mL = 150 m

d = 0.5 mL = 300 m

d = 0.5 mL = 300 m

d = 0.5 mL = 300 m

d = 0.75 mL = 300 m

d = 0.75 mL = 300 m

d = 0.75 mL = 300 m

Figure 3.1 A piping network

A set of equations can be written based on the following principles:

1. At each junction, flow in = flow out.

2. Kinetic energy and potential energy of the fluid makes the fluid move through the piping network.

3. For a given fluid flow, the velocity increases and the pressure decreases when the pipe diameter is decreased.

4. Frictional loss is directly proportional to the length of the pipe and the viscosity of the fluid and inversely proportional to the diameter of the pipe.

A set of equations as functions of the five unknown flow rates can be written as:

03.0====++++ ACAB QQ … … (3.1)

06.0====++++++++−−−− CDCBAC QQQ … … (3.2)

0====−−−−++++ BDCBAB QQQ … … (3.3)

09.39.299.29 ====−−−−−−−− CBACAB QQQ … … (3.4)

09.199.79.3 ====++++−−−− BDCDCB QQQ … … (3.5)

Page 19: Numerical Solutions of Linear Systems of Equationsengr of Linear Equation… · Numerical Solutions of Linear Systems of Equations Linear Dependence and Independence An equation in

EE 216 Class Notes

Pages 19 of 21

It should be noted that Eqns. (3.1) – (3.3) have been derived based on the principle of conservation of mass. Eqns. (3.4) and (3.5) have been derived based on the principle of pressure drop along pipe sections. The set of equations can be solved by substitution method in the following manner.

[A][Q] = [B]

where

[[[[ ]]]]

−−−−−−−−−−−−

−−−−−−−−

====

9.199.79.300009.39.299.29101010111000011

A

[[[[ ]]]] [[[[ ]]]]

====

====

000

06.003.0

Band

QQQQQ

Q

BD

CD

CB

AC

AB

[[[[ ]]]] [[[[ ]]]]B]A[ 1−−−−====Q

Page 20: Numerical Solutions of Linear Systems of Equationsengr of Linear Equation… · Numerical Solutions of Linear Systems of Equations Linear Dependence and Independence An equation in

EE 216 Class Notes

Pages 20 of 21

[[[[ ]]]]

−−−−−−−−−−−−−−−−

−−−−−−−−−−−−−−−−−−−−−−−−

====−−−−

0318.00019.03675.02511.03093.00318.00019.06325.07489.06907.00298.00139.05938.02357.0179.00019.00158.00387.00154.05117.00019.00158.00387.00154.04883.0

A1

[[[[ ]]]]

−−−−−−−−−−−−−−−−

−−−−−−−−−−−−−−−−−−−−−−−−

====

000

06.003.0

0318.00019.03675.02511.03093.00318.00019.06325.07489.06907.00298.00139.05938.02357.0179.00019.00158.00387.00154.05117.00019.00158.00387.00154.04883.0

Q

[[[[ ]]]]

====

====

0243.00657.00087.00144.00156.0

BD

CD

CB

AC

AB

QQQQQ

Q

Therefore,

QAB = 0.0156 m3/s, QAC = 0.0144 m3/s

QCB = 0.0087 m3/s, QCD = 0.0657 m3/s

QBD = 0.0243 m3/s

Page 21: Numerical Solutions of Linear Systems of Equationsengr of Linear Equation… · Numerical Solutions of Linear Systems of Equations Linear Dependence and Independence An equation in

EE 216 Class Notes

#21

Solve the following set of linear equations.

x1 + x2 + x3 = 2 … … (1)

2x1 + 5x2 + 3x3 = 11 … … (2)

- x1 + 2x2 + x3 = 3 … … (3)

Exercise Sets Solve the following sets of linear equations by Gaussian elimination, Gauss-Jordan elimination, Cramer’s rule and matrix inversion.

(1)

11423252

84

321

321

321

=++=++

=+−

xxxxxx

xxx

(2)

3133

23

21

321

321

=+−=+−

=+−

xxxxx

xxx

(3)

8221

851

41

31

961

51

41

321

321

321

=++

=++

=++

xxx

xxx

xxx

(4)

534

632

321

321

321

=−+−=−+

=+−

xxxxxx

xxx

(5)

1051262432

321

321

321

=+−=+−=−+

xxxxxxxxx

(6)

453303

12

321

321

321

=++=++

−=+−

xxxxxxxxx