mca_unit-2_computer oriented numerical statistical methods

21
Unit-2 SOLUTION OF SIMULTANEOUS LINEAR EQUATIONS RAI UNIVERSITY, AHMEDABAD 1 Course: MCA Subject: Computer Oriented Numerical Statistical Methods Unit-2 RAI UNIVERSITY, AHMEDABAD

Upload: rai-university

Post on 20-Jul-2015

92 views

Category:

Education


3 download

TRANSCRIPT

Page 1: MCA_UNIT-2_Computer Oriented Numerical Statistical Methods

Unit-2 SOLUTION OF SIMULTANEOUS LINEAR EQUATIONS

RAI UNIVERSITY, AHMEDABAD 1

Course: MCA Subject: Computer Oriented Numerical

Statistical Methods Unit-2

RAI UNIVERSITY, AHMEDABAD

Page 2: MCA_UNIT-2_Computer Oriented Numerical Statistical Methods

Unit-2 SOLUTION OF SIMULTANEOUS LINEAR EQUATIONS

RAI UNIVERSITY, AHMEDABAD 2

Unit-II-Solution of simultaneous Linear Equations

Sr.

No.

Name of the Topic Page

No.

1. Introduction, System of linear equations in two variable Methods

for solving linear equation,

2

2. Existence of Unique roots, multiple roots and no roots (consistency

and Inconsistency of system), Dependent and Independent system

of linear equations, Examples

2

3. System of linear equations in three variables, System of linear

equations in n-variables

7

4. Methods for solving system of linear equations 9

5. Gauss elimination method and its examples 9

6. Gauss Seidel method and its examples 13

7. Difference between Direct Method and Iterative Method 16

8. References 17

9. Exercise 18

Page 3: MCA_UNIT-2_Computer Oriented Numerical Statistical Methods

Unit-2 SOLUTION OF SIMULTANEOUS LINEAR EQUATIONS

RAI UNIVERSITY, AHMEDABAD 3

1.1 Introduction:

We are already familiar with solving linear equations of one variable and two

variables. The general form of linear equation of one variable is ax + b = 0 where

a is not 0 and a and b are real numbers, and the general form of linear equations of

two variables is

ax + by + c =0 where a, b and c are real numbers. In this section let us discuss with

system of linear equations.

1.2 What is a system of linear Equations?

1.2.1 Definition: System of Linear Equations

Linear Equations in one variable: The general form of linear equation in one

variable is ax + b = 0, where a and b are Real numbers and a is not equal to 0.

This system has unique solution, which is x = - b/a

For example : 2x + 6 = 0

=> 2x = -6

= > x = - 6/2 = - 3 π‘₯ =βˆ’π‘

π‘Ž

The only solution to this equation is x = - 3

This solution can be represented on a number line.

2.1 System of linear Equations in two variables:

The general form of linear equation in two variables is ax + by +c = 0, where a, b, c are real numbers and a and b both not equal to 0.

Let us consider the example x + y = 6

This equation will satisfy for infinitely many pairs of the form (x,y) satisfying this

condition.

For example (1,6), 2,4), (3,3), (7, -1),.........etc

so that in all the cases x + y = 5, meaning the sum of the coordinates = 6

Hence these pairs of values satisfying the given equation are called the solution to

the given equation.

Page 4: MCA_UNIT-2_Computer Oriented Numerical Statistical Methods

Unit-2 SOLUTION OF SIMULTANEOUS LINEAR EQUATIONS

RAI UNIVERSITY, AHMEDABAD 4

2.2 System of linear Equations Solver:

Step-1. For the linear equations of one variable, there will be unique solution

which can be solved from the given equation.

Step-2. For the linear equations of two variables, we need to have two equations to

solve for the variables.

Let us assume that the given two equations are of the form

a1 x + b1 y + c1 = 0 and a2 x + b2 y + c2 = 0.

It is possible to solve the system of linear equations for the unknown variables x

and y.

The methods involved in solving these homogeneous systems of linear equations

are,

1. Substitution Method.

2. Elimination Method.

3. Cross Multiplication Method

4. Matrix Method etc.

To solve a system of linear equations we should know about the types of

solution(s) that exists for the system.

2.3 Consistent system of linear equations: (Unique Roots, Infinite Roots)

The system of linear equations is said to be consistent if the solution exists.

For the above system of equations, if the following ratio satisfies we can say about

the type of solutions accordingly.

If π‘Ž1

π‘Ž2 β‰ 

𝑏1

𝑏2 then the system has unique solution.

If π‘Ž1

π‘Ž2 =

𝑏1

𝑏2=

𝑐1

𝑐2 then the system has infinite solution.

2.4 Inconsistent System of Equations: (No roots)

The system of linear equations is said to be inconsistent if the solution does not exists.

For the above system of equations, if the following ratio satisfies then we can say

that the system is inconsistent

Page 5: MCA_UNIT-2_Computer Oriented Numerical Statistical Methods

Unit-2 SOLUTION OF SIMULTANEOUS LINEAR EQUATIONS

RAI UNIVERSITY, AHMEDABAD 5

If π‘Ž1

π‘Ž2=

𝑏1

𝑏2β‰ 

𝑐1

𝑐2

2.5 Dependent system of Linear Equations:

System of Linear Equations is said to be dependent if both the equations have infinitely common solutions.

So the coinciding lines are the dependent system of linear equations.

They satisfy the condition, π‘Ž1

π‘Ž2=

𝑏1

𝑏2 =

𝑐1

𝑐2

2.6 Independent system of Linear Equations:

System of Linear Equations is said to be independent if they do not have infinite number of common solution. So the intersecting lines and the parallel lines are the Independent system of Linear

Equations.

2.7 Solving system of linear equations:

While solving a system of linear equations, we will come to know if they are

consistent or inconsistent, dependent or independent.

System of Linear Equations Examples:

2.7.1 Exampleβ€”

Solve the system of linear equations: πŸπ’™ + πŸ‘π’š = πŸπŸ“; πŸ‘π’™ + πŸπ’š = πŸπŸ“

Solution:

Let us number the equations 2π‘₯ + 3𝑦 = 25 ------------------------------(1)

3π‘₯ + 2𝑦 = 25 ------------------------------(2)

Multiplying Equation (1) by 3, 3 ( 2π‘₯ + 3𝑦 ) = 3 ( 25) 6π‘₯ + 9𝑦 = 75 --------------------(3)

Multiplying equation (2) by 2, 2 ( 3π‘₯ + 2𝑦 ) = 2 ( 25)

6π‘₯ + 4𝑦 = 50 -----------------------------(4)

6π‘₯ + 9𝑦 = 75 ------------------------------(3)

6π‘₯ + 4𝑦 = 50 ------------------------------(4)

______________

Page 6: MCA_UNIT-2_Computer Oriented Numerical Statistical Methods

Unit-2 SOLUTION OF SIMULTANEOUS LINEAR EQUATIONS

RAI UNIVERSITY, AHMEDABAD 6

Subtracting (4) from (3) 5𝑦 = 25

𝑦 = 25 /5 = 5 Substituting y=5 in (1) we get, 2π‘₯ + 3(5) = 25 2π‘₯ + 15 = 25

2π‘₯ = 25 βˆ’ 15 = 10

π‘₯ = 10/2 = 5 Therefore, the two equations intersect at the point (2,2).

Hence the system of equations is consistent and independent.

If we verify the condition, π‘Ž1

π‘Ž2β‰ 

𝑏1

𝑏2, we see that,

2

3 β‰ 

3

2

2.7.2 Exampleβ€”

Solve the System of linear equations: 𝒙 + π’š = πŸ’, πŸπ’™ + πŸπ’š = πŸ—

Solution:

Let π‘₯ + 𝑦 = 4 ---------------------(1)

2π‘₯ + 2𝑦 = 9 ------------------- (2) Multiplying (1) by 2, we get,

2 ( π‘₯ + 𝑦 ) = 2(4) => 2π‘₯ + 2𝑦 = 8 -------------------(3)

2π‘₯ + 2𝑦 = 9 --------------------(2)

Subtracting , (2) from (3), we get, 0 = 1, which is not true. Hence the system of equations have no solution.

From the above relation, π‘Ž1

π‘Ž2=

𝑏1

𝑏2β‰ 

𝑐1

𝑐2

we have 1

2=

1

2β‰ 

4

9

Hence the above pair of equations is inconsistent and

independent.

Page 7: MCA_UNIT-2_Computer Oriented Numerical Statistical Methods

Unit-2 SOLUTION OF SIMULTANEOUS LINEAR EQUATIONS

RAI UNIVERSITY, AHMEDABAD 7

2.7.3 Exampleβ€”

Solve the system of linear equations: 𝒙 + πŸ‘π’š = πŸ– ; πŸ‘π’™ + πŸ—π’š = πŸπŸ’

Solution:

Let π‘₯ + 3𝑦 = 8 ---------------------(1)

3π‘₯ + 9𝑦 = 24 ------------------ (2)

Substituting π‘₯ = 8 βˆ’ 3𝑦 in (2), 3 ( 8 βˆ’ 3𝑦 ) + 9𝑦 = 24

=> 24 βˆ’ 9𝑦 + 9𝑦 = 24 This condition is true for all values of y. we get 24 = 24 which is true.

Therefore the system of equations has infinitely many solutions. Hence the system is consistent and dependent Hence by solving system of

equations we can conclude if the system of linear equations is consistent or inconsistent and independent or dependent.

2.8 System of Linear Equations word problems:

We can follow the following steps while solving the word problems.

Step 1: Read the problem carefully and identify the unknown quantities. Give

these quantities a variable name like π‘₯, 𝑦, 𝑒, 𝑣, 𝑀, etc.

Step 2: Identify the variables to be determined.

Step 3: Read the problem carefully and formulate the equations in terms of the

variables to be determined.

Solve 4: Solve the equations obtained in step 3, using any one of the method you

are comfortable with.

2.8.1 Exampleβ€”

4 Chairs and 3 tables cost 1400 dollars and 5 chairs and 2 tables cost 1400

dollars. Find the cost of a chair and a table.

Solution:

Let the cost of a chair be x dollars, and the cost of a table be y dollars.

Page 8: MCA_UNIT-2_Computer Oriented Numerical Statistical Methods

Unit-2 SOLUTION OF SIMULTANEOUS LINEAR EQUATIONS

RAI UNIVERSITY, AHMEDABAD 8

Let us solve linear system of equations we have framed here. Hence we have the equations, 4π‘₯ + 3𝑦 = 1400 ---------------------(1)

5π‘₯ + 2𝑦 = 1400 ---------------------(2)

Multiplying (1) by 5, 5( 4π‘₯ + 3𝑦 ) = 5( 1400)

=> 20 π‘₯ + 15 𝑦 = 7000 ------------------------(3) Multiplying (2) by 4, we get 4 ( 5π‘₯ + 2𝑦 ) = 4 ( 1400)

=> 20 π‘₯ + 8 𝑦 = 5600 ----------------------(4)

20 π‘₯ + 15 𝑦 = 7000 ----------------------(3)

______________________

Subtracting (3) from (4), βˆ’ 7 𝑦 = βˆ’1400

=> 𝑦 = βˆ’1400/βˆ’7 = 200 Substituting y= 200 in Equation (1), we get,

4π‘₯ + 3 ( 200) = 1400

=> 4π‘₯ + 600 = 1400

=> 4π‘₯ = 1400 βˆ’ 600 = 800 =

> π‘₯ = 800/4 = 200 Therefore cost of a Chair is 200 dollars and cost of a Table is 200 dollars.

3.1 System of linear equations in three variables:

The general form of linear equation in three variables, π‘₯, 𝑦 π‘Žπ‘›π‘‘ 𝑧 is

π‘Žπ‘₯ + 𝑏𝑦 + 𝑐𝑧 + 𝑑 = 0, where a, b, c are real numbers and a, b, c not all equal to 0.

This represent the equation of a plane in three-dimensional co-ordinate system, where π‘Ž, 𝑏, 𝑐 are the direction ratios of the normal to the plane.

To solve the equation in three variables, we need to have three conditions

(equations) relating the variables π‘₯, 𝑦 π‘Žπ‘›π‘‘ 𝑧. Elimination method is the most suitable method to solve the equations.

Page 9: MCA_UNIT-2_Computer Oriented Numerical Statistical Methods

Unit-2 SOLUTION OF SIMULTANEOUS LINEAR EQUATIONS

RAI UNIVERSITY, AHMEDABAD 9

3.2 System of Linear equations with n variables

π‘Ž11π‘₯1 + π‘Ž12π‘₯2 + β‹― … … + π‘Ž1𝑛π‘₯𝑛 = 𝑏1

π‘Ž21π‘₯1 + π‘Ž22π‘₯2 + β‹― … … + π‘Ž2𝑛π‘₯𝑛 = 𝑏2

… … … … … … … … … … … … … … … … … … ..

π‘Žπ‘š1π‘₯1 + π‘Žπ‘š2π‘₯2 + β‹― … … + π‘Žπ‘šπ‘›π‘₯𝑛 = π‘π‘š

We can also write it in Matrix form as

[

π‘Ž11 π‘Ž12 … … . π‘Ž1𝑛

π‘Ž21 π‘Ž22 … … . π‘Ž2𝑛

… … . . … … … … … … . .π‘Žπ‘š1 π‘Žπ‘š2 … … π‘Žπ‘šπ‘›

] [

π‘₯1

π‘₯2

…π‘₯π‘š

] = [

𝑏1

𝑏2

…𝑏3

]

⟹ 𝐴𝑋 = 𝐡

𝐢 = [𝐴, 𝐡] = [

π‘Ž11 π‘Ž12 … … . π‘Ž1𝑛

π‘Ž21 π‘Ž22 … … . π‘Ž2𝑛

… … . . … … … … … … . .π‘Žπ‘š1 π‘Žπ‘š2 … … π‘Žπ‘šπ‘›

]is called augumented matrix.

[𝐴: 𝐡] = 𝐢

3.2.1 (𝒂) Consistent Equations:

If Rank A = Rank C

(i) Unique Solution: Rank A= Rank C=n Where, 𝑛 = number of

unknown

(ii) Infinite Solution: Rank A= Rank C= r, π‘Ÿ < 𝑛

3.2.2 (𝒃) Inconsistent Equations:

If Rank 𝐴 β‰  Rank 𝐢.

Page 10: MCA_UNIT-2_Computer Oriented Numerical Statistical Methods

Unit-2 SOLUTION OF SIMULTANEOUS LINEAR EQUATIONS

RAI UNIVERSITY, AHMEDABAD 10

4.1. There are two types of methods for solving System of Linear equations:

A. Direct Methods B. Iterative Methods

4.2 Direct Methods Of Solution:

1. Gauss elimination Method 2. Gauss -Jordan Method 3. Factorization method

4.3 Iterative Methods:

1. Jacobi’s iteration Method 2. Gauss - Seidel iteration Method

3. Relaxation Method

Here we discuss only 1st method gauss elimination.

5.1 Gauss elimination Method:

In this method, the unknowns are eliminated successively and the system is reduced to an upper triangular system from which the unknowns are found by back

A system of non-homogeneous linear equations

AX=B

if R(A)=R(C)

solution exists

system is consistant

if R(A)=R(C)=n

system has unique solution

if R(A)=R(C) less than n

Infinite Solution

if R(A)# R(C)

solution does not exist

system is inconsistant

Page 11: MCA_UNIT-2_Computer Oriented Numerical Statistical Methods

Unit-2 SOLUTION OF SIMULTANEOUS LINEAR EQUATIONS

RAI UNIVERSITY, AHMEDABAD 11

substitution. The method is quite general and is well-adapted for computer operations. Here we shall explain it by considering a system of three equations for

the sake of clarity.

Consider the equations

π‘Ž1π‘₯ + 𝑏1𝑦 + 𝑐1𝑧 = 𝑑1

π‘Ž2π‘₯ + 𝑏2𝑦 + 𝑐2𝑧 = 𝑑2

π‘Ž3π‘₯ + 𝑏3𝑦 + 𝑐3𝑧 = 𝑑3

Step-I. To eliminate π‘₯ from second and third equations.

Assuming π‘Ž1 β‰  0,we eliminate π‘₯ from the second equation by subtracting (π‘Ž2

π‘Ž1)

times the first equation from the second equation. Similarly we eliminate π‘₯ from

the third equation by eliminating (π‘Ž3

π‘Ž1) times the first equation from the third

equation. We thus get the new system

π‘Ž1π‘₯ + 𝑏1𝑦 + 𝑐1𝑧 = 𝑑1

𝑏2′𝑦 + 𝑐2′𝑧 = 𝑑2β€²

𝑏3′𝑦 + 𝑐3′𝑧 = 𝑑3β€²

Here the first equation is called the pivotal equation and π‘Ž1 is called the first pivot.

Step-II. To eliminate 𝑦 from third equation in (2).

Assuming 𝑏2β€² β‰  0, we eliminate 𝑦 from the third equation of (2) ,by Subtracting

(𝑏3 β€²

𝑏2 β€²) times the second equation from third equation. We thus, get the new system

π‘Ž1π‘₯ + 𝑏1𝑦 + 𝑐1𝑧 = 𝑑1

𝑏2′𝑦 + 𝑐2′𝑧 = 𝑑2β€²

𝑐3′′𝑧 = 𝑑3β€²β€²

Here the second equation is the pivotal equation and 𝑏2 β€² is the new pivot.

Page 12: MCA_UNIT-2_Computer Oriented Numerical Statistical Methods

Unit-2 SOLUTION OF SIMULTANEOUS LINEAR EQUATIONS

RAI UNIVERSITY, AHMEDABAD 12

Step-III. To evaluate the unknowns.

The values of π‘₯, 𝑦, 𝑧 are found from the reduced system (3) by back substitution.

5.1.1 Exampleβ€”

Apply gauss elimination method to solve the equations

𝒙 + πŸ’π’š βˆ’ 𝒛 = βˆ’πŸ“

𝒙 + π’š βˆ’ πŸ”π’› = βˆ’πŸπŸ

πŸ‘π’™ βˆ’ π’š βˆ’ 𝒛 = πŸ’ .

Solution:

We have [1 4 βˆ’11 1 βˆ’63 βˆ’1 βˆ’1

][π‘₯𝑦𝑧

] = [βˆ’5

βˆ’124

]

Operate 𝑅2 βˆ’ 𝑅1 & 𝑅3 βˆ’ 3𝑅1,

~ [1 4 βˆ’10 βˆ’3 βˆ’50 βˆ’13 2

] [π‘₯𝑦𝑧

] = [βˆ’5βˆ’719

]

Operate 𝑅3 βˆ’13

3𝑅2 ,

[1 4 10 βˆ’3 βˆ’50 0 71/3

] [π‘₯𝑦𝑧

] = [βˆ’5βˆ’7

148/3]

Thus, We have 𝑧 =148

71= 2.0845,

3𝑦 = 7 βˆ’ 5𝑧 = 7 βˆ’ 10.4225 = βˆ’3.4225 i.e., 𝑦 = βˆ’1.1408

π‘₯ = βˆ’5 βˆ’ 4𝑦 + 𝑧 = βˆ’5 + 4(1.1408) + 2.0845 = 1.6479

and

Hence π‘₯ = 1.6479, 𝑦 = βˆ’1.1408, 𝑧 = 2.0845.

Page 13: MCA_UNIT-2_Computer Oriented Numerical Statistical Methods

Unit-2 SOLUTION OF SIMULTANEOUS LINEAR EQUATIONS

RAI UNIVERSITY, AHMEDABAD 13

5.1.2 Exampleβ€”

Solve by using gauss elimination Method.

π’™πŸ + πŸπ’™πŸ βˆ’ π’™πŸ‘ = πŸ‘

πŸ‘π’™πŸ βˆ’ π’™πŸ + πŸπ’™πŸ‘ = 𝟏

πŸπ’™πŸ βˆ’ πŸπ’™πŸ + πŸ‘π’™πŸ‘ = 𝟐

π’™πŸ βˆ’ π’™πŸ + π’™πŸ‘ = βˆ’πŸ

Solution:

We have given system of solution

π‘₯1 + 2π‘₯2 βˆ’ π‘₯3 = 3

3π‘₯1 βˆ’ π‘₯2 + 2π‘₯3 = 1

2π‘₯1 βˆ’ 2π‘₯2 + 3π‘₯3 = 2

π‘₯1 βˆ’ π‘₯2 + π‘₯3 = βˆ’1

The System of equation can be written in matrix form as

[

1 2 βˆ’13 βˆ’1 221

βˆ’2βˆ’1

31

] [π‘₯1

π‘₯2π‘₯3

] = [

312

βˆ’1

]

Operate (βˆ’3)𝑅1 + 𝑅2 , (βˆ’2)𝑅1 + 𝑅3 , (βˆ’1)𝑅1 + 𝑅4

~ [

1 2 βˆ’10 βˆ’7 500

βˆ’6βˆ’3

52

] [π‘₯1

π‘₯2π‘₯3

] = [

3βˆ’8βˆ’4βˆ’4

]

Operate βˆ’6

7𝑅2 + 𝑅3 , βˆ’

3

7𝑅2 + 𝑅4

Page 14: MCA_UNIT-2_Computer Oriented Numerical Statistical Methods

Unit-2 SOLUTION OF SIMULTANEOUS LINEAR EQUATIONS

RAI UNIVERSITY, AHMEDABAD 14

~ [

1 2 βˆ’10 βˆ’7 500

00

5/7βˆ’1/7

][π‘₯1

π‘₯2π‘₯3

] = [

3βˆ’8

20/7βˆ’4/7

]

Operate 1

5𝑅3 + 𝑅4

~ [

1 2 βˆ’10 βˆ’7 500

00

5/70

] [π‘₯1

π‘₯2π‘₯3

] = [

3βˆ’8

20/70

]

∴5

7π‘₯3 =

20

7 ⟹ π‘₯3 = 4

Now βˆ’7π‘₯2 + 5π‘₯3 = βˆ’8

⟹ βˆ’7π‘₯2 + 5(4) = βˆ’8

⟹ βˆ’7π‘₯2 = βˆ’28

⟹ π‘₯2 = 4

Now π‘₯1 + 2π‘₯2 βˆ’ π‘₯3 = 3

⟹ π‘₯1 + 2(4) βˆ’ 4 = 3

⟹ π‘₯1 = 3 + 4 βˆ’ 8

⟹ π‘₯1 = βˆ’1

Hence we get the solution set (π‘₯1 ,π‘₯2 , π‘₯3) = (4,4, βˆ’1)

Now we discuss about 2nd iterative method Gauss – Seidel.

6.1 Gauss - Seidel iteration Method:

Page 15: MCA_UNIT-2_Computer Oriented Numerical Statistical Methods

Unit-2 SOLUTION OF SIMULTANEOUS LINEAR EQUATIONS

RAI UNIVERSITY, AHMEDABAD 15

This is a modification of the Jacobi’s iteration method. As before, we start with

initial approximations π‘₯0 , 𝑦0 ,𝑧0 (each=0) for π‘₯, 𝑦, 𝑧 respectively. Substituting 𝑦 =𝑦0 , 𝑧 = 𝑧0 in the first equations, we get

π‘₯1 = π‘˜1

Then putting π‘₯ = π‘₯1 , 𝑧 = 𝑧0 in the second of the equations, we have

𝑦1 = π‘˜2 βˆ’ 𝑙2π‘₯1 βˆ’ π‘š2𝑧0

Next substituting π‘₯ = π‘₯1, 𝑦 = 𝑦1 in the third equations, we obtain

𝑧1 = π‘˜3 βˆ’ 𝑙3π‘₯1 βˆ’ π‘š3𝑦1

And so on, i.e. as soon as new approximation for an unknown is found, it is

immediately used in the next step.

This process of iteration is continued till convergency to the desired degree of accuracy is obtained.

6.1.1 Exampleβ€”

Apply Gauss-Seidel iteration method to solve the equation:

πŸπŸŽπ’™ + π’š βˆ’ πŸπ’› = πŸπŸ•

πŸ‘π’™ + πŸπŸŽπ’š βˆ’ 𝒛 = βˆ’πŸπŸ–

πŸπ’™ βˆ’ πŸ‘π’š + πŸπŸŽπ’› = πŸπŸ“

Solution:

We write the given equation in the form

π‘₯ =1

20(17 βˆ’ 𝑦 + 2𝑧) ……………………………… (1)

𝑦 =1

20(βˆ’18 βˆ’ 3π‘₯ + 𝑧) ……………………………… (2)

𝑧 =1

20(25 βˆ’ 2π‘₯ + 3𝑦) ………………………………. (3)

Page 16: MCA_UNIT-2_Computer Oriented Numerical Statistical Methods

Unit-2 SOLUTION OF SIMULTANEOUS LINEAR EQUATIONS

RAI UNIVERSITY, AHMEDABAD 16

We start form the approximation π‘₯0 = 𝑦0 = 𝑧0 = 0.substituting 𝑦 = 𝑦0 , 𝑧 = 𝑧0 in

the right side of the first of equations (1) we get

π‘₯1 =1

20(17 βˆ’ 𝑦0 + 2𝑧0) = 0.8500

Putting π‘₯ = π‘₯1 , 𝑧 = 𝑧0 in the second of the equations (1), we have

𝑦1 =1

20(βˆ’18 βˆ’ 3π‘₯1 + 𝑧0) = βˆ’1.0275

Putting π‘₯ = π‘₯1 , 𝑦 = 𝑦1 in the last of the equations (1), we obtain

𝑧1 =1

20(25 βˆ’ 2π‘₯1 + 3𝑦1) = 1.0109

For the second iteration, we have

π‘₯2 =1

20(17 βˆ’ 𝑦1 + 2𝑧1) = 1.0025

𝑦2 =1

20(βˆ’18 βˆ’ 3π‘₯2 + 𝑧1) = βˆ’0.9998

𝑧2 =1

20(25 βˆ’ 2π‘₯2 + 3𝑦2) = 0.9998

For the third iteration, we get

π‘₯3 =1

20(17 βˆ’ 𝑦2 + 2𝑧2) = 1.0000

𝑦3 =1

20(βˆ’18 βˆ’ 3π‘₯3 + 𝑧2) = βˆ’1.0000

𝑧3 =1

20(25 βˆ’ 3π‘₯3 + 2𝑦3) = 1.0000

The values in the 2nd and 3rd iterations bring practically the same, we can stop.

Hence the solution is π‘₯ = 1, 𝑦 = βˆ’1, 𝑧 = 1.

Page 17: MCA_UNIT-2_Computer Oriented Numerical Statistical Methods

Unit-2 SOLUTION OF SIMULTANEOUS LINEAR EQUATIONS

RAI UNIVERSITY, AHMEDABAD 17

7.1 Difference between direct and iterative methods:

Direct Method Iterative Method

It computes the solution to a problem in a finite number of steps.

In contrast to direct methods, iterative methods are not expected to terminate in

a number of steps.

These methods give the precise answer if they were performed in infinite

precision arithmetic.

Iterative methods form successive approximations that converge to the

exact solution in the limit.

This method takes less time for

computation when we have small system linear of equations.

This method takes long time for

calculation when we have small system of linear equations.

When we have large linear system of

equation Iterative method became more easy then direct method.

Iterative methods are better than direct

methods for solving large linear systems

e.g. Gauss elimination, LU decomposition

e.g. Gauss -Seidel method, Jacobi Method, Newton-Raphson method.

Page 18: MCA_UNIT-2_Computer Oriented Numerical Statistical Methods

Unit-2 SOLUTION OF SIMULTANEOUS LINEAR EQUATIONS

RAI UNIVERSITY, AHMEDABAD 18

8. References and website Name:

1. Higher Engineering mathematics by B.S.Grewal

2. Higher Engineering Mathematics by B.V.Ramana 3. http://www.linearequations.org/system-of-linear-equations.html#

4. http://www.mathworks.com/matlabcentral/answers/7058-are-iterative-methods-always-better-than-direct-methods-for-solving-large-linear-systems

5. http://1.bp.blogspot.com/-

pHo8nT2SKgM/UPKdqSinfSI/AAAAAAAAC9I/JZHDxmqADsg/s1600/direct_vs_indirect.png

Page 19: MCA_UNIT-2_Computer Oriented Numerical Statistical Methods

Unit-2 SOLUTION OF SIMULTANEOUS LINEAR EQUATIONS

RAI UNIVERSITY, AHMEDABAD 19

EXERCISE

Q-1 Evaluate the following questions:

1. Solve the following system of linear equation

π‘₯ + 4𝑦 = βˆ’10 , 3π‘₯ βˆ’ 𝑦 = 9

2. Solve the following system of linear equation

3π‘₯ + 7𝑦 = 15,5π‘₯ + 2𝑦 = βˆ’4

3. Show that the non Homogeneous system of linear equation are not

consistant.

2π‘₯ + 6𝑦 = βˆ’11

6π‘₯ + 20𝑦 βˆ’ 6𝑧 = βˆ’3

6𝑦 βˆ’ 18𝑧 = βˆ’1

4. Test the consistency of the following equations and solve them if possible.

3π‘₯ + 3𝑦 + 3𝑧 = 1

π‘₯ + 2𝑦 = 4

10𝑦 + 3𝑧 = βˆ’2

2π‘₯ βˆ’ 3𝑦 βˆ’ 𝑧 = 5

Q-2 Evaluate the following questions:

1. Solve the following equations by Gauss elimination method:

2π‘₯ + 𝑦 + 𝑧 = 10

3π‘₯ + 2𝑦 + 3𝑧 = 18

π‘₯ + 4𝑦 + 9𝑧 = 16

2. Solve the following equations by Gauss elimination method:

2π‘₯ βˆ’ 𝑦 + 3𝑧 = 9

Page 20: MCA_UNIT-2_Computer Oriented Numerical Statistical Methods

Unit-2 SOLUTION OF SIMULTANEOUS LINEAR EQUATIONS

RAI UNIVERSITY, AHMEDABAD 20

π‘₯ + 𝑦 + 𝑧 = 6

π‘₯ βˆ’ 𝑦 + 𝑧 = 2

3. Solve the following equations by Gauss-Seidel method:

2π‘₯ + 𝑦 + 6𝑧 = 9

8π‘₯ + 3𝑦 + 2𝑧 + 13 = 0

π‘₯ + 5𝑦 + 𝑧 = 7

4. Solve the following equations by Gauss-Seidel method:

28π‘₯ + 4𝑦 βˆ’ 𝑧 = 32

π‘₯ + 3𝑦 + 10𝑧 = 24

2π‘₯ + 17𝑦 + 4𝑧 = 35

Page 21: MCA_UNIT-2_Computer Oriented Numerical Statistical Methods

Unit-2 SOLUTION OF SIMULTANEOUS LINEAR EQUATIONS

RAI UNIVERSITY, AHMEDABAD 21