Solution of System of Nonlinear
Equations: Newton-Raphson
Method
Lecture-1
1
Objective:
Solve the system of nonlinear equations to find roots of the
system.
Methodologies:
Two methods can be used to find roots of system of nonlinear
equations. They are
1. Newton-Raphson Method
2. Fixed Point Iteration Method
2
Newton-Raphson Method
To find the root of nonlinear equation in one variable f(x)=0,
Newton-Raphson formula can be written as follows:
f ( xn )
xn +1 = xn -
f ¢( xn )
For a system fi ( X ) Newton-Raphson formula in a matrix form
that can be written by introducing inverse of Jacobian matrix as
follows:
X n +1 = X n - J n-1F ( X n ) Eq.(1)
Where
X Variables matrix
F(X ) Function matrix
J -1 ( X ) Inverse of Jacobian matrix
3
Variables matrix can be Function matrix for n equations
written for n variables as can be written:
follows:
æ f1 ( x1 x2 ... xn ) ö
æ x1 ö ç ÷
ç ÷
x2 ÷ ç f 2 ( x1 x2 ... xn ) ÷
X = ç F =ç Eq.(3)
............................... ÷
Eq.(2)
ç: ÷
ç ÷ ç ÷
è xn ø ç f ( x x ... x ) ÷
è n 1 2 n ø
f1 ( x1 x2 ... xn ) = 0
While non-linear system f 2 ( x1 x2 ... xn ) = 0 Eq.(4)
of equations are
.....................................
f n ( x1 x2 ... xn ) = 0
Adj ( J )
Inverse of Jacobian matrix: J -1 ( X ) = ; Det ( J ) ¹ 0 Eq.(5)
Det ( J )
4
Jacobian matrix Lets calculate
æ ¶f1 ¶f1 ¶f1 ö ¶f1 ¶f1 ¶f1
... ...
ç ¶x ¶x ¶xn ÷ ¶x1 ¶x2 ¶xn
ç 1 2 ÷
ç ¶f 2 ¶f 2 ¶f 2 ÷ ¶f 2 ¶f 2 ¶f 2
... ...
ç ¶xn ÷÷ Det ( J ) = J = ¶x1 ¶x2 ¶xn Eq.(7)
J ( x1 , x2 ,.., xn ) = ç ¶x1 ¶x2 Eq.(6)
ç ............................... ÷ ...............................
ç ÷ ¶f n ¶f n ¶f n
ç ¶f n ¶ f n ¶ f n ÷ ...
ç ¶x ¶x ... ¶x ÷ ¶x1 ¶x2 ¶xn
è 1 2 n ø
æ A11 A21 ... An1 ö
ç ÷
A A ... A
Adjacent matrix of J(X), Adj ( J ) = ç 12 22 n 2 ÷ Eq.(8)
ç ............................... ÷
ç ÷
è A1n A2 n ... Ann ø
Where Aij (i=1,2,…,n; j=1,2,3,…,n) are cofactors of the
determinant of J
5
Perform 1st iteration of Newton-Raphson method, substitute
guess value initially in formula given in Eq.(1) , then we get x1
Further iterations can be done by updating initialized value,
i.e., updating x0 by x1.
6
Advantages and Drawbacks: Newton-Raphson Method
Advantages of Newton-Raphson Method:
q Converges fast if it converges
q Requires one guess only
Drawbacks of Newton-Raphson Method
q Division by Zero
q Root Jumping
q Oscillations near Local Maxima or Minima
q Inflection Point Issues
7
Problems and Solutions
Example # : Consider the systems
x 2 + xy - 7 = 0
y3 - 2 x + 4 = 0
1. Find Jacobian matrix for the above system
2. Evaluate the inverse of the Jacobian matrix at (1.5, −1).
3. Write down the iterative formula for the above system based
on the Newton-Raphson method.
4. Estimate the root to 3 decimal point using the using the above
iterative formula once starting with x0 = 1.5 and y0 = -1.
5. Write down MATLAB commands to execute the iteration seven
times.
6. Use MATLAB function “fsolve(fun,x0)” to find the above root.
8
Example
1. Find Jacobian matrix for the following system
x 2 + xy - 7 = 0
y3 - 2 x + 4 = 0
æ x 2 + xy - 7 ö
Functions matrix is written by using Eq. (3), F ( X ) = çç 3 ÷÷
è y - 2x + 4 ø
æ 2x + y x ö
Therefore, Jacobian, J ( x, y ) = ç 2÷
[using Eq. (6)]
è -2 3y ø
2. Evaluate the inverse of the Jacobian matrix at (𝟏. 𝟓, −𝟏).
æ 2x + y x ö æ 2 1.5 ö
At point (1.5,-1), Jacobian, J ( x, y ) = ç 2÷
=ç ÷
è -2 3 y ø è -2 3 ø
Using Eq. (7), we obtain determinant of Jacobian at point (1.5,-1).
Hence, det( J ) = 6 + 3 = 9 ¹ 0
9
æa b ö
If A be a 2 by 2 matrix, say, A = ç ÷
è c d ø
Then, inverse matrix can be calculated by the following formula
1 æ d
-1 -bö
A = ç ÷
A è -c a ø
So, æ 2 1.5 ö æ a bö
J =ç ÷=ç ÷
è -2 3 ø è c dø
-1 1æ 3 - 1.5 ö æ 0.3333 - 0.1666 ö
J = ç ÷=ç ÷
9è 2 2 ø è 0.2222 0.2222 ø
10
3. Write down the iterative formula for the above system based
on the Newton-Raphson method.
The iterative formula for the system of nonlinear equations is
X n +1 = X n - J n-1 F ( X n ) [Using Eq. (1)]
æ xn ö
Where X = ç ÷ [Using Eq. (2)]
è yn ø
4. Estimate the root to 3 d.p. using the using the above
iterative formula once starting with x0 = 1.5 and y0 = -1.
We have, x0 = 1.5 and y0 = -1. Using n = 0 in Eq.(1), we obtain
X 1 = X 0 - J 0-1 F ( X 0 ) Eq.(9)
11
æ x02 + x0 y0 - 7 ö æ (1.5)2 + (1.5 ´ (-1)) - 7 ö æ -6.25 ö
F ( x0 ) = ç 3 = ÷÷ = ç
ç y - 2 x + 4 ÷÷ çç (-1)3 - 2(1.5) + 4 0.00
÷
è 0 0 ø è ø è ø
Eq. (9) become
æ x1 ö æ x0 ö æ 0.3333 - 0.1666 öæ -6.25 ö
ç ÷ = ç ÷-ç ÷ç ÷
è y1 ø è y0 ø è 0.2222 0.2222 øè 0.00 ø
æ x1 ö æ1.5 ö æ 0.3333 - 0.1666 öæ -6.25 ö
Þ ç ÷ = ç ÷-ç ÷ç ÷
y -
è 1ø è ø è1 0.2222 0.2222 øè 0.00 ø
æ x1 ö æ 3.583125 ö æ 3.583 ö
Þç ÷=ç ÷ =ç ÷
y
è 1ø è 0.38875 ø è 0.388 ø
12
æ x 2 + xy - 7 ö
5. Define given functions as follows: F ( x, y ) = çç 3 ÷÷
æ 2x + y x ö è y - 2x + 4 ø
Jacobian, J ( x, y ) = ç 2÷
è -2 3 y ø
Program code:
clear all
close all
clc;
F=@(x,y) [x.^2+x.*y-7; y.^3-2.*x+4]; Output:
J=@(x,y)[2.*x+y, x; -2, 3.*y.^2];
x(1)=1.5; Roots =
y(1)=-1; x y
for n=1:7 1.5000 -1.0000
Xn=[x(n); y(n)]; 3.5833 0.3889
Fn=F(x(n), y(n)); 2.2224 1.2397
Jn=J(x(n), y(n)); 2.2239 0.9236
Xn1=Xn-Jn\Fn; 2.2655 0.8232
x(n+1)=Xn1(1); 2.2698 0.8142
y(n+1)=Xn1(2); 2.2698 0.8141
end 2.2698 0.8141
Roots=[x',y'] 13
6. Find above root by using MATLAB function
Program code:
clear all
close all
clc;
% Left_hand side of equations as vector
F=@(x) [x(1)^2+x(1)*x(2)-7; x(2)^3-2*x(1)+4];
% Guess solution
x0=[1.5; -1];
% Solve the system
x=fsolve(F, x0)
Output:
x = 2.2698
Y = 0.8141
14
Outcome
By applying Newton-Raphson method, system of nonlinear
equations can be solved to find roots (approximately) of the
system, although it has few drawbacks.
15
Multiple questions:
S.No. Questions
1 Newton-Raphson Method is-
(a) Closed method, (b) Open method, (c) Bracketing method
2 What type of solution could be by applying Newton-Raphson method?
(a) Analytical solution, (b) Numerical solution
3 Newton-Raphson method can be used to find roots of the following system of
equations:
(a) Linear equations , (b) Non-linear equations , (c) both (a) and (b)
4 Jacobian matrix should be
(a) m×𝑚 order, (b) m×𝑛 order
5 Which formula can be used to find a root of the system of nonlinear equations
$#
(a) 𝑋!"# = 𝑋! − 𝐽! 𝐹 𝑋! , (b) 𝑋!"# = 𝑋! − 𝐹 𝑋! /𝐹 % (𝑋! )
6 Inverse matrix is in
(a) m×𝑚 order, (b) m×𝑛 order
7 How many guess value requires for applying Newton-Raphson method to find roots
of equations
(a) one, (b) many
16
S.No. Questions
8 In Newton-Raphson formula, convergence fast if
a) It converges, (b) it doesn’t converges
9 Inverse matrix exist if
(a) Determinant of matrix is zero, (b) Determinant of matrix is non-zero
10 Find Jacobian of the following system of nonlinear equations:
𝑓 = 𝑥 & + 𝑥𝑦 ' + 𝑥 − 1
𝑔 = 𝑥 & + 𝑦 & + 𝑥𝑦
3𝑥 ' + 𝑦 ' + 1 2𝑥𝑦 3𝑥 ' − 𝑦 ' + 1 2𝑥𝑦
(a) 𝐽 = , (b) 𝐽 = ,
3𝑥 ' + 𝑦 𝑥 + 3𝑦 ' 3𝑥 ' − 𝑦 𝑥 + 3𝑦 '
(b) (c) both (a) and (b)
11 At the point x=1, y=2, what will be the value of Jacobian in question (10)?
13 4 8 4
(a) 𝐽 = , (b) 𝐽 = , (c) both (a) and (b)
5 8 5 13
17
Exercise
# Consider the following systems
x2 + x2 y 2 - 7 = 0
y 3 - 2 xy + 4 = 0
1. Find Jacobian matrix for the above system
2. Evaluate the inverse of the Jacobian matrix at (2.5, −2).
3. Write down the iterative formula for the above system based
on the Newton-Raphson method.
4. Estimate the root to 3 decimal point using the using the above
iterative formula once starting with x0 = 2.5 and y0 = -2.
5. Write down MATLAB commands to execute the iteration eight
times.
6. Use MATLAB function “fsolve(fun,x0)” to find the above root.
18
References
[1] Applied Numerical Methods With Matlab for Engineers and Scientists ( Steven
C.Chapra).
[2] Applied Numerical Analysis – C.F.Gerald & P.O.Wheatley, 7th Edition, 2003,
Pearson Education Limited, USA.
[3] Numerical Analysis & Computing – W. Cheney & D. Kincaid, 6th Edition, 2007,
Cengage Learning, Inc, USA.
[4] Numerical Analysis – J. Douglas Faires , Annette Burden , Richard Burden, 10th
Edition, 2015, Cengage Learning, Inc, USA.
19