You are on page 1of 37

Chapter 2

Root finding

Dr. Gokul K. C.
Department of Mathematics,
School of Science,
Kathmandu University, Nepal
Email: gokul.kc@ku.edu.np

Numerical Methods (MCSC 202)

1 / 37
Objective
To find the roots of equation

f (x) = 0 (1)

Where, f (x) may be algebraic or transcendental equations.

For eg: f (x) = x 3 − x − 1, f (x) = sin(x) + 3x, f (x) = x − 1 + e x etc.


Generally, root finding methods broadly classified into two parts:

Classification of root finding methods


Bracketing methods
1 Bisection method
2 False position method
Open methods
1 Secant method
2 Newton Raphson method
3 Iteration method

2 / 37
Bisection Method
Let a and b be chosen such that f (a) × f (b) < 0. i.e. either
f (a) > 0, f (b) < 0 or f (a) < 0, f (b) > 0. The root lies on [a, b].
If x1 be initial approximation then compute x1 = (a + b)/2.
If f (x1 ) = 0, x1 is the desired root. If not then f (x1 ) < 0 or f (x1 ) > 0.
If f (x1 ) × f (a) < 0, then the root lies on [x1 , a] otherwise on [x1 , b].
Let the root lies on [x1 , b] and this new interval is denoted by [a1 , b1 ] such
that |b1 − a1 | = |b − a|/2.
Now, the next approximation is x2 = (x1 + b)/2.
If f (x2 ) = 0 thenx2 is the required root. If not, the root lies either on
[x1 , x2 ] or on [x2 , b]
Let the root lies on [x1 , x2 ] such that x3 = (x1 + x2 )/2
If this new interval is denoted by [a2 , b2 ], then |b2 − a2 | = |b1 − a1 |/2 = |b−a|
22
After nth approximation, the interval [an , bn ] be such that |bn − an | = |b−a|2 .
n

The computation can be terminated if the error |bn − an | becomes less than
prescribed tolerance(or error()). That is,
|bn − an | = |b−a|
2n ≤ . On simplification gives, n ≥
ln(|b−a|/)
ln2

3 / 37
4 / 37
Bisection Method

Computatioal Steps
1 Input: Function(f (x)), tolerance() and initial approximations (a) and
(b), such that f (a) × f (b) < 0.
2 Compute x = (a + b)/2.
3 If f (x) × f (a) < 0, the root lies on [x, a], set b = x and go to step 2.
4 If f (x) × f (b) < 0, the root lies on [x, b], set a = x and go to step 2.
5 Repeat steps 2-4 until |b − a| <  or |f (x)| < 

5 / 37
Example
Solve using bisection method the equation x 3 − x − 1 = 0, correct to 4
decimal places.

Given: f (x) = x 3 − x − 1,
Tolerance=4 decimal places
 = 1/2 × 10−4 = 0.00005
Let a = 1 such that f (a) = f (1) = −1 < 0
and b = 2 such that f (b) = f (2) = 5 > 0.
Total steps required: (n) ≥ ln(|2 − 1|/0.00005)/ln(2) = 14.28
ThereforeTotal steps required: (n) ≈ 15
Our first approximation is
x = (b + a)/2 = (2 + 1)/2 = 1.5.
Further calculations are tabulated below:

6 / 37
f (a) < 0(−) f (b) > 0(+)
n a b x f(x) Remarks
1 1 2 1.5 0.87 f (x) > 0, replace b by x
2 1 1.5 1.25 -0.29 f (x) < 0, replace a by x
3 1.25 1.5 1.375 0.22 f (x) > 0, replace b by x
4 1.25 1.375 1.3125 -0.05 f (x) < 0, replace a by x
5 1.3125 1.3750 1.3438 0.08 f (x) > 0, replace b by x
6 1.3125 1.3438 1.3281 0.01 f (x) > 0, replace b by x
7 1.3125 1.3281 1.3203 -0.01 f (x) < 0, replace a by x
8 1.3203 1.3281 1.3242 -0.00 f (x) < 0, replace a by x
9 1.3242 1.3281 1.3262 0.00 f (x) > 0, replace b by x
10 1.3242 1.3262 1.3252 0.00 f (x) > 0, replace b by x
11 1.3242 1.3252 1.3247 -0.00 f (x) < 0, replace a by x
12 1.3247 1.3252 1.3250 0.00 f (x) > 0, replace b by x
13 1.3247 1.3250 1.3248 0.00 f (x) > 0, replace b by x
14 1.3247 1.3248 1.3248 0.00 f (x) > 0, replace b by x
Exercise: Find a root, correct to three decimal places of the function
xe x − 1 = 0 Ans : 0.5671

7 / 37
False position method

Let a and b be chosen such that f (a) × f (b) < 0. i.e. either
f (a) > 0, f (b) < 0 or f (a) < 0, f (b) > 0. The root lies on [a, b].
Now, the equation of chord joining (a, f (a)) and (b, f (b)) is given by
y − f (a) = f (b)−f
b−a
(a)
(x − a)
If this chord intersects X-axis at (x1 , 0), we have
0 − f (a) = f (b)−f
b−a
(a)
(x1 − a)
Simplifying, We get first approximation,
f (a) af (b)−bf (a)
x1 = a − f (b)−f (a) (b − a) = f (b)−f (a)
If f (x1 ) = 0, x1 is the desired root. If not then f (x1 ) < 0 or f (x1 ) > 0.
If f (x1 ) × f (a) < 0, then the root lies on [x1 , a] otherwise on [x1 , b].
Let the root lies on [x1 , b], the next approximation(x2 ) is
x2 = x1ff(b)−f
(b)−bf (x1 )
(x1 )
and so on.

8 / 37
9 / 37
False position method

Computatioal Steps
1 Input: Function(f (x)), tolerance() and initial approximations (a) and
(b), such that f (a) × f (b) < 0.
af (b)−bf (a)
2 Compute x = f (b)−f (a)
3 If f (x) × f (a) < 0, the root lies on [x, a], set b = x and go to step 2.
4 If f (x) × f (b) < 0, the root lies on [x, b], set a = x and go to step 2.
5 Repeat steps 2-4 until |xn − xn−1 | <  or |f (x)| < 

10 / 37
Example
Solve using false position method the equation x 3 − x − 1 = 0, correct to 4
decimal places.

Given: f (x) = x 3 − x − 1, Tolerance=4 decimal places,


 = 1/2 × 10−4 = 0.00005
Let a = 1 such that f (a) = f (1) = −1 < 0 and b = 2 such that
f (b) = f (2) = 5 > 0.
Our first approximation is x = aff (b)−bf (a)
(b)−f (a) =
1×5−2×(−1)
5−(−1) = 1.1667. Further
calculations are tabulated below:
n a(-) b(+) x f(x)
1 1 2 1.1667 -0.5787
2 1.1667 2 1.2531 -0.2854
3 1.2531 2 1.2934 -0.1295
Exercise: Find a root,
4 1.2934 2 1.3113 -0.0566
correct to three decimal
5 1.3113 2 1.3190 -0.0243
places of the function
6 1.3190 2 1.3223 -0.0104
2x = log10 x + 7
7 1.3223 2 1.3237 -0.0044
Ans:3.789
8 1.3237 2 1.3243 -0.0019
9 1.3243 2 1.3245 -0.0008
10 1.3245 2 1.3246 -0.0003
11 1.3246 2 1.3247 -0.0001 11 / 37
Secant method

Let a and b be two initial approximations.


The equation of secant line passing through (a, f (a)) and (b, f (b)) is
given by y − f (a) = f (b)−f
b−a
(a)
(x − a)
If this secant line intersects X-axis at (x1 , 0), we have
0 − f (a) = f (b)−f
b−a
(a)
(x1 − a)
Simplifying, We get first approximation,
f (a) af (b)−bf (a)
x1 = a − f (b)−f (a) (b − a) = f (b)−f (a)
If f (x1 ) = 0, x1 is the desired root.
x1 f (b)−bf (x1 )
If not,the next approximation(x2 ) is x2 = f (b)−f (x1 )
and so on.

12 / 37
13 / 37
Secant method

Computatioal Steps
1 Input: Function(f (x)), tolerance() and initial approximations (a) and
(b).
af (b)−bf (a)
2 Compute x = f (b)−f (a)
3 Set a = b and b = x.
4 Repeat steps 2-3 until |xn − xn−1 | <  or |f (x)| < 

14 / 37
Example
Solve using secant method the equation x 3 − x − 1 = 0, correct to 4
decimal places.

Given: f (x) = x 3 − x − 1, Tolerance=4 decimal places,


 = 1/2 × 10−4 = 0.00005
Let a = 1 and b = 2 such that f (a) = f (1) = −1 and f (b) = f (2) = 5. Our
first approximation is x = aff (b)−bf (a)
(b)−f (a) =
1×5−2×(−1)
5−(−1) = 1.1667. Further
calculations are tabulated below:
n a b x
1 1 2 1.1667
2 2 1.1667 1.2531
3 1.1667 1.2531 1.3372
4 1.2531 1.3372 1.3239
5 1.3372 1.3239 1.3247
Exercise: Find a root, correct to three decimal places of the function
4e −x sin x = 1. Ans : 0.370697

15 / 37
Newton-Raphson method
Let x0 be an approximate root of f (x) = 0 and let x1 = x0 + h be the exact
root such that f (x1 ) = f (x0 + h) = 0.
Expanding f (x0 + h) = 0 by Taylor’s series, we obtain
h2 00
f (x0 + h) = f (x0 ) + hf 0 (x0 ) +
f (x0 ) + · · · = 0 (2)
2!
Neglecting the second and higher order derivatives, we have
f (x0 )
f (x0 ) + hf 0 (x0 ) = 0, h = − (3)
f 0 (x0 )
Substituting the value of h in x1 , we get first approximation
f (x0 )
x1 = x0 − (4)
f 0 (x0 )
After nth approximation, we have
f (xn )
xn+1 = xn − (5)
f 0 (xn )
Which is the Newton-Raphson formula
16 / 37
Method of tangent

17 / 37
Newton-Raphson method

Computatioal Steps
1 Input: Function(f (x)), Derivative of function(f 0 (x)), tolerance() and
initial approximation(a)
f (a)
2 Compute x = a − f 0 (a)
3 Set a = x.
4 Repeat steps 2-3 until |xn − xn−1 | <  or |f (x)| < 

Generalized Newton’s method


If x = a is a root of f (x) = 0 with multiplicity p (Repeated root p times),
then the iteration formula for Newton-Raphson method is given by the
following equation:
f (xn )
xn+1 = xn − p 0 (6)
f (xn )

18 / 37
Example
Solve using Newton-Raphson method the equation x 3 − x − 1 = 0, correct
to 4 decimal places.

Given: f (x) = x 3 − x − 1 and f 0 (x) = 3x 2 − 1


Tolerance = 4 decimal places,  = 1/2 × 10−4 = 0.00005
Let a = 1 such that f (a) = f (1) = −1 and f 0 (a) = f 0 (1) = 2.
Then the first approximation is x = a − ff0(a) (−1)
(a) = 1 − 2 = 1.5.
Further calculations are tabulated below:

n a x
1 1 1.5
2 1.5 1.3478
3 1.3478 1.3252
4 1.3252 1.3247

Exercise: Find a root, correct to three decimal places of the function


2x − 3 = cos x Ans : 1.524
Exercise: Find a double root correct to 4 decimal places of the function
f (x) = x 3 − x 2 − x + 1 = 0
19 / 37
Iteration method

Given equation,
f (x) = 0 (7)
Rewriting equation (7) in the form

x = g (x) (8)

If x0 be initial approximation then substituting in (8), we get

x1 = g (x0 ) (9)

Substituting updated value successively in (8), after nth approximation, we


get the general formula:
xn+1 = g (xn ) (10)
Convergent Criteria
|g 0 (x)| < 1 (11)

20 / 37
Fixed point iteration method

Convergent function (g (x)) Divergent function (g (x))

21 / 37
Fixed point iteration method

Computatioal Steps
1 Input: Function(f (x)), Function(g (x)), tolerance() and initial
approximation(a)
2 Compute x = g (a)
3 Set a = x.
4 Repeat steps 2-3 until |xn − xn−1 | <  or |f (x)| < 

22 / 37
Example
Solve using Iteration method the equation x 3 − x − 1 = 0, correct to 4
decimal places.

Given: f (x) = x 3 − x − 1,Tolerance = 4 decimal places,


 = 1/2 × 10−4 = 0.00005
The possible choices for g(x) are
√ q
g (x) = x 3 + 1 OR g (x) = 3 x + 1 OR g (x) = x 21−1 OR g (x) = x+1 x
√ q
Let us choose g (x) = 3 x + 1 Again if g (x) = x+1 x
and a = 1 such that√ and a = 1 such thatq
x1 = g (a) = g (1) = 3 2 = 1.2599 x1 = g (a) = g (1) = 21 = 1.4142
x2 = g (1.2599) = 1.3123 x2 = g (1.4142) = 1.3066
x3 = g (1.3123) = 1.3224 x3 = g (1.3066) = 1.3287
x4 = g (1.3224) = 1.3243 x4 = g (1.3287) = 1.3239
x5 = g (1.3243) = 1.3246 x5 = g (1.3239) = 1.3249
x6 = g (1.3246) = 1.3247 x6 = g (1.3249) = 1.3247
If we choose g (x) = x + 1 OR g (x) = x 21−1 , then what happens?
3

Exercise: Find a root, correct to three decimal places of the function


sin x = 10(x − 1) Ans : 1.089
23 / 37
Solution to systems of non-linear equations
Iteration Method
Consider the system of two non-linear equations:

f (x, y ) = 0
g (x, y ) = 0
Convergent Criteria
Rewriting the equation in the form:

∂F ∂F
x = F (x, y ) y = G (x, y ) ∂x ∂y < 1
+
OR
∂G ∂G

x = G (x, y ) y = F (x, y ) ∂x ∂y < 1
+

If (x0 , y0 ) be an initial approximation to the root (α, β), then we get,


x1 = F (x0 , y0 ) y1 = G (x0 , y0 )
x2 = F (x1 , y1 ) y2 = G (x1 , y1 )
.. ..
. .
xn+1 = F (xn , yn ) yn+1 = G (xn , yn )
24 / 37
Exampale
Exmaple: Find a real root of the equations y 2 − 5y + 4 = 0 and
3yx 2 − 10x + 7 = 0 correct to 4 decimal places using initial approximation
(0, 0)

Rewriting the equations in the form:


s
3yx 2 + 7 y2 + 4 10x − 7 p
x= ,y = OR x= , y = 5y − 4
10 5 3y

n x y n x y
1 0.70000 0.80000 8 0.99001 0.99972
2 0.81760 0.92800 9 0.99395 0.99989
3 0.88610 0.97224 10 0.99635 0.99996
4 0.92901 0.98905 11 0.99780 0.99998
5 0.95608 0.99564 12 0.99868 0.99999
6 0.97303 0.99826 13 0.99920 1.00000
7 0.98354 0.99931 14 0.99952 1.00000

Exercise: solve the system: x 2 + y = 11, x + y 2 = 7.


25 / 37
Newton-Raphson Method
Consider the system of two non-linear equations:

f (x, y ) = 0
g (x, y ) = 0

Let (x0 , y0 ) be initial approximation and let (x1 = x0 + h, y1 − y0 + h) be the


exact root such that
f (x1 , y1 ) = f (x0 + h, y0 + k) = 0, g (x1 , y1 ) = g (x0 + h, y0 + k) = 0
Expanding r.h.s using Taylor’s series, we obtain
∂f ∂f
f (x0 + h, y0 + k) = f (x0 , y0 ) + h +k + ··· = 0
∂x ∂y
∂g ∂g
g (x0 + h, y0 + k) = g (x0 , y0 ) + h +k + ··· = 0
∂x ∂y
Neglecting the second and higher order derivatives, we have
∂f ∂f
h +k = −f (x0 , y0 )
∂x ∂y
∂g ∂g
h +k = −g (x0 , y0 )
∂x ∂y
26 / 37
Solving using Cramer’s rule, we get

∂f ∂f −f ∂f ∂f
−f0
∂x0 ∂y0 0 ∂y0 ∂x0
D = ∂g ∂g 6= 0, D1 = , D2 =

∂g ∂g
−g0 −g0

∂x0 ∂y0 ∂y0
∂x0

Now,
D1 D2
h= , k=
D D
The new approximations are, therefore,

x1 = x0 + h, y1 = y0 + k

After nth approximation, we get the general formula

xn+1 = xn + h, yn+1 = yn + k

27 / 37
Exampale
Exmaple: Find a real root of the equations 3yx 2 − 10x + 7 = 0 and
y 2 − 5y + 4 = 0 correct to 4 decimal places using initial approximation (0, 0)

Given, f (x, y ) = 3yx 2 − 10x + 7 = 0, g (x, y ) = y 2 − 5y + 4 = 0


∂f ∂f 2 ∂g ∂g
Then, ∂x = 6yx − 10, ∂y = 3x , ∂x = 0, ∂y = 2y − 5
∂f ∂f ∂g ∂g
x y f g D D1 D2 h k
∂x ∂y ∂x ∂y
D1 D2
a b c d ad − bc −fd + gb −ga + fc
D D
0.000 0.000 7.000 4.000 -10.000 0.000 0.000 -5.000 50.000 35.000 40.000 0.700 0.800
0.700 0.800 1.176 0.640 -6.640 1.470 0.000 -3.400 22.576 4.939 4.250 0.219 0.188
0.919 0.988 0.315 0.035 -4.552 2.532 0.000 -3.024 13.764 1.042 0.161 0.076 0.012
0.994 1.000 0.022 0.000 -4.033 2.967 0.000 -3.000 12.101 0.067 0.001 0.006 0.000
1.000 1.000 0.000 0.000 -4.000 3.000 0.000 -3.000 12.000 0.000 0.000 0.000 0.000

Exercise: solve the system: x 2 − y 2 = 4, x 2 + y 2 = 16.

28 / 37
System of linear equations
Consider a system of linear equations:

a11 x1 + a12 x2 + a13 x3 = b1


a21 x1 + a22 x2 + a23 x3 = b2
a31 x1 + a32 x2 + a33 x3 = b3 (12)
This system(12) can be represented by matrix equation

AX = B (13)
     
a11 a12 a13 x1 b1
Where, A =  a21 a22 a23 , X =  x2 , B =  b2 
a31 a32 a33 x3 b3
In this chapter, we will study the following 3 methods to solve linear
system.
Iterative methods
LU decomposition method
Tri-diagonal system
29 / 37
Iteration methods
Consider a system: Same initial set is used in (∗∗) to
a11 x1 + a12 x2 + a13 x3 = b1 update next value.
a21 x1 + a22 x2 + a23 x3 = b2 · · · (∗) Gauss Seidel method
a31 x1 + a32 x2 + a33 x3 = b3 Let (x10 , x20 , x30 ) be initial approxi-
If the coefficient matrix of (∗) is diag- mation. Substituting (x10 , x20 , x30 ) in
onally dominant, i.e. a11 > a12 + a13 , first equation of (∗∗) to get x11 .
a22 > a21 + a23 , a33 > a31 + a32 , then we Again, substituting (x11 , x20 , x30 ) in
can solve using iterative methods. second equation to get x21 and fi-
Rewriting (15) in the form: nally (x11 , x21 , x30 ) in third equation
x1 = b1
a11 − a12
a11 x2 − a13
a11 x3
to get x31 and so on.
b2 a21 a23 Updated values of previous steps
x2 = a22 − a22 x1 − a22 x3 · · · (∗∗) are used in (∗∗) to update next
x3 = ab333 − aa31 33
x1 − aa32
33
x2 value.
Jacobi method Gauss seidel method is 2 times
Let (x10 , x20 , x30 ) be initial approxi- faster than Jacobi method.
mation. Substituting in r.h.s of Convergent criteria:
Pn aij
(∗∗) we get first update (x11 , x21 , x31 ). j=1,j6=i aii ≤ 1, i = 1, 2, · · · , n,
Again substituting (x11 , x21 , x31 ) we get where the 0 <0 sign should be valid
(x12 , x22 , x32 ) and so on. on at least one equation. 30 / 37
Jacobi method
Solve using iteration methods:
2x − y = 1
−x + 3y − z = 8
−y + 2z = −5

Rewriting,
1+y 8+x+z y −5
x= 2
, y= 3
, z= 2
Using initial approximation (0, 0, 0), the
results are tabulated below:
Gauss-Seidel method

31 / 37
Exercise
Solve using iterative methods:

10x − 2y − z − u = 3
−2x + 10y − z − u = 15
−x − y + 10z − 2u = 27
−x − y − 2z + 10u = −9

32 / 37
LU decomposition method
 
a11 a12 a13
Let A =  a21 a22 a23  be a nonsingular square matrix. Then A can be
a31 a32 a33
factorized in the form LU such that A = LU, where L is lower triangular
matrix
 and U is upper
 triangular
 matrix represented
 by:
1 0 0 u11 u12 u13
L =  l21 1 0  and U =  0 u22 u23 .
l31 l32 1 0 0 u33
Substituting A = LU in (13), we get

LUX = B (14)

If we set
UX = Y (15)
then,
LY = B (16)
Solving (16) by forward substitution, we obtain vector Y . Substituting this
Y in (15) and solving by backward substitution, we get the required
solution vector X .
33 / 37
Solve the system by LU  
decomposition 2 3 1
∴ U =  0 1/2 5/2 .
2x + 3y + z = 9
0 0 18
x + 2y + 3z = 6
3x + y + 2z = 8 Now for L, we collect all pivot
  columns from pivot element in
2 3 1 downward direction.
Given A =  1 2 3 .  
2 0 0
3 1 2  1 1/2 0 
Since 2 is a pivot element, using
3 −7/2 18
Gaussian elimination, perform
R2 = R2 − 1/2R1 , R3 = R3 − 3/2R1 Dividing every column by corre-
  sponding pivot element, we get
2 3 1  
 0 1/2 5/2  1 0 0
0 −7/2 1/2 ∴ L =  1/2 1 0 
Again, 1/2 is second pivot element, 3/2 −7 1
perform R3 = R3 + 7R2
  Never transform pivot ele-
2 3 1 ment to identity 1
 0 1/2 5/2  = U
0 0 18
34 / 37
 
9
Given, B =  6 . Now, UX = Y is:
8 
2 3 1

x
 
9

Setting UX = Y =⇒ LY = B.  0 1/2 5/2   y  =  3/2 


  0 0 18 z 5
y1
Let Y =  y2  so that LY = B is: solving using backward substitution:
y3
18z = 5 =⇒ z = 5/18
    
1 0 0 y1 9 1/2y + 5/2z = 3/2 =⇒ y = 29/18
 1/2 1 0   y2  =  6  2x + 3y + z = 9 =⇒ x = 35/18
3/2 −7 1 y3 8 
35/18

Solving using forward substitution: ∴ X =  29/18 


5/18
y1 = 9
1/2y1 + y2 = 6 =⇒ y2 = 3/2 Exercise: Find LU and solve AX = B
3/2y1 − 7y2 + y3 = 8 =⇒ y3 = 5 
3 −7 −2
 
−7

A =  −3 5
 
9 1 ,B =  5 
∴ Y =  3/2  6 −4 0 2
5

35 / 37
Tridiagonal system
Consider the system of equations defined by:

b1 x1 + c1 x2 = d1 Thomas algorithm
a2 x1 + b2 x2 + c2 x3 = d2 Set α1 = b1 and
a3 x2 + b3 x3 + c3 x4 = d3 compute
.. αi = bi − aαi ci−1
i−1
,
. i = 2, 3, · · · , n.
an−1 xn−2 + bn−1 xn−1 + cn−1 xn = dn−1 Set β1 = d1 /b1 and
an xn−1 + bn xn = dn compute
βi = di −aαi iβi−1 ,
The matrix of coefficient is i = 2, 3, · · · , n.
 
b1 c1 0 0 ··· ··· ··· 0 Set xn = βn and

 a2 b2 c2 0 ··· ··· ··· 0 
 compute
0 a3 b3 c3 ··· ··· ··· 0
xi = βi − ci αxi+1
 
  ,
 ··· ··· ··· ··· ··· ··· ··· ···  i

 0 0 0 ··· 0 an−1 bn−1 cn−1

 i = n − 1, n − 2, · · · , 1.
0 0 0 ··· 0 0 an bn

36 / 37
2. Setting β1 = d1 /b1
Solve using Thomas algorithm:
=⇒ β1 = 0/2 = 0 and compute
2x − y = 0 d2 −a2 β1 0−(−1)(0)
−x + 2y − z = 0 β2 = α2 = 3/2 =0
d3 −a3 β2 0−(−1)(0)
−y + 2z − u = 0 β3 = α3 = 4/3 =0
−z + 2u = 1 d4 −a4 β3 1−(−1)(0)
β4 = α4 = 5/4 = 4/5
The augmented matrix is:

2 −1 0 0 : 0
 3. Setting x4 = β4
 −1 2 −1 0 : 0  =⇒ x4 = 4/5 and compute
 
 0 −1 2 −1 : 0  x3 = β 3 − c3 x4
=0− (−1)(4/5)
= 3/5
α3 4/3
0 0 −1 2 : 1 c2 x3 (−1)(3/5)
x2 = β 2 − α2 =0− 3/2 = 2/5
Given i = 4, c1 x2 (−1)(2/5)
x1 = β 1 − α1 =0− 2 = 1/5
1. Setting α1 = b1
=⇒ α1 = 2 and compute
Exercise: Solve the system using
a2 c1 (−1)(−1)
α2 = b2 − α1 =2− 2 = 3/2 Thomas algorithm
a3 c2 (−1)(−1)
α3 = b3 − α2 =2− 3/2 = 4/3 3x1 − x2 = −1
α4 = b4 − a4 c3
=2− (−1)(−1)
= 5/4 −x1 + 3x2 − x3 = 7
α3 4/3
−x2 + 3x3 = 7

37 / 37

You might also like