Download as pdf or txt
Download as pdf or txt
You are on page 1of 162

MUHAMMAD MUSA BIN YUSOF

A17KA0105
SKAW - BACHELOR IN CIVIL ENGINEERING
SCHOOL OF CIVIL ENGINEERING

SSCE2393
NUMERICAL METHODS

CHAPTER 1 - 7

***There might me some errors/miscalculation in this document. Kindly, contact me through any one of the medium below if you spot the
mistake(s). Thank you.

Follow my telegram channel to find out more about what stuffs I have
regarding civil course.

http://t.me/Musa_Civil_UTM
CgePHtCnu mgrHop e1
t Yxorc;se 1.1 (Pap, 3)
Locale, t[,e root o$ the {oUouriDg nonhns*r eqruahons bu using
g raph;col rnetl.,od

o ?c+COS a- = O -) fCrT z lLt c.os x


CPS x.= -L
Q(r) Point o$ intersectibn is in
Ci, o)
fCa'Yg (b) t o
fc+) , -* + cosci)
-{ -!, _1I
2
l(o> = o+ coS (o)
=l
f(-i){(o> - _1I
z <,o
tence t e t/rt-z ,o)*
@ Stn L - ?L+ I =O =) fC");Sin e_-x + I
Sin zt = 7*-l
Poiqt o$ inlerse-ction [s in
{(rc)
(8, n)
{Ca)+Cb) < o

f Cs") -- sin (i) - s, I


"
o-Att
=

$Cn) , sin (fi) -fi + I

=
_a.\42
U=Sinz
f (tr")f Cnl = -o.414 e o
ience ,t g (!r, n) x
2 9in 7'tL : o =) Qbc) -- 2sin * - ?t
2 9fn T=?L
f(n)
J=]sinz Point of intersec,|ion is in
(-n,-i) ,o, (8, o)
(Ca1f(b) < o
tlence 4 e (-n ,-5 )
{,o X
\ e (Lr,n1

@ .Z*- | - "sin'zc = A" -) +L"d :Z*-l - €in,T


?t<-l ssihF
'
{(,)
g:Sinx- Poi61 of ;nte"e,olrbn rs in
I U=3ur--l
(t,
")
{b).f(b) ( o
{(i) = ?(\)-r- srn (L)
= - l.lt2_7
fCrrl =a(r)-I-sin(r)
= g.\25

I(iX (rr) = -\2.0 ?q Lo


llen cp tt e (\,")
s
of rqtorsechoo is in
gre'* foo Poiut
(o, r)

tbr)+Cb) L o
I Lo) = e-o-ZLo)
:I
f Cr; = {'-7L,1
= -2.602

{Co)46t). -2-6?z Lo
Aen6o t* e (o, r; x

bt = 1-zrt
{Cz") Polnt of inte.sq,ttoo is in
!,3* (- lro)
{(a)+tb) (o
{C-,) = )Gt) +3e-r - r

= -1.94e
f (o) = 2-Lo)+?e" -l
--.1 ,l-

+c-D f co; ='t-+q2 <O


Nence zt e (-t,o) X
IS€,CTION M fHO
r Eyerc\se L .2 (PaSe T)
@ SL,ow +\6\ t
-?L-l = O ).,ava 6,, rool in inle.val [r,z] . Find that root
usihg biseclion mtl\to/. St our all go.r" eolculalion in 3 de-rir"r,al places

xl =x+\ ) $Czc1=v-3-r-l
Po'nt ol inte.rsecton fs in
fc,.;
Lt,z7
l=x+1
fCa) f[b) < o

{Cr)= ts-l-l
:-l
7L f1z) = z3-z-l a;+b6
-) 2
fcl:96'r=-[ L
,l
Vlunre x* € (\,2)
!:zL!

F=x3-x-l O = o-oO5 raust hare cohstant sign (*/-)

t 41, bi ci f @) fCb;) $Cc;)


o -ooo 2. oO [,5oo - l.ooo ,
1 O 5.ooo o.S"E lxl
I \-o00 t.5oo l-a6o -t.ooo/ o.8?S -o-2q7 [x]
2 I'25 o l-5Oo \-3?5 -o-2q7 o-8?5 t o-226 Lxl
\-256 t.j?5 .?\ 3
\ _o.a\1 . O_zz1 -o.o\q txl
D

4 \ .3r3 1.775 t.\4* - o-o4q o-L25, o.o84 [x]


5 \.j13 r.s44 r.9:,e -o-o4q o -084 , o.olB [x:
G 1.3t3 \-32q l.3zl -o.ohQ t o.otg _o.ol6
[x]
7 I ,31\ 1.32q 1325 -o.ot6 o.o lg o-001 o.oo5

Etop wl'te-n \f (c;ll <e


si.lc.L If (ca) I = o.ool { o.oo5
l\ence t[e resf ?(f = C?= l'?zS x
@ Us;n g bieulba mathod {-d the .ool ol ll.,e follor,uro g e4yoltoo
ivr the Xiven rnlerval. Show all gour calcutatron in }-Aoit*al placeg

a)x-Tv =O ; o<z-( ; ._ _ ati+6


I e=o aoD 'a
) -'' z
fCrq =rL-z-L
F =X -2-x

L d; b; c; $(a;1 f(b;) f (c;\


o O.oo6 [-ooo o.5oo - l-oog., o.5oo -9-Zo1 I
Ix]
I o.5oo l.ooO )-"tO -o-2o+ O.5oo t o r55 Lxl
2 o.500 0.7UO o{.t5 -o-2o] z o.t55 -o.o23 Lxl
v o.625 0-750 0.689 _6-oLb o -155 / o06? Lxl
4 o-625 O-6Xg o.GST -o.oza O,OG? I o -oat Lxl
5 o-GL5 0,65+ 0.611l - 0.O23 o.o4 o -000 o.oo5

9;nc.e, lf(cr)l =o.ooo 1O-oO5


o

Aenc*. the .ool z* = CD = o -641 ,*


b) g* *2-% + 2c.c>s tt- - 6 = O f"t .-, .-_
rz7 ; 0, o.ods ,v2 v,
Ai+b;
*U)=*+2-n*Acos ?< -6
F=€+A-x+2cosX-6

i a; b; C6 $Ca;) f( u;) f (c,


o t.4ro 2-ooo t.600 /
.-\_fr01 o.go+ - l. o23 txl
I I.Eoo 2.O@ \.750 -\.oz3 t o -8ol - o'3or Lxl
2 r-?to 1-.OoO t-$75 -o3oE O.$OI t o4q4 Lxl
l.g?5 r.sl3 _o.bs/ o.
5 1.750 [911 ^ o.oG6 [x]
I t.g 13 l.g?5 l-g+4 -o.066 0.144 t o.06l lxl
5 l-8r 3 r.944 l -g2q -O '066 o_o6l \-o.ooz I {'o.oo5

.!,
o Venca tha root t: = O'r-" l-S2q- X
c) ?:-?C +i* -2 =O i oLt<-Ll ) L=o'oos
{C*) = ea - )L2 +?zc-2
F=S . X'+bX-T

i ai bt ci fCa;) {Cb;) $Cci)


o O-Ooo -ooo o.50o -t-ooO 2-+18 /
t o-iqq Lx)
I o-ooo o.roo o-25o -t -osg z o -8qq -o-o2g L*)
Z o-z5o o-50 o o'3?5 -o-oag O'|qq / o-43q Lxl
z o-z5o o-3?5 OStj -O.O28 O.A3q / o-Loq Lx]
4 o-a1o o -313 . o-Lgz - e-ol$ o -2o4, o-oqz Lxl
5 o25o d-z$A o-zc$ - o'O28 o -a\z' o -O?z txl

G o-25O O2b6: o-z5g -D-Ozg o-o32 :o'oa2 ( o-oo5

" .t Henca. tha .oo I 7t -- C6= O-zig *


o
@ First deterrnine t\e tnterval that contaio lhe'rool c,nr) then f,nd
thort roof ursing bisectioo rne|[gd.shourl all go*r culq.tlafioa io
3Dp
a)?re'-t=o =) f Ll = 3tea -l
?-aL
U\./ - I

x
fc.1 Poir,t o( intensection is rn

Lo, t]
f(al +(b) < o
{Co) =-l
7L f(r) --?lo,
fco)f(D =-?.\bs <o
; ?L* e (o,t)

F, gxd-t ; L ; o-oo! ) O _lv1 l

ta[ b; C; {@;1 {(u;) ik6S


O o-ooo r.ooO o.800 -l.oo6 ?,155 z t.4+3 LK]
I o.OoO o.5oo o-250 -\ .oog , 1.4+3 _o.obT Lxl
2 o-tSo o-5oO 0'3?5 -o.oTl l'473 t o.6?l Lxl
g o.2fo o"375 o-3r3 - 0-o3? o.6?l z o,294 Lxl
+ o -25o o3r3 o.212 -oo3T o-2s4, o.la2_ Lxl
5 o'L5 o o9;x2 o.26e -o.627 O-lzaz e.04t Lxl
6 o -LSo o2% 0-25g - o-031 o.o4 I o.o02 ( o.oo$
9tnce \fCcu;l = o.ooe I o.oo5
.t
0
l)enu $a rool 7t , C6 -- o.z5g x
b) \en +7r-l --O =) fC"-; = 3C+27_-l
3*= \-2*
Poiqf of interse ction iS irr
L- t,o ]
{Ca) {c6 < o
{c-t) = -l-x76
^ {(o)=z
9= I-zzc
fc-t)f Co) =-!-tq? I o
:, L* e elto)
t=\d*2{-l 3 -t{r1o j e = o-Oo5

t, aL bc ca Karl {G;) {k;)


C) -l-ooo Oooo -0.600 -l,gqc, 2.Ooo -o-lBo Lxl
l - o.5o o O .o OO - o-tTo -o.[ go 2-OOg z o.c{36 [x]
z- - o-500 -0350 -O3?5 -o.lgo o.426 t o-?tz Lxl
3 -o.5oo -o.3?5 - o-439 -o.l8o C--312 / o.060 Lxl
A -O.5oo -o.438 -O.qGq -0. [8gl ., o-o60 -0.06l Lx1

5 -o.46q - o.439 -o.454 -o.o 6l o.O6O


l:r-*3-l ( o.oo!
Since f.fCcrll
=
0.ool ( o.ooF
.l/
e
Hexz the too| # = C5=-o-454 *
c)Sin )L-Zzt +3=O =) fC^)=$nz -2t +?
Sin t-: La--3
yrzlL-3
+r,')
Poi''t ol tntuX*1,'on t9 in
Lt rzT
fCa){Cb) e o
t Ctl , \.841
f Cz):-o.oQl
fCt;P6=1 =-o'16+ < o
," x* e (t rzl

F= sin { -2t< +? j | {xLz j e=o.ao'


c d; b; cL {ut) {(b;) lG;)
o \-clo6 2ooo t.5oo l-S4l t - o.oql o.qql fr")
I \-500 2-ooO ['75o o.qqT / -o.oQ I o.4$4 Lxl
2 t.?so 2.ooo I .g?5 o.AB4 / -o,oql o-ao \ Lxl
3 1."675 2. ooo l.q3g 0 -2o11 t -o'aql 6.OST Lxl
4 l.q39 2 -ooo l.q6q o.o57 -ct.Oll z -o-ole Lxl
5 t.q?8 l.q 6q 1.q54 o.o*t t - o.ot6 o al4 Lxl
6 r-q54 l.q 6q l.1oz 6.ot4 -o-ot6 9-.o oo ( o-o oE

si nce lSccuy l , 0.ooo L O.oo5


J
L
Iluce lhe-root *, C6 = [.q62 rg
NgwtoN vauop
* €xercrge t.A (?age \5 -16)
Q fin/ the root o{ the, $ollowing eluafipn in given in{erva\ using
Newl-on rnethod. show all yorr. catcutatmn in f-o,r. olecr}nal places (4Dp)

a)13-z--l=o : t\rz) ) L,o-oaol


sal ?to=l.oooo
+
Can tals, valug in ran,O Lt rZT

fCrc) '-?L" ->t-l


$'b,-) =31-'-l

,...-ry _ x3-x- I
X=X
JX1

q t(-;
O l. c;ooo Lxl
I l' 5oo o Lxl

3 t$Lgl lxl ?,

t4 \,7247 I t
tlzt -nnl ;' Q -oao6 ( o'oo oE
5 I.3r4 ? l

Sto p iter alron wl. en W, -tt-t,-ll < 0

l\enco lha root i: = X-5--\-?z\7 ss


b) zs +)LL -7x-? = o ; [r,zl j L=O,ooo5
Sel ,Lo = l-oooo
i )c;
{Cr) = L? +%" -?* -?
o r.oooo Lrl
('(%) = Sztz +2n- -?
I 3-oooo [x]
,Xi _ $(x) 2 L-Looo Lxl
lo'r' {'(*i) 3 l.g3o2 Lxl
x?+x2 -3*-3 4 v??+s [x ]
X=X- €.
3xL +2x -g
5 t.?3zt t
\rr-*rf o.oo 0o.( o-ooo5
G t.+B2l
=

gince I t.+?zl- l'.?azr


[ = O < 0.oOD5
llence ll.e.ool 4-* TG l.?3zl ,(
= =

c)rz - 2n, - S=O ) f-t, q7 I L ro -ooo5


sot zco = Z-oooo
{C*) = )Lz -7?1} -5 L L;
('bd = 3r'- Azt o 2.o ooo t xl
I 3-z5oo t xl
2 z-91 t o t xJ
3 2-cqgo t xl
v-v-x?-zx'-5
,t r \
e
t
by, _ 4x 4 2.6q67
\xr -nol = o-oool r o. ooo E
5 2,bq'6 ]

s\qcQ, k^-alo6-z.Gqo1l o_ooot z o_ooo5


=
Hon cL +hL yaol v! = T5 = z.G4o6 *
d)tz+\t-l=o ; [-.q,-2) ) L, o-ooo5
5et xo= - 4.oooo
(C*l' tt"+?zL'-l , O L . X-r,
('C*) --?ztr + Gz-
o - 4-oooo Lx l
I -Z-Lqft Lxj
tl*it 2 -a-q6SS LxJ
Lirt = LC
II

f 'C*i I b _2.$eA4 Lxj L


X7 +?xa -l + -z-?7a4
t
Y=X- ( O.ocrots
3Y2 + 6x 5 4_.9+q+ J,"s-zrl =o.oooo
srnc,e l-t.q+a4 f 2.g? 4ta \ = 9 ( o-ooo5
l\eoee tha rool t = Ls = -2- ?744 X

e):r-coezt=e j Lo,yr) o-0 ooF


) e.=
set Lo-- o_oooo
fCzr) = >t- cogzc
i ',y,t

('CrL)=l.}Sfn2 o o-oooo Lxl


I i.oooo Lxl
{(tr,\ 2 o-a6o\ Lxl
f /Cx-5) b
1""'=Lr'' 3 o.?3e I t
X-cosx Wo-xzl =o-oooo ( o-ooo5
\./ _
'\
ru
t\-- A o-?tql
l+SrnX

lin cp. I o.+eat -o-T3ql -- o lo.aoo\


I
llenc.e the rOot ?d =L4= O-7341 {
f) ?t+Sin)c-?-a=O ) f-o,t7 i L=o-ooo:5
Sot Lo = I.OoOO
L )v;
tc,-)=?zt+sinz -e* o t .oooo Exl
+'Cl1\-- /rcosx-eiL I -o-?G64 Exl
a o-zqt\ Ix]
{crtc) o. 35e l txl
= ?
1'u' '>1:- €'crt6 e
4 0-7604 1 t
3X+s;nX -ex I \rs-*o = 0.O0OO < O.OOO5
Y= X- 5 (c-?6c,4
3+ coS X _gx J

gittcQ.t o.g 604-


O-?eo|l = o <oaool
fiUcs tha root )L* =Ts 0-3604 ,f
=

9) x-o.g-o.zsin x=o ; lo,lr] ; O=O-OOO5


Set zo: o-Oooo

fCzc)
i >L;
=L- o.B -o.z Siq ,"
('cr1= l-o-z cos>L
o o_oooo Lxl

ffi
I t -oooo [x]
*
2 o,eG45 I

o-oo 02 <o _ooo 5


3 O.q6 43 l'"*o =

v_ rz_ x-o.g_ogsinX
,\
l-o.z cosx

Sincg- \O.qGAZ-O.q 6h1l: oooo2 1o-ooos


Hence the .oot Z* = Xj= o-q6hy x
O f*a tha smallest posrlive roo| of foll owinq ectruaf ien usinsJ
Neurlon method.Show on gou. .alc,^tatirn iX ir/p
4) 3 t- ga =
g =>f Czc) =Zxr-ev Point ol ir*erserlron is in
3r" --eL Lo, t]
fCz) f(a)f 66;.o
Y=3* ,, aL
v--o
fco) = -1
{cl) >0-2917
{Co)f CD =-0.281? { O

," x! o (orl)

fr
\-- smatlest Posi+iv@ valv,o

Se* .Lo= o.oooo ; O: o.o0oS


by selliog Lo=t-oooO
{Cr.) 3x, -eT
=
7.;
{'c*1 = 6x--eL L ?L;
O o-oooo o t.oooo Lxl
;, ffi\ 2
1 -l.ooOO
_o.Dg67
r o.QlAz [x]
\:
3 _0.46qs a o.e loo ]
-x,l < L
I l*g
X=X_3x"-d A -o_4sqt 3 o-q too J
6x_ex
5 -o.45q0
#
6annot ac*eVl
Lacauiso root is
C-ve) whan set
?Co=O

Since \ootoo -o-qlool : o.oooQ z o.OoO5

l\evwo the root t = Ls' o-qtoo #


b)st" x - 2* 13 =O =) f(z) =Sr07c -2*+Z
Sin ?c =aa--3
Porntof rnterscclion rs ih
Lt,zl
f CaXCb> a o
€Ct) = \-BAIE
l(.el ---o'oqo1
f C\)f Cz) = - 0.16+o (O

,', %* e (Vz)

Se* ro= l-o O0O ) C=O-OOOS


f Cro = sio 'tt -7*+!
+'cD = (os^x -2 L
"Ll,
o t -oooo [x]
I 2-26\5, Lx]
)_ t.qAG? Lxl

X=X -
SinX -2*. +? z [-Q6zz r t
CoS X -2 l r- -r. I = o oooo(o-ooo5
I _46zzj

sincs lt.aezz-l.q,62zl = O,osoo ( o_ooo5


Venc?, the .oot f = 7-4-- ;4622o"
C) ?L2-l* +2-€* * a => fCzc) =?(-?-?v+2-€L
Z(?-?*+2 = e-L
f tr) 3=Lz$ztrz Pant o$ infe^seclion is in
V=e-L [0, r]
{ca)fCb) < o
fco) = I

{ Cr) = -e -3e?q
{b)f(t)=-o.3G?Q <o
.'. ?c* e (o r)

Sg+ Lo=o-oooo
I g=o;ooo5

{CA't-?x+a-€* i, x-,
{,CD =tt-?+e-d. o -oooo
o Lxl
o-5ooo Ix]
Vv:
I

o.6030 t,xl
e
y'-3x*2-e-' o-bgo t
X=X- 3
zx -7+{x -zst = O-Ooo0 < o.Ooo5
4 o-6040 1'*,
gince Io-eolo-o-6oqo
I = o.ooo0 <O.OaoF
Hance the "eo| z<! =
Lq = o-boqo x
d) x' r tO cos >r = O => €b) =t3+lo bs L
\O cos ?c = -7L2
fc*)
Poinl of iqfur\etl'bn iE lr)

to U =l0coSzc \,T,,J
/) Srnat[ss{ +vo
vatuo
{Ca>fCb) c o
* {ct; = 6.11$?o
+O) '-o.t6r5
f(r)fCz>=-t. o??q Lo
,'. T* e (JrZ)

9= -z]
ge.+ To= l-oooo ; e=o.Ooos

{Ca-): rc2+\o coszc 7d;


L
(b) -- 2-z''lo sin zc
o [-oOo o L*l
I t.44Bz Lxl
Y:'=":W 2. l.q6g4 txl
L
X2+\O coS X 3 r.q 681 t
Y = X- 1 \*o-r, I = o-@oo < OoooS
2X-tosiD x 4 t.qcy)
sincrL lt.n6r9-l.q6gql = o-oooo < oooo5
tlwcz the roo+ zl =4q,= l.q68q *

L
flxED POINT METH.D
* Exerciee L.G (?age 25-26)
C\he qr^ation zLA nzr*-xL-l=o has a root in Lt ,2)- Show that the
given e4,$alion cc^n be writt@n in eev\ra\ #orm of (ixed ?otnl
\tero|;sa eXuatron ?L,g(71) css tollow z

a) rt - ( ?xa +2xa +z\ b)x--(##)",


' \ [ttt +\n-\ )
c) x = (1+'rL-rL^Lz)t/4 ,\),
2L+ 3-ra ,/t
=( T )
Uso fixed poinl ltgrqtion {orrnu\or %i,+t = g(L) in qll abov@ cases lo
{rnd that roof sharling qrifh %o=l, Show atl J ov.r calcula5on in 4Dp
and Slop ite,ration aQlA" 2O itev-,atron if
lho rnelhoo\ sfill not converged-

a) + 3v+ +2{ z +2n'-tt -3 +bxq +7t =,ltt-a +2*,


tth

\ila +\*2
-rt = g*q +7t + 3
tt( A*+42-t) = Zxq +Z*" tZ
e=o,oo05 *
ZL = 3zo4 2X2 +3
= lcn)
U= 3x4 +t*+Z tt' =+ lTv\ 4zt423+4rc - I

V = ( Ate +t+x- l)-' V/ = - t (t4x3 + 4t- t) -' (tt* + h)


= - (ttx,* u)(4rcz + 4x-l)-2
g'Cn)= uv/+vtr'
+zx?+7)(rut+h)(4nt +t+x-tF, * G*+A2-lFl (tzxl + h:z)
={c,xA
ao=l t 3'(r)= g'Cl) = - O,3Z6d
I g'(r)l = ,-3 265 <l
,
aa gL*) salisf itcs convergetrcr- L x';
undrlion o \-oooo Lxl
Lrn,=(ffi) ', il,iii;,-,. "t,o
y=(3/',4+z/,2-3:\ 3 \'\241 J
'\ L4xz rAy-l ) gih6altu-x-rl 1 o.oao;/ .,, 7-,F=Lz=1.1241
xg
b) La *z* -- x+! glr-) = (*+g)t/, (a"+zfl"
L'Ltt'+Z)= t*g JJ
UV
^t'L '- 1L+9
g'(*)= dV/ +v u'
T"
*-ffi",xLL) rr= (zt+3)Ve v= (Nl+z-SUz
u'= (tt.aJ'r, (l) v,= -i@*ij 'r^ (rg
e=o.ooo| -_ -tc(Lo+z)' 76
g'(*)= -)((n"+21-e/z
A1)t ,*
?(-r.,=(g-Y'
'uc+l LrCnrzyt/z qx"+21-Uz

x =r x+-L \'" )[o=l', 9'( t) = -O...,OG


Lx'*2) lg'cr)l ' o -Zqoe 1 I

:, gCr) sa*is€res convetBene'


Ltt condihon
o .oooo L* ]
[

I r.r54? L*]
2 l-l{e4 Lxl
3 t.\LG4 t*l
4 t.\23G L xl
6 I't24'.|r,'e-Lsl<e,
6 l.tzA I J

since \l.t:41 -l.l24Zl =O.oool <o.ooo5


:. lhe .oot L* -- L6 = l.t24l
{
c) LA = b+tt -Z.t g(A = (g+x-2*r>"4
x. = (3t *-z*")V4 -- gL,o) g'cn)=
L+x ,*iro (t_ +*7
f C

Lo--lr gr(t)=-0.4460
0= o -ooo 5
l9'crl l = o'44 60 Ll
L [*r = (j rili -zztf )'/+ :. gLr) salisf res conver gencg,
condilion
x -'(?+X-zx')"0

i v-;
o t.oooo
I l.l84e
2 l.0gol
4 0l?
3 \.1 4

4 i. rolg
5 I .133q binc?- | t. tZr+o -l.tZa3\ = O.0oo ? <o.ooo5

6 I.llgo :, ll're rool t . ?Lut= l. tZ4 O 4


1 l. rz?Q

I l. tz tg

q 1.t255

lo 1.1232

\l [.1247

.\2 1. l23B

r3 \- 12la3 I
I \r,,+ -tLyl < e
r4 \. tzAo l
A) Z:tt = b+L-Lt I
3 C^)
JT
Arx-r+yv.
?La -- 3+*-t4
T -F (;) (z+tc-rt+il' (
g'c,-) -\
r - 4zs)
- r L+r-t[\Vz
"=t " J =9L*) To=1 , g'(l)= -O.arz4
lg'C}l= o-G124 < |

0--o.ooF :, 3L?L) sat;S{'es convTrgstrLe


condilion
zn,=(ry)\o
x=(ry)r"
-tL
L t
o \.ooo o
I taz47
L o.q47?
5 l-zz'ig
4 o-q$ +5
5 \4-?4
6 o.qg t 6
7 l-2356
B 0.Q?60
q 1.239?
\o oelct?
u \-2ht5
l2 0.Q658
r3 l.2A4l
r4 o.%GtZ
l5 1,7465
t6 o.QS?Z
l? I .24 85
Ig o-a{?6
rq 1.2504
20 o.q503
* Siop iieration a++er 20 iteratfovt becavse
gLrO slitl not @hv?rge
*
@ Wri+o the 4ollowing eflttfiion f(.n) =O into fixed point iteration
eguuho6 x=!bt) 0s givu-Awc| vtsing t;xeA point iteration frnd
the rocrl ol fCr")=O in giveq tnla"yo\'l and slo..ting wrtl", given Xo-
SL,ow q\\ gour calc.r\alion in 4DP.

cl) a
')L)-)t--l=o t ?L=
L+l
1L
, Lt,N t xo= 1.5
.1,

x'2t--- zL+l 9L,')= (ntt)Yz (n)-h


t= *+l u: (zt +t)Vz u'=
x--@
?L
t,
ibt+r;h
J?u V=L - /+7 V/ = -
f,x-3t"
T'Cl,) ? t1v +v v'
t

7'n
= -
,(zt+r)tzz
(rt )- r i* '^ (x*t1-tr.
Lo=1.5 i gt(r.F) = -o.l72l
{=o.ooOg
I9'(r.5)l o'l?71= 1l '
.'| gLL) salisfias
convergencp cond*r oo

Li+t =

a x; sinc& \t-3za+ -\.?zu6l *0.ooOl ( O OOOS


O l.5ooo .'. the root )L* --?L 6 -- l-2247
O
\ l.zct to
z t.z32l
t \'323\
A \.j251
5 t.3LA6
tL
6 \-Ltttl \t*,-xot
b) 2sin rz +?( =Q I sin-r l,l,z) t
) )c =
C*)-, ) Lo= |

I
.,
bg .rsing 1.,30 properhes : sin(A-0) = sinA cnsg- sing coSA
gin (fl1_2rr)= sinII?L cos2rr _ sin2Tr cos ITz
= sin Tz
2 sin(nz -zn) + x =o
sin(tI?r-21I) = -*
2
t\x-2rr -- sin-r
Ct)
x-> =|stn-'G)
* = f stn-' (t)r, = 9u)
s@=I si6-r(-t).,
g'czt)= I f t\
r JF,)T(-Z)
-t
=_\'/ t \
zr[@/ Sincg[ t.af tl -l.6g ztl=s.s.o3<ct-ooo,
.'. the root r* =L6= l-68 Lq X
Lo=l i g '[ r) = -O_ \g 39

lg,cr)l = o.ttjg 1l
,
lr l1r) satr sfres conygrg?nca
condilion
L 7i
o l-o@o
0=O.ooo$ I r.$3?3

Lir,= 2 1_6to4
ds,n-'(*)* ? \-6q65
4 t-6?+?
5 \.6$32
c l_69t6
7 t-6$2..1 ,

r;;; Itzt-xrl tE'


I '
C)%-lan ?L=O t L=,1- -l +t ) Lh ,sJ , Lo-- 4
lan r )L
I
v
'tc= lan tL
g@ = Ctan L)-l- tt +z-
l\ 9'@) = - Cr) (nan *) - Gt)t" *l
tavrr- ^)'"(sec"
^ I = - ser-L tL ,-
I .r- t
O= '
lo.vtl?L t''
tan zt ?L
I
Lo-A t gtC+1 -_ _0.6g3b
l?L'. ?c= I I
+ 7L = g(1)
'tan zc 7L I g'c\l= o'68 35 ( \

.'. 3Ca,) Sdhsfigs (rrnvmg(.Aez condi{lOn


0= o-ooo5
\
'r*'r.*,
Lc*r=
#,
X=,1 -I+X
\anX X
L V,i
o 4.oo oo
I t\6177
2 h.4q60
3
i",i;i} t"o 'Lbt <z
!
since t +-+Of4 - A.qq34 l = o_oooo lo.ooos
' .', )ho roo) zt* = Lq= A.,tfilq
#
d) 3*-€j .o ) x--{+2z- Lo,tl , %o=o
Llc +'2
J
+2zc: 9c^> = (9*+z'(3,.+z)-l
3l,a +2X = gL +27c
rO*+z) +2t-
u=*+zx at: eT+2
= ea
v , (zx+z)-l vl -- -l (zx +z\a (z)
e7+27
=9(x) t
bx+z 9'C^> = ttV +t/ t^t

=-h(t+zlc) *ex+2
(?z'tt1t" Ax+D
f,,: O-ooo5

%i*, = O*t *a'ct


;. g(t) satis{ies ohvfiLnce condi}fon
3ri +t
X-- d +2x
3x +2

t, 7L,i

o O-oooo
I o. 50 oo
z o-?568
3 o.BE36
4 o.ggq I
5 o -10 23
G o.{ o+ I
? o -q,o$q
8
-rst <z
q Z';:;:o]
'".
9inc4 [o9o qq -o.qoq 6l = o.ooo3 10 -ooo5
.'. tL'a .oot ztt= Tq=o-eOel
*
e)x-@szt=O ) 2L- coSL+itL , lO,t1 t Lo=o
J
7-z C.OS * 9(z'; =
\ Lr,oSz+z)
+?Li azc= **
*rl** g,(*) -- C-sn rr + r)
jr= f
#=gi^) ' Xo=c) : 9'@) = o.5 1\
.'. $Czc) SahSf;gS conv%rgr2kcg corrdil,.on
0= o-0005
tlr--
@s Li' +Lc
'-L+l'-

\, - cogX +f,
7

i ti
O o.Oooo
I o.5ooo
2 0.6899
3 o-?3o4
4 0.7?77
5 o.?3sq t,
6 l\?q-7'5\ e
<
ct'?310

Sinc e lo-?3qo - o.l?gql = o.oool 1 o.ooo!


:, llre rool t! = il6 = O-??1O X
+) Lt +?t* -l =o tx= I

J t*zc
, Lo, t7 t {o=O'
I
v
kb+ztL -- \ gCA= I t*,.f
1L2 (z+t) = 1 g,cn)=
"
-*(r+*i?r"
I
t- -
^tL
L+l Lo=Q: |'CO;= -O.5
z --ffi I
= gc^) \g'co)l = o.5 < I
;, gL^-) safisf,zs converyence co ndi*ion
Z=o.ooog

?Li+r =

f,= I

Jr+x

i' xt
o o-oooo
I l.Oooo
2 o.?0?l
3 0.?654
q o.a6l6
5 o_?E E4
6 o.?E 4g l
lx+-z-el < e
7 o.?EAq J

since. I 0.?54q - o q5 4gl * o.ooal ( o.ooo5


.'. th a .oot ,C! * L? = o -?b 4i x
3) Jlc -4x+2 --o t ?L=+ , [t ,zJ , Lr--l
\tt= E +Z
}bq= +z)
+(.[zc
,=fi;, =Nr) s'c,q=
+(+) tt/^
=
**'n
e ^ o.oooE 'tLo= | ; g'(l) = o.ll-i 1 t
^,- - W+2
_ .,. $(,zr) salrsfigs @nvlrE?Jce condit;on
^-c+l T
X=J7+z
+

L x_;

O t-ogoo
l o-?50 0
2 0.7165
g o-71t6

: 3:llll i'"-1,*t <

gac& o.?l o8 -o.? loq = o-o ool < o -o ooi


[ |
; lhe root f , LE = o-Tlog t
h)coSx-7xt3=o t CrS ?( +3 I rLt,2)
)dz
T t'Lo=l
,t
gL?L) (coszr- +3)
2?c= cos * +t = +
L=cos*+g g'c*) = z)
z =!c*) +(-sih
ilo=\ l g'e)= -o,A2o7
l7'ct>l , o. 4zo? ( I
L=o.ooo5 .', 3Czu) Sat,sf,'eS convergehCo cond,JOn
1t Co$ x +t
(a+r=T
X = coq X +3
2

L ,lL;

o \.og oo
I t.??o z sr nco \ t. sza5- $z lg,l = o.0oo3 I O.0Aci6
L 1.4C)1 o .',fl'rg rool 2(! =xrz= 1.52?5
T t.5945
*
4 l.4q 3l
5 l.53gg
6 1.5t60
7 l.527ta
I t'5zt?
q r.5245
Io 1.5231

il l.5z3S
\2 \,5235 Ito-rrl < L
\)z* +7* -br-F=o
IW
tL=
2x+t
,lt,z) ) ko=l
t
v
L'(z^+3) = ?tt +S lh) = (?x+S)h (zt+?iY"
q 7- ?x+5
- u= (?x+ilv" u,=
'' '|vag *G)Gt+E\b
v = (Lxrz\b r, -i()(ra+g7-3rz
L--w
lm z g(*)
=

{tA= tvvt + vvrt


= - (s*+5Y r trz1zx*gir,
2(g7r+5l
,\?/Lrr,,
W"t
e , O.ooo $
Lr--\ : g'Ct) = -o.cst\6,
?(-:..=W-
wt J zx;rg (
l9'0;\:o'o158 I

v _ t2,,G5'
l- i. g)x) satisf;gs conv}ry?lyr6g conolilron
^-J2X+?

t i{-;
o t-0000
I \.264q
L il 'l
\.26 ,
<0
3 \-z6,rJla|-L'l

since I l.zcr2 - I-2611 I = o.oool 4 o.ooo 5

:,lho roOl f =L3--t.261211


'te +en-z
, [-\,ol , Lo = -l

3r= x"+e? -A gh)= (x.+"tt-a)


+
n--- %"rr*-a = gc' 1'u) ttr+eL)
3
=
[
?C6: r. \; 9' C-t) = - O.54QO
l3l(-r)l = o'544o L l
0= o -ooo5
,'. $(zc) SaliSf;gs conv(crgutce co nd,*ion
Lirt = X-iz + eLi -,
3

X: \7rd-z
9

L 7.t
o -"l.Oo Og

I *o-zt07
L -o.3glq
3 -o.3qob I
h -o-34r3J\Lq-74ltL

Sinc4 l-o.ZaO3 r o-?qo5l =o-ooay I o-ctoog


;, lh e rool { -- oo= -0,?4o?6a
MUHAMMAD MUSA BIN YUSOF
A17KA0105

ELIMINATION METHOD
***Exercise 2.1
Solve the following 1-8 system of linear equations using
(a) Gauss elimination
(b) Gauss elimination with partial pivoting
Show your calculation in 4DP.

1 2 4 𝑥1 11 1 2 4 11 18
1. a) 4 1 −1 𝑥2 = 6 [A|b] = 4 1 −1 6 10
2 5 2 𝑥3 3 2 5 2 3 12
𝑚21 = 4/1 = 4 ; −𝑚21 𝑅1 + 𝑅2 → 𝑅2
𝑚31 = 2/1 = 2 ; −𝑚31 𝑅1 + 𝑅3 → 𝑅3

Operation: −𝑚21 𝑅1 + 𝑅2 → 𝑅2 Operation: −𝑚31 𝑅1 + 𝑅3 → 𝑅3


-4 (1) + (4) = 0 -2 (1) + (2) = 0
-4 (2) + (1) = -7 -2 (2) + (5) = 1
-4 (4) + (-1) = -7 -2 (4) + (2) = -6
-4 (11) + (6) = -38 -2 (11) + (3) = -19
-4 (18) + (10) = -62 -2 (18) + (12) = -24

1 2 4 11 18
0 −7 −17 −38 −62 𝑚32 = 1/−7 = −0.1429 ; −𝑚32 𝑅2 + 𝑅3 → 𝑅3
0 1 −6 −19 −24

Operation: −𝑚32 𝑅2 + 𝑅3 → 𝑅3
-0.1429 (-7) + (1) = 0
-0.1429 (-17) + (-6) = -8.4293 1 2 4 11 18
-0.1429 (-38) + (-19) = -24.4302 0 −7 −17 −38 −62 = [U|d]
-0.1429 (-62) + (-24) = -32.8598 0 0 −8.4293 −24.4302 −32.8595

The equivalent system is given by Ux = d,


or
1.0000𝑥1 + 2.0000𝑥2 + 4.0000𝑥3 = 11
0.0000𝑥1 − 7.0000𝑥2 − 17.0000𝑥3 = −38
0.0000𝑥1 + 0.0000𝑥2 − 8.4293𝑥3 = −24.4302
By using calculator to solve the simultaneous equation:
𝑥1 = 2.6271
𝑥2 = -1.6100 Solution: x = 𝑥̂ = (2.6271 , -1.6100 , 2.8982)
𝑥3 = 2.8982
MUHAMMAD MUSA BIN YUSOF
A17KA0105

1 2 4 𝑥1 11 1 2 4 11 18
1. b) 4 1 −1 𝑥2 = 6 [A|b] = 4 1 −1 6 10
2 5 2 𝑥3 3 2 5 2 3 12
𝑅1 ↔ 𝑅2 (𝑝𝑎𝑟𝑡𝑖𝑎𝑙 𝑝𝑖𝑣𝑜𝑡𝑖𝑛𝑔)

4 1 −1 6 10
1 2 4 11 18
2 5 2 3 12

𝑚21 = 1/4 = 0.25 ; −𝑚21 𝑅1 + 𝑅2 → 𝑅2


𝑚31 = 2/4 = 0.50 ; −𝑚31 𝑅1 + 𝑅3 → 𝑅3

Operation: −𝑚21 𝑅1 + 𝑅2 → 𝑅2 Operation: −𝑚31 𝑅1 + 𝑅3 → 𝑅3


-0.25 (4) + (1) = 0 -0.5 (4) + (2) = 0
-0.25 (1) + (2) = 1.75 -0.5 (1) + (5) = 4.5
-0.25 (-1) + (4) = 4.25 -0.5 (-1) + (2) = 2.5
-0.25 (6) + (11) = 9.5 -0.5 (6) + (3) = 0
-0.25 (10) + (18) = 15.5 -0.5 (10) + (12) = 7

4 1 −1 6 10 4 1 −1 6 10
0 1.75 4.25 9.5 15.5 𝑅2 ↔ 𝑅3 (𝑝𝑎𝑟𝑡𝑖𝑎𝑙 𝑝𝑖𝑣𝑜𝑡𝑖𝑛𝑔) 0 4.5 2.5 0 7
0 4.5 2.5 0 7 0 1.75 4.25 9.5 15.5
𝑚32 = 1.75/4.5 = 0.3889 ;
−𝑚32 𝑅2 + 𝑅3 → 𝑅3

Operation: −𝑚32 𝑅2 + 𝑅3 → 𝑅3
-0.3889 (4.5) + (1.75) = -0.0001 = 0
-0.3889 (2.5) + (4.25) = 3.2778 4 1 −1 6 10
0 4.5 2.5 0 7 = [U|d]
-0.3889 (0.0) + (9.50) = 9.5
0 0 3.2778 9.5 12.7777
-0.3889 (7.0) + (15.5) = 12.7777

The equivalent system is given by Ux = d,


or
4.0000𝑥1 + 1.0000𝑥2 − 1.0000𝑥3 = 6
0.0000𝑥1 + 4.5000𝑥2 + 2.5000𝑥3 = 0
0.0000𝑥1 + 0.0000𝑥2 + 3.2778𝑥3 = 9.5
By using calculator to solve the simultaneous equation:
𝑥1 = 2.6271
𝑥2 = -1.6102 Solution: x = 𝑥̂ = (2.6271 , -1.6102 , 2.8983)
𝑥3 = 2.8983
MUHAMMAD MUSA BIN YUSOF
A17KA0105

1.4 −3.4 8.3 𝑥1 2.4 1.4 −3.4 8.3 2.4 8.7


2. a) 3.1 7.1 −4.7 𝑥2 = 5.1 [A|b] = 3.1 7.1 −4.7 5.1 10.6
5.6 3.8 1.2 𝑥3 1.4 5.6 3.8 1.2 1.4 12
𝑚21 = 3.1/1.4 = 2.2143 ; −𝑚21 𝑅1 + 𝑅2 → 𝑅2
𝑚31 = 5.6/1.4 = 4.0000 ; −𝑚31 𝑅1 + 𝑅3 → 𝑅3

Operation: −𝑚21 𝑅1 + 𝑅2 → 𝑅2 Operation: −𝑚31 𝑅1 + 𝑅3 → 𝑅3


-2.2143 (1.4) + (3.1) =0 -4 (1.4) + (5.6) =0
-2.2143 (-3.4) + (7.1) = 14.6286 -4 (-3.4) + (3.8) = 17.4
-2.2143 (8.3) + (-4.7) = -23.0787 -4 (8.3) + (1.2) = -32
-2.2143 (2.4) + (5.1) = -0.2143 -4 (2.4) + (1.4) = -8.2
-2.2143 (8.7) + (10.6) = -8.6644 -4 (8.7) + (12) = -22.8

1.4 −3.4 8.3 2.4 8.7 17.4


0 14.6286 −23.0787 −0.2143 −8.6644 𝑚32 = = 1.1895 ; −𝑚32 𝑅2 + 𝑅3 → 𝑅3
14.6286
0 17.4 −32 −8.2 −22.8

Operation: −𝑚32 𝑅2 + 𝑅3 → 𝑅3
-1.1895 (14.6286) + (17.4) = -0.0007 = 0
-1.1895 (-23.0787) + (-32) = -4.5479 1.4 −3.4 8.3 2.4 8.7
0 14.6286 −23.0787 −0.2143 −8.6644 = [U|d]
-1.1895 (-0.2143) + (-8.2) = -7.9451
0 0 −4.5479 −7.9451 −12.4937
-1.1895 (-8.6644) + (-22.8) = -12.4937

The equivalent system is given by Ux = d,


or
1.4000𝑥1 − 3.4000𝑥2 + 8.3000𝑥3 = 2.4
0.0000𝑥1 + 14.6286𝑥2 − 23.0787𝑥3 = −0.2143
0.0000𝑥1 + 0.0000𝑥2 − 4.5479𝑥3 = −7.9451
By using calculator to solve the simultaneous equation:
𝑥1 = -1.9850
𝑥2 = 2.7415 Solution: x = 𝑥̂ = (-1.9850 , 2.7415 , 1.7470)
𝑥3 = 1.7470
MUHAMMAD MUSA BIN YUSOF
A17KA0105

1.4 −3.4 8.3 𝑥1 2.4 1.4 −3.4 8.3 2.4 8.7


2. b) 3.1 7.1 −4.7 𝑥2 = 5.1 [A|b] = 3.1 7.1 −4.7 5.1 10.6
5.6 3.8 1.2 𝑥3 1.4 5.6 3.8 1.2 1.4 12
𝑅1 ↔ 𝑅3 (𝑝𝑎𝑟𝑡𝑖𝑎𝑙 𝑝𝑖𝑣𝑜𝑡𝑖𝑛𝑔)

5.6 3.8 1.2 1.4 12


3.1 7.1 −4.7 5.1 10.6
1.4 −3.4 8.3 2.4 8.7

𝑚21 = 3.1/5.6 = 0.5536 ; −𝑚21 𝑅1 + 𝑅2 → 𝑅2


𝑚31 = 1.4/5.6 = 0.25 ; −𝑚31 𝑅1 + 𝑅3 → 𝑅3

Operation: −𝑚21 𝑅1 + 𝑅2 → 𝑅2 Operation: −𝑚31 𝑅1 + 𝑅3 → 𝑅3


-0.5536 (5.6) + (3.1) = -0.0002 = 0 -0.25 (5.6) + (1.4) =0
-0.5536 (3.8) + (7.1) = 4.9963 -0.25 (3.8) + (-3.4) = -4.35
-0.5536 (1.2) + (-4.7) = -5.3643 -0.25 (1.2) + (8.3) =8
-0.5536 (1.4) + (5.1) = 4.3250 -0.25 (1.4) + (2.4) = 2.05
-0.5536 (12) + (10.6) = 3.9568 -0.25 (12) + (8.7) = 5.7

5.6 3.8 1.2 1.4 12


0 4.9963 −5.3643 4.3250 3.9568 𝑚32 = −4.35/4.9963 = −0.8706 ; −𝑚32 𝑅2 + 𝑅3 → 𝑅3
0 −4.35 8 2.05 5.7

Operation: −𝑚32 𝑅2 + 𝑅3 → 𝑅3
0.8706 (4.9963) + (-4.35) = -0.0002 = 0
0.8076 (-5.3643) + (8) = 3.3298 5.6 3.8 1.2 1.4 12
0 4.9963 −5.3643 4.3250 3.9568 = [U|d]
0.8076 (4.3250) + (2.05) = 5.8153
0 0 3.3298 5.8153 9.1448
0.8076 (3.9568) + (5.7) = 9.1448

The equivalent system is given by Ux = d,


or
5.6000𝑥1 + 3.8000𝑥2 + 1.2000𝑥3 = 1.4
0.0000𝑥1 + 4.9963𝑥2 − 5.3643𝑥3 = 4.325
0.0000𝑥1 + 0.0000𝑥2 + 3.3298𝑥3 = 9.1448
By using calculator to solve the simultaneous equation:
𝑥1 = -1.9840
𝑥2 = 2.7407 Solution: x = 𝑥̂ = (-1.9840 , 2.7407 , 1.7464)
𝑥3 = 1.7464
MUHAMMAD MUSA BIN YUSOF
A17KA0105

3 4 3 𝑥1 16 3 4 3 16 26
3. a) 1 5 −1 𝑥2 = −12 [A|b] = 1 5 −1 −12 −7
6 3 7 𝑥3 102 6 3 7 102 118
𝑚21 = 1/3 = 0.3333 ; −𝑚21 𝑅1 + 𝑅2 → 𝑅2
𝑚31 = 6/3 = 2.0000 ; −𝑚31 𝑅1 + 𝑅3 → 𝑅3

Operation: −𝑚21 𝑅1 + 𝑅2 → 𝑅2 Operation: −𝑚31 𝑅1 + 𝑅3 → 𝑅3


-0.3333 (3) + (1) = 0.0001 = 0 -2 (3) + (6) = 0
-0.3333 (4) + (5) = 3.6668 -2 (4) + (3) = -5
-0.3333 (3) + (-1) = -1.9999 -2 (3) + (7) = 1
-0.3333 (16) + (-12) = -17.3328 -2 (16) + (102) = 70
-0.3333 (26) + (-7) = -15.6658 -2 (26) + (118) = 66

3 4 3 16 26
0 3.6668 −1.9999 −17.3328 −15.6658 𝑚32 = −5/3.6668 = −1.3636 ; −𝑚32 𝑅2 + 𝑅3 → 𝑅3
0 −5 1 70 66

Operation: −𝑚32 𝑅2 + 𝑅3 → 𝑅3
1.3636 (3.6668) + (-5) =0
1.3636 (-1.9999) + (1) = -1.7271 3 4 3 16 26
0 3.6668 −1.9999 −17.3328 −15.6658 = [U|d]
1.3636 (-17.3328) + (70) = 46.3650
0 0 −1.7271 46.3650 44.6381
1.3636 (-15.6658) + (66) = 44.6381

The equivalent system is given by Ux = d,


or
3.0000𝑥1 + 4.0000𝑥2 + 3.0000𝑥3 = 16
0.0000𝑥1 + 3.6668𝑥2 − 1.9999𝑥3 = −17.3328
0.0000𝑥1 + 0.0000𝑥2 − 1.7271𝑥3 = 46.3650
By using calculator to solve the simultaneous equation:
𝑥1 = 58.0039
𝑥2 = -19.3687 Solution: x = 𝑥̂ = (58.0039 , -19.3687 , -26.8456)
𝑥3 = -26.8456
MUHAMMAD MUSA BIN YUSOF
A17KA0105

3 4 3 𝑥1 16 3 4 3 16 26
3. b) 1 5 −1 𝑥2 = −12 [A|b] = 1 5 −1 −12 −7
6 3 7 𝑥3 102 6 3 7 102 118
𝑅1 ↔ 𝑅3 (𝑝𝑎𝑟𝑡𝑖𝑎𝑙 𝑝𝑖𝑣𝑜𝑡𝑖𝑛𝑔)

6 3 7 102 118
1 5 −1 −12 −7
3 4 3 16 26

𝑚21 = 1/6 = 0.1667 ; −𝑚21 𝑅1 + 𝑅2 → 𝑅2


𝑚31 = 3/6 = 0.5000 ; −𝑚31 𝑅1 + 𝑅3 → 𝑅3

Operation: −𝑚21 𝑅1 + 𝑅2 → 𝑅2 Operation: −𝑚31 𝑅1 + 𝑅3 → 𝑅3


-0.1667 (6) + (1) = -0,0002 = 0 -0.5 (6) + (3) = 0
-0.1667 (3) + (5) = 4.4999 -0.5 (3) + (4) = 2.5
-0.1667 (7) + (-1) = -2.1669 -0.5 (7) + (3) = -0.5
-0.1667 (102) + (-12) = -29.0034 -0.5 (102) + (16) = -35
-0.1667 (118) + (-7) = -26.6706 -0.5 (118) + (26) = -33

6 3 7 102 118 2.5


0 4.4999 −2.1669 −29.0034 −26.6706 𝑚32 = = 0.5556 ; −𝑚32 𝑅2 + 𝑅3 → 𝑅3
4.4999
0 2.5 −0.5 −35 −33

Operation: −𝑚32 𝑅2 + 𝑅3 → 𝑅3
-0.5556 (4.4999) + (2.5) = -0.0001 = 0
-0.5556 (-2.1669) + (-0.5) = 0.7039 6 3 7 102 118
0 4.4999 −2.1669 −29.0034 −26.6706 = [U|d]
-0.5556 (-29.0034) + (-35) = -18.8857
0 0 0.7039 −18.8857 −18.1818
-0.5556 (-26.6706) + (-33) = -18.1818

The equivalent system is given by Ux = d,


or
6.0000𝑥1 + 3.0000𝑥2 + 7.0000𝑥3 = 102
0.0000𝑥1 + 4.4999𝑥2 − 2.1669𝑥3 = −29.0034
0.0000𝑥1 + 0.0000𝑥2 + 0.7039𝑥3 = −18.8857
By using calculator to solve the simultaneous equation:
𝑥1 = 57.9844
𝑥2 = -19.3652 Solution: x = 𝑥̂ = (57.9844 , -19.3652 , -26.8301)
𝑥3 = -26.8301
MUHAMMAD MUSA BIN YUSOF
A17KA0105

2 8 4 𝑥1 9 2 8 4 9 23
4. a) 4 −5 −16 𝑥2 = 7 [A|b] = 4 −5 −16 7 −10
10 −5 1 𝑥3 4 10 −5 1 4 10
𝑚21 = 4/2 = 2 ; −𝑚21 𝑅1 + 𝑅2 → 𝑅2
𝑚31 = 10/2 = 5 ; −𝑚31 𝑅1 + 𝑅3 → 𝑅3

Operation: −𝑚21 𝑅1 + 𝑅2 → 𝑅2 Operation: −𝑚31 𝑅1 + 𝑅3 → 𝑅3


-2 (2) + (4) = 0 -5 (2) + (10) =0
-2 (8) + (-5) = -21 -5 (8) + (-5) = -45
-2 (4) + (-16) = -24 -5 (4) + (1) = -19
-2 (9) + (7) = -11 -5 (9) + (4) = -41
-2 (23) + (-10) = -56 -5 (23) + (10) = -105

2 8 4 9 23
0 −21 −24 −11 −56 𝑚32 = −45/−21 = 2.1429 ; −𝑚32 𝑅2 + 𝑅3 → 𝑅3
0 −45 −19 −41 −105

Operation: −𝑚32 𝑅2 + 𝑅3 → 𝑅3
-2.1429 (-21) + (-45) = 0.0009 = 0
2 8 4 9 23
-2.1429 (-24) + (-19) = 32.4296
0 −21 −24 −11 −56 = [U|d]
-2.1429 (-11) + (-41) = -17.4281
0 0 32.4296 −17.4281 15.0024
-2.1249 (-56) + (-105) = 15.0024

The equivalent system is given by Ux = d,


or
2.0000𝑥1 + 8.0000𝑥2 + 4.0000𝑥3 = 9
0.0000𝑥1 − 21.0000𝑥2 − 24.0000𝑥3 = −11
0.0000𝑥1 + 0.0000𝑥2 + 32.4296𝑥3 = −17.4281
By using calculator to solve the simultaneous equation:
𝑥1 = 1.0228
𝑥2 = 1.1380 Solution: x = 𝑥̂ = (1.0228 , 1.1380 , -0.5374)
𝑥3 = -0.5374
MUHAMMAD MUSA BIN YUSOF
A17KA0105

2 8 4 𝑥1 9 2 8 4 9 23
4. b) 4 −5 −16 𝑥2 = 7 [A|b] = 4 −5 −16 7 −10
10 −5 1 𝑥3 4 10 −5 1 4 10
𝑅1 ↔ 𝑅3 (𝑝𝑎𝑟𝑡𝑖𝑎𝑙 𝑝𝑖𝑣𝑜𝑡𝑖𝑛𝑔)

10 −5 1 4 10
4 −5 −16 7 −10
2 8 4 9 23

𝑚21 = 4/10 = 0.4 ; −𝑚21 𝑅1 + 𝑅2 → 𝑅2


𝑚31 = 2/10 = 0.2 ; −𝑚31 𝑅1 + 𝑅3 → 𝑅3

Operation: −𝑚21 𝑅1 + 𝑅2 → 𝑅2 Operation: −𝑚31 𝑅1 + 𝑅3 → 𝑅3


-0.4 (10) + (4) = 0 -0.2 (10) + (2) = 0
-0.4 (-5) + (-5) = -3 -0.2 (-5) + (8) = 9
-0.4 (1) + (-16) = -16.4 -0.2 (1) + (4) = 3.8
-0.4 (4) + (7) = 5.4 -0.2 (4) + (9) = 8.2
-0.4 (10) + (-10) = -14 -0.2 (10) + (23) = 21

10 −5 1 4 10 10 −5 1 4 10
0 −3 −16.4 5.4 −14 𝑅2 ↔ 𝑅3 (𝑝𝑎𝑟𝑡𝑖𝑎𝑙 𝑝𝑖𝑣𝑜𝑡𝑖𝑛𝑔) 0 9 3.8 8.2 21
0 9 3.8 8.2 21 0 −3 −16.4 5.4 −14

𝑚32 = −3/9 = −0.3333 ;


−𝑚32 𝑅2 + 𝑅3 → 𝑅3

Operation: −𝑚32 𝑅2 + 𝑅3 → 𝑅3
0.3333 (9.0) + (-3) = -0.0003 = 0
0.3333 (3.8) + (-16.4) = -15.1335 10 −5 1 4 10
0.3333 (8.2) + (5.4) = 8.1331 0 9 3.8 8.2 21 = [U|d]
0.3333 (21) + (-14) = -7.0007 0 0 −15.1335 8.1331 −7.007

The equivalent system is given by Ux = d,


or
10.0000𝑥1 − 5.0000𝑥2 + 1.0000𝑥3 = 4
0.0000𝑥1 + 9.0000𝑥2 + 3.8000𝑥3 = 8.2
0.0000𝑥1 + 0.0000𝑥2 − 15.1335𝑥3 = 8.1331
By using calculator to solve the simultaneous equation:
𝑥1 = 1.0228
𝑥2 = 1.1380 Solution: x = 𝑥̂ = (1.0228 , 1.1380 , -0.5374)
𝑥3 = -0.5374
MUHAMMAD MUSA BIN YUSOF
A17KA0105

12 7.8 4.6 𝑥1 21.38 12 7.8 4.6 21.38 45.78


5. a) 2 −3.5 1 𝑥2 = 22.35 [A|b] = 2 −3.5 1 22.35 21.85
−5 3 3.3 𝑥3 −9.08 −5 3 3.3 −9.08 −7.78
𝑚21 = 2/12 = 0.1667 ; −𝑚21 𝑅1 + 𝑅2 → 𝑅2
𝑚31 = −5/12 = −0.4167 ; −𝑚31 𝑅1 + 𝑅3 → 𝑅3

Operation: −𝑚21 𝑅1 + 𝑅2 → 𝑅2 Operation: −𝑚31 𝑅1 + 𝑅3 → 𝑅3


-0.1667 (12) + (2) = -0.0004 = 0 0.4167 (12) + (-5) = 0.0004 = 0
-0.1667 (7.8) + (-3.5) = -4.8003 0.4167 (7.8) + (3) = 6.2503
-0.1667 (4.6) + (1) = 0.2332 0.4167 (4.6) + (3.3) = 5.2168
-0.1667 (21.38) + (22.35) = 18.786 0.4167 (21.38) + (-9.08) = -0.1710
-0.1667 (45.78) + (21.85) = 14.2185 0.4167 (45.78) + (-7.78) = 11.2965

12 7.8 4.6 21.38 45.78 6.2503


0 −4.8003 0.2332 18.786 14.2185 𝑚32 = = −1.3021 ; −𝑚32 𝑅2 + 𝑅3 → 𝑅3
−4.8003
0 6.2503 5.2168 −0.1710 11.2965

Operation: −𝑚32 𝑅2 + 𝑅3 → 𝑅3
1.3021 (-4.8003) + (6.2503) = -0.0002 = 0
1.3021 (0.2332) + (5.2168) = 5.5204 12 7.8 4.6 21.38 45.78
0 −4.8003 0.2332 18.786 14.2185 = [U|d]
1.3021 (18.786) + (-0.1710) = 24.2903
0 0 5.5204 24.2903 29.8104
1.3021 (14.2185) + (11.2965) = 29.8104

The equivalent system is given by Ux = d,


or
12.0000𝑥1 + 7.8000𝑥2 + 4.6000𝑥3 = 21.38
0.0000𝑥1 − 4.8003𝑥2 + 0.2332𝑥3 = 18.786
0.0000𝑥1 + 0.0000𝑥2 + 5.5204𝑥3 = 24.2903
By using calculator to solve the simultaneous equation:
𝑥1 = 2.4998
𝑥2 = -3.6997 Solution: x = 𝑥̂ = (2.4998 , -3.6997 , 4.4001)
𝑥3 = 4.4001
MUHAMMAD MUSA BIN YUSOF
A17KA0105

12 7.8 4.6 𝑥1 21.38 12 7.8 4.6 21.38 45.78


5. b) 2 −3.5 1 𝑥2 = 22.35 [A|b] = 2 −3.5 1 22.35 21.85
−5 3 3.3 𝑥3 −9.08 −5 3 3.3 −9.08 −7.78

𝑚21 = 2/12 = 0.1667 ; −𝑚21 𝑅1 + 𝑅2 → 𝑅2


𝑚31 = −5/12 = −0.4167 ; −𝑚31 𝑅1 + 𝑅3 → 𝑅3

Operation: −𝑚21 𝑅1 + 𝑅2 → 𝑅2 Operation: −𝑚31 𝑅1 + 𝑅3 → 𝑅3


-0.1667 (12) + (2) = -0.0004 = 0 0.4167 (12) + (-5) = 0.0004 = 0
-0.1667 (7.8) + (-3.5) = -4.8003 0.4167 (7.8) + (3) = 6.2503
-0.1667 (4.6) + (1) = 0.2332 0.4167 (4.6) + (3.3) = 5.2168
-0.1667 (21.38) + (22.35) = 18.786 0.4167 (21.38) + (-9.08) = -0.1710
-0.1667 (45.78) + (21.85) = 14.2185 0.4167 (45.78) + (-7.78) = 11.2965

12 7.8 4.6 21.38 45.78 12 7.8 4.6 21.38 45.78


0 −4.8003 0.2332 18.786 14.2185 𝑅2 ↔ 𝑅3 0 6.2503 5.2168 −0.1710 11.2965
0 6.2503 5.2168 −0.1710 11.2965 0 −4.8003 0.2332 18.786 14.2185
𝑚32 = −4.8003/6.2503 = −0.7680 ;
−𝑚32 𝑅2 + 𝑅3 → 𝑅3

Operation: −𝑚32 𝑅2 + 𝑅3 → 𝑅3
0.768 (6.2503) + (-4.8003) = -0.0001 = 0
12 7.8 4.6 21.38 45.78
0.768 (5.2168) + (0.2332) = 4.2397
0 6.2503 5.2168 −0.1710 11.2965 = [U|d]
0.768 (-0.1710) + (18.786) = 18.6547
0 0 4.2397 18.6547 22.8942
0.768 (11.2965) + (14.2185) = 22.8942

The equivalent system is given by Ux = d,


or
12.0000𝑥1 + 7.8000𝑥2 + 4.6000𝑥3 = 21.38
0.0000𝑥1 + 6.2503𝑥2 + 5.2168𝑥3 = −0.1710
0.0000𝑥1 + 0.0000𝑥2 + 4.2397𝑥3 = 18.6547
By using calculator to solve the simultaneous equation:
𝑥1 = 2.4999
𝑥2 = -3.6998 Solution: x = 𝑥̂ = (2.4999 , -3.6998 , 4.4000)
𝑥3 = 4.4000
MUHAMMAD MUSA BIN YUSOF
A17KA0105

0.5 −8.7 15.3 𝑥1 0.6 0.5 −8.7 15.3 0.6 7.7


6. a) 0.9 2.5 6.4 𝑥2 = 11 [A|b] = 0.9 2.5 6.4 11 20.8
3.7 4.8 −2.5 𝑥3 7.8 3.7 4.8 −2.5 7.8 13.8
𝑚21 = 0.9/0.5 = 1.8 ; −𝑚21 𝑅1 + 𝑅2 → 𝑅2
𝑚31 = 3.7/0.5 = 7.4 ; −𝑚31 𝑅1 + 𝑅3 → 𝑅3

Operation: −𝑚21 𝑅1 + 𝑅2 → 𝑅2 Operation: −𝑚31 𝑅1 + 𝑅3 → 𝑅3


-1.8 (0.5) + (0.9) = 0 -7.4 (0.5) + (3.7) =0
-1.8 (-8.7) + (2.5) = 18.16 -7.4 (-8.7) + (4.8) = 69.18
-1.8 (15.3) + (6.4) = -21.14 -7.4 (15.3) + (-2.5) = -115.72
-1.8 (0.6) + (11) = 9.92 -7.4 (0.6) + (7.8) = 3.36
-1.8 (7.7) + (20.8) = 6.94 -7.4 (7.7) + (13.8) = -43.18

0.5 −8.7 15.3 0.6 7.7 69.18


0 18.16 −21.14 9.92 6.94 𝑚32 = = 3.8095 ; −𝑚32 𝑅2 + 𝑅3 → 𝑅3
18.16
0 69.18 −115.72 3.36 −43.18

Operation: −𝑚32 𝑅2 + 𝑅3 → 𝑅3
-3.8095 (18.16) + (69.18) = -0.0005 = 0
0.5 −8.7 15.3 0.6 7.7
-3.8095 (-21.14) + (-115.72) = -35.1872
0 18.16 −21.14 9.92 6.94 = [U|d]
-3.8095 (9.92) + (3.36) = -34.4302
0 0 −35.1872 −34.4302 −69.6179
-3.8095 (6.94) + (-43.18) = -69.6179

The equivalent system is given by Ux = d,


or
0.5000𝑥1 − 8.7000𝑥2 + 15.3000𝑥3 = 0.6
0.0000𝑥1 + 18.1600𝑥2 − 21.1400𝑥3 = 9.92
0.0000𝑥1 + 0.0000𝑥2 − 35.1872𝑥3 = −34.4302
By using calculator to solve the simultaneous equation:
𝑥1 = 0.5827
𝑥2 = 1.6853 Solution: x = 𝑥̂ = (0.5827 , 1.6853 , 0.9785)
𝑥3 = 0.9785
MUHAMMAD MUSA BIN YUSOF
A17KA0105

0.5 −8.7 15.3 𝑥1 0.6 0.5 −8.7 15.3 0.6 7.7


6. b) 0.9 2.5 6.4 𝑥2 = 11 [A|b] = 0.9 2.5 6.4 11 20.8
3.7 4.8 −2.5 𝑥3 7.8 3.7 4.8 −2.5 7.8 13.8
𝑅1 ↔ 𝑅3 (𝑝𝑎𝑟𝑡𝑖𝑎𝑙 𝑝𝑖𝑣𝑜𝑡𝑖𝑛𝑔)

3.7 4.8 −2.5 7.8 13.8


0.9 2.5 6.4 11 20.8
0.5 −8.7 15.3 0.6 7.7

𝑚21 = 0.9/3.7 = 0.2432 ; −𝑚21 𝑅1 + 𝑅2 → 𝑅2


𝑚31 = 0.5/3.7 = 0.1351 ; −𝑚31 𝑅1 + 𝑅3 → 𝑅3

Operation: −𝑚21 𝑅1 + 𝑅2 → 𝑅2 Operation: −𝑚31 𝑅1 + 𝑅3 → 𝑅3


-0.2432 (3.7) + (0.9) = 0.0002 = 0 -0.1351 (3.7) + (0.5) = 0.0001 = 0
-0.2432 (4.8) + (2.5) = 1.3326 -0.1351 (4.8) + (-8.7) = -9.3485
-0.2432 (-2.5) + (6.4) = 7.008 -0.1351 (-2.5) + (15.3) = 15.6378
-0.2432 (7.8) + (11) = 9.103 -0.1351 (7.8) + (0.6) = -0.4538
-0.2432 (13.8) + (20.8) = 17.4438 -0.1351 (13.8) + (7.7) = 5.8356

3.7 4.8 −2.5 7.8 13.8 3.7 4.8 −2.5 7.8 13.8
0 1.3326 7.008 9.103 17.4438 𝑅2 ↔ 𝑅3 0 −9.3485 15.6378 −0.4538 5.8356
0 −9.3485 15.6378 −0.4538 5.8356 0 1.3326 7.008 9.103 17.4438

𝑚32 = 1.3326/−9.3485 = −0.1425 ;


−𝑚32 𝑅2 + 𝑅3 → 𝑅3

Operation: −𝑚32 𝑅2 + 𝑅3 → 𝑅3
0.1425 (-9.3485) + (1.3326) = 0.0004 = 0
3.7 4.8 −2.5 7.8 13.8
0.1425 (15.6378) + (7.008) = 9.2364
0 −9.3485 15.6378 −0.4538 5.8356 = [U|d]
0.1425 (-0.4538) + (9.103) = 9.0383
0 0 9.2364 9.0383 18.2754
0.1425 (5.8356) + (17.4438) = 18.2754

The equivalent system is given by Ux = d,


or
3.7000𝑥1 + 4.8000𝑥2 − 2.5000𝑥3 = 7.8
0.0000𝑥1 − 9.3485𝑥2 + 15.6378𝑥3 = −0.4538
0.0000𝑥1 + 0.0000𝑥2 + 9.2364𝑥3 = 9.0383
By using calculator to solve the simultaneous equation:
𝑥1 = 0.5828
𝑥2 = 1.6854 Solution: x = 𝑥̂ = (0.5828 , 1.6854 , 0.9786)
𝑥3 = 0.9786
MUHAMMAD MUSA BIN YUSOF
A17KA0105

3.21 4.28 6.35 𝑥1 14.18 3.21 4.28 6.35 14.18 28.02


7. a) 9.16 8.64 3.72 𝑥2 = 25.16 [A|b] = 9.16 8.64 3.72 25.16 46.68
−6.24 9.15 −2.85 𝑥3 1.75 −6.24 9.15 −2.85 1.75 1.81
𝑚21 = 9.16/3.21 = 2.8536 ; −𝑚21 𝑅1 + 𝑅2 → 𝑅2
𝑚31 = −6.24/3.21 = −1.9439 ; −𝑚31 𝑅1 + 𝑅3 → 𝑅3

Operation: −𝑚21 𝑅1 + 𝑅2 → 𝑅2 Operation: −𝑚31 𝑅1 + 𝑅3 → 𝑅3


-2.8536 (3.21) + (9.16) = -0.0001 = 0 1.9439 (3.21) + (-6.24) = -0.0001 = 0
-2.8536 (4.28) + (8.64) = -3.5734 1.9439 (4.28) + (9.15) = 17.4699
-2.8536 (6.35) + (3.72) = -14.4004 1.9439 (6.35) + (-2.85) = 9.4938
-2.8536 (14.18) + (25.16) = -15.3040 1.9439 (14.18) + (1.75) = 29.3145
-2.8536 (28.02) + (46.68) = -33.2779 1.9439 (28.02) + (1.81) = 56.2781

3.21 4.28 6.35 14.18 28.02 17.4699


0 −3.5734 −14.4004 −15.3040 −33.2779 𝑚32 = = −4.8889 ;
−3.5734
0 17.4699 9.4938 29.3145 56.2781
−𝑚32 𝑅2 + 𝑅3 → 𝑅3

Operation: −𝑚32 𝑅2 + 𝑅3 → 𝑅3
4.8889 (-3.5734) + (17.4699) = -0.0001 = 0
3.21 4.28 6.35 14.18 28.02
4.8889 (-14.4004) + (9.4938) = -60.9083
0 −3.5734 −14.4004 −15.3040 −33.2779
4.8889 (-15.3040) + (29.3145) = -45.5052 0 0 −60.9083 −45.5052 −106.4142
4.8889 (-33.2779) + (56.2781) = -106.4142

= [U|d]

The equivalent system is given by Ux = d,


or
3.2100𝑥1 + 4.2800𝑥2 + 6.3500𝑥3 = 14.18
0.0000𝑥1 − 3.5734𝑥2 − 14.4004𝑥3 = −15.3040
0.0000𝑥1 + 0.0000𝑥2 − 60.9083𝑥3 = −45.5052
By using calculator to solve the simultaneous equation:
𝑥1 = 1.2435
𝑥2 = 1.2720 Solution: x = 𝑥̂ = (1.2435 , 1.2720 , 0.7471)
𝑥3 = 0.7471
MUHAMMAD MUSA BIN YUSOF
A17KA0105

3.21 4.28 6.35 𝑥1 14.18 3.21 4.28 6.35 14.18 28.02


7. b) 9.16 8.64 3.72 𝑥2 = 25.16 [A|b] = 9.16 8.64 3.72 25.16 46.68
−6.24 9.15 −2.85 𝑥3 1.75 −6.24 9.15 −2.85 1.75 1.81
𝑅1 ↔ 𝑅2 (𝑝𝑎𝑟𝑡𝑖𝑎𝑙 𝑝𝑖𝑣𝑜𝑡𝑖𝑛𝑔)

9.16 8.64 3.72 25.16 46.68


3.21 4.28 6.35 14.18 28.02
−6.24 9.15 −2.85 1.75 1.81

𝑚21 = 3.21/9.16 = 0.3504 ; −𝑚21 𝑅1 + 𝑅2 → 𝑅2


𝑚31 = −6.24/9.16 = −0.6812 ; −𝑚31 𝑅1 + 𝑅3 → 𝑅3

Operation: −𝑚21 𝑅1 + 𝑅2 → 𝑅2 Operation: −𝑚31 𝑅1 + 𝑅3 → 𝑅3


-0.3504 (9.16) + (3.21) = 0.0003 = 0 0.6812 (9.16) + (-6.24) = -0.0002 = 0
-0.3504 (8.64) + (4.28) = 1.2525 0.6812 (8.64) + (9.15) = 15.0356
-0.3504 (3.72) + (6.35) = 5.0465 0.6812 (3.72) + (-2.85) = -0.3159
-0.3504 (25.16) + (14.18) = 5.3639 0.6812 (25.16) + (1.75) = 18.8890
-0.3504 (46.68) + (28.02) = 11.6633 0.6812 (46.68) + (1.81) = 33.6084

9.16 8.64 3.72 25.16 46.68 9.16 8.64 3.72 25.16 46.68
0 1.2525 5.0465 5.3639 11.6633 𝑅2 ↔ 𝑅3 0 15.0356 −0.3159 18.889 33.6084
0 15.0356 −0.3159 18.889 33.6084 0 1.2525 5.0465 5.3639 11.6633

𝑚32 = 1.2525/15.0356 = 0.0833 ;


−𝑚32 𝑅2 + 𝑅3 → 𝑅3

Operation: −𝑚32 𝑅2 + 𝑅3 → 𝑅3
-0.0833 (15.0356) + (1.2525) = 0
9.16 8.64 3.72 25.16 46.68
-0.0833 (-0.3159) + (5.0465) = 5.0728
0 15.0356 −0.3159 18.889 33.6084 = [U|d]
-0.0833 (18.889) + (5.3639) = 3.7904
0 0 5.0728 3.7904 8.8637
-0.0833 (33.6084) + (11.6633) = 8.8637

The equivalent system is given by Ux = d,


or
9.1600𝑥1 + 8.6400𝑥2 + 3.7200𝑥3 = 25.16
0.0000𝑥1 + 15.0356𝑥2 − 0.3159𝑥3 = 18.889
0.0000𝑥1 + 0.0000𝑥2 + 5.0728𝑥3 = 3.7904
By using calculator to solve the simultaneous equation:
𝑥1 = 1.2435
𝑥2 = 1.2720 Solution: x = 𝑥̂ = (1.2435 , 1.2720 , 0.7472)
𝑥3 = 0.7472
MUHAMMAD MUSA BIN YUSOF
A17KA0105

LU FACTORIZATION METHOD
***Exercise 2.2
Solve the following system of linear equations using LU factorization
(a) Doolittle method
(b) Crout method
Show your calculation in 4DP.

−2 4 3 𝑥1 −3
1. a) Ax = b → 3 2 −4 𝑥2 = 19
4 3 5 𝑥3 −5

Using Doolittle factorization, A = LU

−2 4 3 1 0 0 𝑝 𝑞 𝑟 𝑝 𝑞 𝑟
3 2 −4 = 𝑎 1 0 0 𝑠 𝑡 = 𝑎𝑝 𝑎𝑞 + 𝑠 𝑎𝑟 + 𝑡
4 3 5 𝑏 𝑐 1 0 0 𝑢 𝑏𝑝 𝑏𝑞 + 𝑐𝑠 𝑏𝑟 + 𝑐𝑡 + 𝑢
We obtain,
𝑝 = −2.0000
𝑞 = 4.0000
𝑟 = 3.0000
3
𝑎𝑝 = 3 → 𝑎= = −1.5000
𝑝
4
𝑏𝑝 = 4 → 𝑏= = −2.0000
𝑝
𝑎𝑞 + 𝑠 = 2 → 𝑠 = 2 − 𝑎𝑞 = 8.0000
𝑎𝑟 + 𝑡 = −4 → 𝑡 = −4 − 𝑎𝑟 = 0.5000
3 − 𝑏𝑞
𝑏𝑞 + 𝑐𝑠 = 3 → 𝑐= = 1.3750
𝑠
𝑏𝑟 + 𝑐𝑡 + 𝑢 = 5 → 𝑢 = 5 − 𝑏𝑟 − 𝑐𝑡 = 10.3125

−2 4 3 1 0 0 −2 4 3
To find solution of Ax = b or
A = LU : −1.5 8 0.5 = −1.5 1 0 0 8 0.5 LUx = b, let Ux = y
−2 1.25 10.3125 −2 1.375 1 0 0 10.3125

1 0 0 𝑦1 −3 By using calculator, solve for y :


1) Solve Ly = b, → −1.5 1 0 𝑦2 = 19 → 𝑦1 = −3.0000
−2 1.375 1 𝑦3 −5 𝑦2 = 14.5.0000
Forward substitution
𝑦3 = −30.9375

−2 4 3 𝑥1 −3 By using calculator, solve for x :


2) Solve Ux = y, → 0 8 0.5 𝑥2 = 14.5 → 𝑥1 = 1.0000
0 0 10.3125 𝑥3 −30.9375 𝑥2 = 2.0000
Backward substitution
𝑥3 = −3.0000

Solution: 𝑥1 = 1.0000 𝑥2 = 2.0000 𝑥3 = −3.0000


MUHAMMAD MUSA BIN YUSOF
A17KA0105

−2 4 3 𝑥1 −3
1. b) Ax = b → 3 2 −4 𝑥2 = 19
4 3 5 𝑥3 −5

Using Crout factorization, A = LU

−2 4 3 𝑝 0 0 1 𝑎 𝑏 𝑝 𝑝𝑎 𝑝𝑏
3 2 −4 = 𝑞 𝑠 0 0 1 𝑐 = 𝑞 𝑞𝑎 + 𝑠 𝑞𝑏 + 𝑠𝑐
4 3 5 𝑟 𝑡 𝑢 0 0 1 𝑟 𝑟𝑎 + 𝑡 𝑟𝑏 + 𝑡𝑐 + 𝑢
We obtain,
𝑝 = −2.0000
𝑞 = 3.0000
𝑟 = 4.0000
4
𝑝𝑎 = 4 → 𝑎= = −2.0000
𝑝
3
𝑝𝑏 = 3 → 𝑏= = −1.50000
𝑝
𝑞𝑎 + 𝑠 = 2 → 𝑠 = 2 − 𝑞𝑎 = 8.0000
𝑟𝑎 + 𝑡 = 3 → 𝑡 = 3 − 𝑟𝑎 = 11.0000
−4 − 𝑞𝑏
𝑞𝑏 + 𝑠𝑐 = −4 → 𝑐= = 0.0625
𝑠
𝑟𝑏 + 𝑡𝑐 + 𝑢 = 5 → 𝑢 = 5 − 𝑟𝑏 − 𝑡𝑐 = 10.3125

−2 4 3 −2 0 0 1 −2 −1.5 To find solution of Ax = b or


A = LU : 3 2 −4 = 3 8 0 0 1 0.0625 LUx = b, let Ux = y
4 3 5 4 11 10.3125 0 0 1

−2 0 0 𝑦1 −3 By using calculator, solve for y :


1) Solve Ly = b, → 3 8 0 𝑦2 = 19 → 𝑦1 = 1.5000
4 11 10.3125 𝑦3 −5
Forward substitution 𝑦2 = 1.8125
𝑦3 = −3.0000

1 −2 −1.5 𝑥1 1.5 By using calculator, solve for x :


2) Solve Ux = y, → 0 1 0.0625 𝑥2 = 1.8125 → 𝑥1 = 1.0000
0 0 1 𝑥3 −3 𝑥2 = 2.0000
Backward substitution
𝑥3 = −3.0000

Solution: 𝑥1 = 1.0000 𝑥2 = 2.0000 𝑥3 = −3.0000


MUHAMMAD MUSA BIN YUSOF
A17KA0105

6 1 −6 𝑥1 −1
2. a) Ax = b → 4 −3 0 𝑥2 = 7
2 2 3 𝑥3 3

Using Doolittle factorization, A = LU

6 1 −6 1 0 0 𝑝 𝑞 𝑟 𝑝 𝑞 𝑟
4 −3 0 = 𝑎 1 0 0 𝑠 𝑡 = 𝑎𝑝 𝑎𝑞 + 𝑠 𝑎𝑟 + 𝑡
2 2 3 𝑏 𝑐 1 0 0 𝑢 𝑏𝑝 𝑏𝑞 + 𝑐𝑠 𝑏𝑟 + 𝑐𝑡 + 𝑢
We obtain,
𝑝 = 6.0000
𝑞 = 1.0000
𝑟 = −6.0000
4
𝑎𝑝 =4 → 𝑎= = 0.6667
𝑝
2
𝑏𝑝 =2 → 𝑏= = 0.3333
𝑝
𝑎𝑞 + 𝑠 = −3 → 𝑠 = −3 − 𝑎𝑞 = −3.6667
𝑎𝑟 + 𝑡 =0 → 𝑡 = 0 − 𝑎𝑟 = 4.0002
2 − 𝑏𝑞
𝑏𝑞 + 𝑐𝑠 =2 → 𝑐= = −0.4546
𝑠
𝑏𝑟 + 𝑐𝑡 + 𝑢 = 3 → 𝑢 = 3 − 𝑏𝑟 − 𝑐𝑡 = 6.8183

6 1 −6 1 0 0 6 1 −6
To find solution of Ax = b or
A = LU : 4 −3 0 = 0.6667 1 0 0 −3.6667 4.0002
LUx = b, let Ux = y
2 2 3 0.3333 −0.4546 1 0 0 3.1813

1 0 0 𝑦1 −1 By using calculator, solve for y :


1) Solve Ly = b, → 0.6667 1 0 𝑦2 = 7 → 𝑦1 = −1.0000
0.3333 −0.4546 1 𝑦3 3 𝑦2 = 7.6667
Forward substitution
𝑦3 = 6.8186

6 1 −6 𝑥1 −1 By using calculator, solve for x :


2) Solve Ux = y, → 0 −3.6667 4.0002 𝑥2 = 7.6667 → 𝑥1 = 1.0000
0 0 6.8183 𝑥3 6.8186 𝑥2 = −0.9999
Backward substitution
𝑥3 = 1.0000

Solution: 𝑥1 = 1.0000 𝑥2 = −0.9999 𝑥3 = 1.0000


MUHAMMAD MUSA BIN YUSOF
A17KA0105

6 1 −6 𝑥1 −1
2. b) Ax = b → 4 −3 0 𝑥2 = 7
2 2 3 𝑥3 3

Using Crout factorization, A = LU

6 1 −6 𝑝 0 0 1 𝑎 𝑏 𝑝 𝑝𝑎 𝑝𝑏
4 −3 0 = 𝑞 𝑠 0 0 1 𝑐 = 𝑞 𝑞𝑎 + 𝑠 𝑞𝑏 + 𝑠𝑐
2 2 3 𝑟 𝑡 𝑢 0 0 1 𝑟 𝑟𝑎 + 𝑡 𝑟𝑏 + 𝑡𝑐 + 𝑢
We obtain,
𝑝 = 6.0000
𝑞 = 4.0000
𝑟 = 2.0000
1
𝑝𝑎 =1 → 𝑎= = 0.1667
𝑝
−6
𝑝𝑏 = −6 → 𝑏= = −1.0000
𝑝
𝑞𝑎 + 𝑠 = −3 → 𝑠 = −3 − 𝑞𝑎 = −3.6668
𝑟𝑎 + 𝑡 =2 → 𝑡 = 2 − 𝑟𝑎 = 1.6666
0 − 𝑞𝑏
𝑞𝑏 + 𝑠𝑐 =0 → 𝑐= = −1.0909
𝑠
𝑟𝑏 + 𝑡𝑐 + 𝑢 = 3 → 𝑢 = 3 − 𝑟𝑏 − 𝑡𝑐 = 6.8181

6 1 −6 6 0 0 1 0.1667 −1.0000 To find solution of Ax = b or


A = LU : 4 −3 0 = 4 −3.6668 0 0 1 −1.0909 LUx = b, let Ux = y
2 2 3 2 1.6666 6.8181 0 0 1

6 0 0 𝑦1 −1 By using calculator, solve for y :


1) Solve Ly = b, → 4 −3.6668 0 𝑦2 = 7 →𝑦 1 = −0.1667
2 1.6666 6.8181 𝑦3 3 𝑦2 = −2.0908
Forward substitution
𝑦3 = 1.0000

1 0.1667 −1 𝑥1 −0.1667 By using calculator, solve for x :


2) Solve Ux = y, → 0 1 −1.0909 𝑥2 = −2.0908 → 𝑥1 = 1.0000
0 0 1 𝑥3 1 𝑥2 = −0.9999
Backward substitution
𝑥3 = 1.0000

Solution: 𝑥1 = 1.0000 𝑥2 = −0.9999 𝑥3 = 1.0000


MUHAMMAD MUSA BIN YUSOF
A17KA0105

2 −1 1 𝑥1 −1
3. a) Ax = b → 3 3 9 𝑥2 = 0
3 3 5 𝑥3 4

Using Doolittle factorization, A = LU

2 −1 1 1 0 0 𝑝 𝑞 𝑟 𝑝 𝑞 𝑟
3 3 9 = 𝑎 1 0 0 𝑠 𝑡 = 𝑎𝑝 𝑎𝑞 + 𝑠 𝑎𝑟 + 𝑡
3 3 5 𝑏 𝑐 1 0 0 𝑢 𝑏𝑝 𝑏𝑞 + 𝑐𝑠 𝑏𝑟 + 𝑐𝑡 + 𝑢
We obtain,
𝑝 = 2.0000
𝑞 = −1.0000
𝑟 = 1.0000
3
𝑎𝑝 =3 → 𝑎= = 1.5000
𝑝
3
𝑏𝑝 =3 → 𝑏 = = 1.5000
𝑝
𝑎𝑞 + 𝑠 =3 → 𝑠 = 3 − 𝑎𝑞 = 4.5000
𝑎𝑟 + 𝑡 =9 → 𝑡 = 9 − 𝑎𝑟 = 7.5000
3 − 𝑏𝑞
𝑏𝑞 + 𝑐𝑠 =3 → 𝑐= = 1.0000
𝑠
𝑏𝑟 + 𝑐𝑡 + 𝑢 = 5 → 𝑢 = 5 − 𝑏𝑟 − 𝑐𝑡 = −4.0000

2 −1 1 1 0 0 2 −1 1
To find solution of Ax = b or
A = LU : 3 3 9 = 1.5 1 0 0 4.5 7.5 LUx = b, let Ux = y
3 3 5 1.5 1 1 0 0 −4

1 0 0 𝑦1 −1 By using calculator, solve for y :


1) Solve Ly = b, → 1.5 1 0 𝑦2 = 0 → 𝑦1 = −1.0000
1.5 1 1 𝑦3 4 𝑦2 = 1.5000
Forward substitution
𝑦3 = 4.0000

2 −1 1 𝑥1 −1 By using calculator, solve for x :


2) Solve Ux = y, → 0 4.5 7.5 𝑥2 = 1.5 →𝑥 1 = 1.0000
0 0 −4 𝑥3 4 𝑥2 = 2.0000
Backward substitution
𝑥3 = −1.0000

Solution: 𝑥1 = 1.0000 𝑥2 = 2.0000 𝑥3 = −1.0000


MUHAMMAD MUSA BIN YUSOF
A17KA0105

2 −1 1 𝑥1 −1
3. b) Ax = b → 3 3 9 𝑥2 = 0
3 3 5 𝑥3 4

Using Crout factorization, A = LU

2 −1 1 𝑝 0 0 1 𝑎 𝑏 𝑝 𝑝𝑎 𝑝𝑏
3 3 9 = 𝑞 𝑠 0 0 1 𝑐 = 𝑞 𝑞𝑎 + 𝑠 𝑞𝑏 + 𝑠𝑐
3 3 5 𝑟 𝑡 𝑢 0 0 1 𝑟 𝑟𝑎 + 𝑡 𝑟𝑏 + 𝑡𝑐 + 𝑢
We obtain,
𝑝 = 2.0000
𝑞 = 3.0000
𝑟 = 3.0000
−1
𝑝𝑎 = −1 → 𝑎 = = −0.5000
𝑝
1
𝑝𝑏 =1 → 𝑏= = 0.5000
𝑝
𝑞𝑎 + 𝑠 =3 → 𝑠 = 3 − 𝑞𝑎 = 4.5000
𝑟𝑎 + 𝑡 =3 → 𝑡 = 3 − 𝑟𝑎 = 4.5000
9 − 𝑞𝑏
𝑞𝑏 + 𝑠𝑐 =9 → 𝑐= = 1.6667
𝑠
𝑟𝑏 + 𝑡𝑐 + 𝑢 = 5 → 𝑢 = 5 − 𝑟𝑏 − 𝑡𝑐 = −4.0002

2 −1 1 2 0 0 1 −0.5 0.5
To find solution of Ax = b or
A = LU : 3 3 9 = 3 4.5 0 0 1 1.6667 LUx = b, let Ux = y
3 3 5 3 4.5 −4.0002 0 0 1

2 0 0 𝑦1 −1 By using calculator, solve for y :


1) Solve Ly = b, → 3 4.5 0 𝑦2 = 0 → 𝑦1 = −0.5000
Forward substitution 3 4.5 −4.0002 𝑦3 4 𝑦2 = 0.3333
𝑦3 = −1.0000

1 −0.5 0.5 𝑥1 −0.5 By using calculator, solve for x :


2) Solve Ux = y, → 0 1 1.6667 𝑥2 = 0.3333 → 𝑥1 = 1.0000
0 0 1 𝑥3 −1 𝑥2 = 2.0000
Backward substitution
𝑥3 = −1.0000

Solution: 𝑥1 = 1.0000 𝑥2 = 2.0000 𝑥3 = −1.0000


MUHAMMAD MUSA BIN YUSOF
A17KA0105

2 0 1 𝑥1 25
4. a) Ax = b → 4 1 13 𝑥2 = 108
6 4 42 𝑥3 292

Using Doolittle factorization, A = LU

2 0 1 1 0 0 𝑝 𝑞 𝑟 𝑝 𝑞 𝑟
4 1 13 = 𝑎 1 0 0 𝑠 𝑡 = 𝑎𝑝 𝑎𝑞 + 𝑠 𝑎𝑟 + 𝑡
6 4 42 𝑏 𝑐 1 0 0 𝑢 𝑏𝑝 𝑏𝑞 + 𝑐𝑠 𝑏𝑟 + 𝑐𝑡 + 𝑢
We obtain,
𝑝 = 2.0000
𝑞 = 0.0000
𝑟 = 1.0000
4
𝑎𝑝 =4 → 𝑎= = 2.0000
𝑝
6
𝑏𝑝 =6 → 𝑏= = 3.0000
𝑝
𝑎𝑞 + 𝑠 =1 → 𝑠 = 1 − 𝑎𝑞 = 1.0000
𝑎𝑟 + 𝑡 = 13 → 𝑡 = 13 − 𝑎𝑟 = 11.0000
4 − 𝑏𝑞
𝑏𝑞 + 𝑐𝑠 =4 → 𝑐= = 4.0000
𝑠
𝑏𝑟 + 𝑐𝑡 + 𝑢 = 42 → 𝑢 = 42 − 𝑏𝑟 − 𝑐𝑡 = −5.0000

2 0 1 1 0 0 2 0 1
To find solution of Ax = b or
A = LU : 4 1 13 = 2 1 0 0 1 11 LUx = b, let Ux = y
6 4 42 3 4 1 0 0 −5

1 0 0 𝑦1 25 By using calculator, solve for y :


1) Solve Ly = b, → 2 1 0 𝑦2 = 108 → 𝑦1 = 25.0000
3 4 1 𝑦3 292 𝑦2 = 58.0000
Forward substitution
𝑦3 = −15.0000

2 0 1 𝑥1 25 By using calculator, solve for x :


2) Solve Ux = y, → 0 1 11 𝑥2 = 58 → 𝑥1 = 11.0000
0 0 −5 𝑥3 −15 𝑥2 = 25.0000
Backward substitution
𝑥3 = 3.0000

Solution: 𝑥1 = 11.0000 𝑥2 = 25.0000 𝑥3 = 3.0000


MUHAMMAD MUSA BIN YUSOF
A17KA0105

2 0 1 𝑥1 25
4. b) Ax = b → 4 1 13 𝑥2 = 108
6 4 42 𝑥3 292

Using Crout factorization, A = LU

2 0 1 𝑝 0 0 1 𝑎 𝑏 𝑝 𝑝𝑎 𝑝𝑏
4 1 13 = 𝑞 𝑠 0 0 1 𝑐 = 𝑞 𝑞𝑎 + 𝑠 𝑞𝑏 + 𝑠𝑐
6 4 42 𝑟 𝑡 𝑢 0 0 1 𝑟 𝑟𝑎 + 𝑡 𝑟𝑏 + 𝑡𝑐 + 𝑢
We obtain,
𝑝 = 2.0000
𝑞 = 4.0000
𝑟 = 6.0000
0
𝑝𝑎 =0 → 𝑎= = 0.0000
𝑝
1
𝑝𝑏 =1 → 𝑏= = 0.5000
𝑝
𝑞𝑎 + 𝑠 =1 → 𝑠 = 1 − 𝑞𝑎 = 1.0000
𝑟𝑎 + 𝑡 =4 → 𝑡 = 4 − 𝑟𝑎 = 4.0000
13 − 𝑞𝑏
𝑞𝑏 + 𝑠𝑐 = 13 → 𝑐= = 11.0000
𝑠
𝑟𝑏 + 𝑡𝑐 + 𝑢 = 42 → 𝑢 = 42 − 𝑟𝑏 − 𝑡𝑐 = −5.0000

2 0 1 2 0 0 1 0 0.5
To find solution of Ax = b or
A = LU : 4 1 13 = 4 1 0 0 1 11 LUx = b, let Ux = y
6 4 42 6 4 −5 0 0 1

2 0 0 𝑦1 25 By using calculator, solve for y :


1) Solve Ly = b, → 4 1 0 𝑦2 = 108 →𝑦 1 = 12.5000
6 4 −5 𝑦3 292
Forward substitution 𝑦2 = 58.0000
𝑦3 = 3.0000

1 0 0.5 𝑥1 12.5 By using calculator, solve for x :


2) Solve Ux = y, → 0 1 11 𝑥2 = 58 →𝑥 1 = 11.0000
0 0 1 𝑥3 3 𝑥2 = 25.0000
Backward substitution
𝑥3 = 3.0000

Solution: 𝑥1 = 11.0000 𝑥2 = 25.0000 𝑥3 = 3.0000


MUHAMMAD MUSA BIN YUSOF
A17KA0105

Doolittle factorization TEMPLATE

𝑥1
a) Ax = b → 𝑥2 =
𝑥3

Using Doolittle factorization, A = LU

1 0 0 𝑝 𝑞 𝑟 𝑝 𝑞 𝑟
= 𝑎 1 0 0 𝑠 𝑡 = 𝑎𝑝 𝑎𝑞 + 𝑠 𝑎𝑟 + 𝑡
𝑏 𝑐 1 0 0 𝑢 𝑏𝑝 𝑏𝑞 + 𝑐𝑠 𝑏𝑟 + 𝑐𝑡 + 𝑢
We obtain,
𝑝 =
𝑞 =
𝑟 =
𝑎𝑝 = → 𝑎=
𝑝
𝑏𝑝 = → 𝑏=
𝑝
𝑎𝑞 + 𝑠 = → 𝑠 = −𝑎𝑞
𝑎𝑟 + 𝑡 = → 𝑡 = −𝑎𝑟
−𝑏𝑞
𝑏𝑞 + 𝑐𝑠 = → 𝑐=
𝑠
𝑏𝑟 + 𝑐𝑡 + 𝑢 = → 𝑢 = −𝑏𝑟 − 𝑐𝑡

1 0 0 𝑝 𝑞 𝑟
To find solution of Ax = b or
A = LU : = 𝑎 1 0 0 𝑠 𝑡 LUx = b, let Ux = y
𝑏 𝑐 1 0 0 𝑢

1 0 0 𝑦1 By using calculator, solve for y :


1) Solve Ly = b, → 1 0 𝑦2 = → 𝑦1 =
Forward substitution 1 𝑦3 𝑦2 =
𝑦3 =

𝑥1 By using calculator, solve for x :


2) Solve Ux = y, → 0 𝑥2 = → 𝑥1 =
Backward substitution 0 0 𝑥3 𝑥2 =
𝑥3 =

Solution: 𝑥1 = 𝑥2 = 𝑥3 =
MUHAMMAD MUSA BIN YUSOF
A17KA0105

Crout factorization TEMPLATE

𝑥1
b) Ax = b → 𝑥2 =
𝑥3

Using Crout factorization, A = LU

𝑝 0 0 1 𝑎 𝑏 𝑝 𝑝𝑎 𝑝𝑏
= 𝑞 𝑠 0 0 1 𝑐 = 𝑞 𝑞𝑎 + 𝑠 𝑞𝑏 + 𝑠𝑐
𝑟 𝑡 𝑢 0 0 1 𝑟 𝑟𝑎 + 𝑡 𝑟𝑏 + 𝑡𝑐 + 𝑢
We obtain,
𝑝 =
𝑞 =
𝑟 =
𝑝𝑎 = → 𝑎=
𝑝
𝑝𝑏 = → 𝑏=
𝑝
𝑞𝑎 + 𝑠 = → 𝑠 = −𝑞𝑎
𝑟𝑎 + 𝑡 = → 𝑡 = −𝑟𝑎
−𝑞𝑏
𝑞𝑏 + 𝑠𝑐 = → 𝑐=
𝑠
𝑟𝑏 + 𝑡𝑐 + 𝑢 = → 𝑢 = −𝑟𝑏 − 𝑡𝑐

𝑝 0 0 1 𝑎 𝑏 To find solution of Ax = b or
A = LU : = 𝑞 𝑠 0 0 1 𝑐 LUx = b, let Ux = y
𝑟 𝑡 𝑢 0 0 1

0 0 𝑦1 By using calculator, solve for y :


1) Solve Ly = b, → 0 𝑦2 = → 𝑦1 =
Forward substitution 𝑦3 𝑦2 =
𝑦3 =

1 𝑥1 By using calculator, solve for x :


2) Solve Ux = y, → 0 1 𝑥2 = → 𝑥1 =
Backward substitution 0 0 1 𝑥3 𝑥2 =
𝑥3 =

Solution: 𝑥1 = 𝑥2 = 𝑥3 =
MUHAMMAD MUSA BIN YUSOF
A17KA0105

Solve the following system of linear equation using Cholesky factorization method. Show the
calculation in 4DP.

2 3 4 𝑥1 20
8. Ax = b → 3 6 7 𝑥2 = 36
4 7 10 𝑥3 48

Where A is symmetric positive definite matrix. Using Cholesky factorization,

2 3 4 𝑎 0 0 𝑎 𝑏 𝑑
𝐴 = 𝐿𝐿 𝑇
→ 3 6 7 = 𝑏 𝑐 0 0 𝑐 𝑒
4 7 10 𝑑 𝑒 𝑓 0 0 𝑓
𝑎2 𝑎𝑏 𝑎𝑑
2 2
= 𝑎𝑏 𝑏 + 𝑐 𝑏𝑑 + 𝑐𝑒
𝑎𝑑 𝑏𝑑 + 𝑐𝑒 𝑑 2 + 𝑒 2 + 𝑓 2
we obtain 
𝑎2 =2 → 𝑎 = 1.4142
3
𝑎𝑏 =3 → 𝑏= = 2.1213
𝑎
4
𝑎𝑑 =4 → 𝑑= = 2.8285
𝑎
𝑏2 + 𝑐 2 → 𝑐 = √6 − 𝑏 2
=6 = 1.2248
7 − 𝑏𝑑
𝑏𝑑 + 𝑐𝑒 =7 → 𝑒= = 0.8164
𝑐
2 2 2
𝑑 + 𝑒 + 𝑓 = 10 → 𝑓 = √10 − 𝑒 2 − 𝑑 2 = 1.1546

then  𝐴 = 𝐿𝐿𝑇 , 𝑈 = 𝐿𝑇
2 3 4 1.4142 0 0 1.4142 2.1213 2.8285
𝐴 = 𝐿𝐿𝑇 → 3 6 7 = 2.1213 1.2248 0 0 1.2248 0.8164
4 7 10 2.8285 0.8164 1.1546 0 0 1.1546

1.4142 0 0 𝑦1 20 By using calculator:


1) Solve Ly = b, → 2.1213 1.2248 0 𝑦2 = 36 →𝑦 1 = 14.1423
2.8285 0.8164 1.1546 𝑦3 48
Forward substitution 𝑦2 = 4.8988
𝑦3 = 3.4637

1.4142 2.1213 2.8285 𝑥1 14.1423 By using calculator:


𝑇
2) Solve 𝐿 x = y, → 0 1.2248 0.8164 𝑥2 = 4.8988 →𝑥 1 = 1.0001
0 0 1.1546 𝑥3 3.4637 𝑥2 = 2.0001
Backward substitution
𝑥3 = 2.9999

Solution: 𝑥1 = 1.0001 𝑥2 = 2.0001 𝑥3 = 2.9999

EXACT SOLUTION: x = (1 , 2 , 3)
MUHAMMAD MUSA BIN YUSOF
A17KA0105

2 3 4 𝑥1 9
9. Ax = b → 3 6 7 𝑥2 = 16
4 7 10 𝑥3 21

Where A is symmetric positive definite matrix. Using Cholesky factorization,

2 3 4 𝑎 0 0 𝑎 𝑏 𝑑
𝐴 = 𝐿𝐿 𝑇
→ 3 6 7 = 𝑏 𝑐 0 0 𝑐 𝑒
4 7 10 𝑑 𝑒 𝑓 0 0 𝑓
𝑎2 𝑎𝑏 𝑎𝑑
2 2
= 𝑎𝑏 𝑏 + 𝑐 𝑏𝑑 + 𝑐𝑒
𝑎𝑑 𝑏𝑑 + 𝑐𝑒 𝑑 2 + 𝑒 2 + 𝑓 2
we obtain 
𝑎2 =2 → 𝑎 = 1.4142
3
𝑎𝑏 =3 → 𝑏= = 2.1213
𝑎
4
𝑎𝑑 =4 → 𝑑= = 2.8285
𝑎
𝑏2 + 𝑐 2 = 6 → 𝑐 = √6 − 𝑏 2 = 1.2248
7 − 𝑏𝑑
𝑏𝑑 + 𝑐𝑒 =7 → 𝑒= = 0.8164
𝑐
𝑑2 + 𝑒 2 + 𝑓 2 = 10 → 𝑓 = √10 − 𝑒 2 − 𝑑 2 = 1.1546

then  𝐴 = 𝐿𝐿𝑇 , 𝑈 = 𝐿𝑇
2 3 4 1.4142 0 0 1.4142 2.1213 2.8285
𝐴 = 𝐿𝐿𝑇 → 3 6 7 = 2.1213 1.2248 0 0 1.2248 0.8164
4 7 10 2.8285 0.8164 1.1546 0 0 1.1546

1.4142 0 0 𝑦1 9 By using calculator:


1) Solve Ly = b, → 2.1213 1.2248 0 𝑦2 = 16 →𝑦 1 = 6.3640
2.8285 0.8164 1.1546 𝑦3 21
Forward substitution 𝑦2 = 2.0411
𝑦3 = 1.1545

1.4142 2.1213 2.8285 𝑥1 6.364 By using calculator:


𝑇
2) Solve 𝐿 x = y, → 0 1.2248 0.8164 𝑥2 = 2.0411 → 𝑥1 = 1.0002
0 0 1.1546 𝑥3 1.1545 𝑥2 = 1.0000
Backward substitution
𝑥3 = 0.9999

Solution: 𝑥1 = 1.0002 𝑥2 = 1.0000 𝑥3 = 0.9999

EXACT SOLUTION: x = (1 , 1 , 1)
MUHAMMAD MUSA BIN YUSOF
A17KA0105

3 −12 10 𝑥1 1
10. Ax = b → −12 64 −60 𝑥2 = −8
10 −60 60 𝑥3 10

Where A is symmetric positive definite matrix. Using Cholesky factorization,

3 −12 10 𝑎 0 0 𝑎 𝑏 𝑑
𝐴 = 𝐿𝐿 𝑇
→ −12 64 −60 = 𝑏 𝑐 0 0 𝑐 𝑒
10 −60 60 𝑑 𝑒 𝑓 0 0 𝑓
2
𝑎 𝑎𝑏 𝑎𝑑
2 2
= 𝑎𝑏 𝑏 + 𝑐 𝑏𝑑 + 𝑐𝑒
𝑎𝑑 𝑏𝑑 + 𝑐𝑒 𝑑 2 + 𝑒 2 + 𝑓 2
we obtain 
𝑎2 =3 → 𝑎 = 1.7321
−12
𝑎𝑏 = −12 → 𝑏 = = −6.9280
𝑎
10
𝑎𝑑 = 10 → 𝑑= = 5.7733
𝑎
𝑏2 + 𝑐 2 = 64 → 𝑐 = √64 − 𝑏 2 = 4.0004
−60 − 𝑏𝑑
𝑏𝑑 + 𝑐𝑒 = −60 → 𝑒 = = −5.0001
𝑐
𝑑2 + 𝑒 2 + 𝑓 2 = 60 → 𝑓 = √60 − 𝑒 2 − 𝑑 2 = 1.2915

then  𝐴 = 𝐿𝐿𝑇 , 𝑈 = 𝐿𝑇
3 −12 10 1.7321 0 0 1.7321 −6.928 5.7733
𝐴 = 𝐿𝐿𝑇 → −12 64 −60 = −6.928 4.0004 0 0 4.0004 −5.0001
10 −60 60 5.7733 −5.0001 1.2915 0 0 1.2915

1.7321 0 0 𝑦1 1 By using calculator:


1) Solve Ly = b, → −6.928 4.0004 0 𝑦2 = −8 → 𝑦1 = 0.5773
5.7733 −5.0001 1.2915 𝑦3 10 𝑦2 = −1.0000
Forward substitution
𝑦3 = 1.2907

1.7321 −6.928 5.7733 𝑥1 0.5773 By using calculator:


𝑇
2) Solve 𝐿 x = y, → 0 4.0004 −5.0001 𝑥2 = −1.0000 → 𝑥1 = 0.9986
0 0 1.2915 𝑥3 1.2907 𝑥2 = 0.9992
Backward substitution
𝑥3 = 0.9994

Solution: 𝑥1 = 0.9986 𝑥2 = 0.9992 𝑥3 = 0.9994

EXACT SOLUTION: x = (1 , 1 , 1)
MUHAMMAD MUSA BIN YUSOF
A17KA0105

3 −12 10 𝑥1 −5
11. Ax = b → −12 64 −60 𝑥2 = 32
10 −60 60 𝑥3 −30

Where A is symmetric positive definite matrix. Using Cholesky factorization,

3 −12 10 𝑎 0 0 𝑎 𝑏 𝑑
𝐴 = 𝐿𝐿 𝑇
→ −12 64 −60 = 𝑏 𝑐 0 0 𝑐 𝑒
10 −60 60 𝑑 𝑒 𝑓 0 0 𝑓
2
𝑎 𝑎𝑏 𝑎𝑑
2 2
= 𝑎𝑏 𝑏 + 𝑐 𝑏𝑑 + 𝑐𝑒
𝑎𝑑 𝑏𝑑 + 𝑐𝑒 𝑑 2 + 𝑒 2 + 𝑓 2
we obtain 
𝑎2 =3 → 𝑎 = 1.7321
−12
𝑎𝑏 = −12 → 𝑏 = = −6.9280
𝑎
10
𝑎𝑑 = 10 → 𝑑= = 5.7733
𝑎
𝑏2 + 𝑐 2 = 64 → 𝑐 = √64 − 𝑏 2 = 4.0004
−60 − 𝑏𝑑
𝑏𝑑 + 𝑐𝑒 = −60 → 𝑒 = = −5.0001
𝑐
𝑑2 + 𝑒 2 + 𝑓 2 = 60 → 𝑓 = √60 − 𝑒 2 − 𝑑 2 = 1.2915

then  𝐴 = 𝐿𝐿𝑇 , 𝑈 = 𝐿𝑇
3 −12 10 1.7321 0 0 1.7321 −6.928 5.7733
𝐴 = 𝐿𝐿𝑇 → −12 64 −60 = −6.928 4.0004 0 0 4.0004 −5.0001
10 −60 60 5.7733 −5.0001 1.2915 0 0 1.2915

1.7321 0 0 𝑦1 −5 By using calculator:


1) Solve Ly = b, → −6.928 4.0004 0 𝑦2 = 32 →𝑦 1 = −2.8867
5.7733 −5.0001 1.2915 𝑦3 −30 𝑦2 = 3.0000
Forward substitution
𝑦3 = 1.2899

1.7321 −6.928 5.7733 𝑥1 −2.8867 By using calculator:


𝑇
2) Solve 𝐿 x = y, → 0 4.0004 −5.0001 𝑥2 = 3 → 𝑥1 = 2.9971
0 0 1.2915 𝑥3 1.2899 𝑥2 = 1.9983
Backward substitution
𝑥3 = 0.9988

Solution: 𝑥1 = 2.9971 𝑥2 = 1.9983 𝑥3 = 0.9988

EXACT SOLUTION: x = (3 , 2 , 1)
MUHAMMAD MUSA BIN YUSOF
A17KA0105

Cholesky factorization TEMPLATE

𝑥1
Ax = b → 𝑥2 =
𝑥3

Where A is symmetric positive definite matrix. Using Cholesky factorization,

𝑎 0 0 𝑎 𝑏 𝑑
𝐴 = 𝐿𝐿 𝑇
→ = 𝑏 𝑐 0 0 𝑐 𝑒
𝑑 𝑒 𝑓 0 0 𝑓
𝑎2 𝑎𝑏 𝑎𝑑
2 2
= 𝑎𝑏 𝑏 + 𝑐 𝑏𝑑 + 𝑐𝑒
𝑎𝑑 𝑏𝑑 + 𝑐𝑒 𝑑 2 + 𝑒 2 + 𝑓 2
we obtain 
𝑎2 = → 𝑎=
𝑎𝑏 = → 𝑏=
𝑎
𝑎𝑑 = → 𝑑=
𝑎
2 2
𝑏 +𝑐 = → 𝑐 = √−𝑏 2
−𝑏𝑑
𝑏𝑑 + 𝑐𝑒 = → 𝑒=
𝑐
2 2 2
𝑑 + 𝑒 + 𝑓 = → 𝑓 = √−𝑒 2 − 𝑑 2

then  𝐴 = 𝐿𝐿𝑇 , 𝑈 = 𝐿𝑇
𝑎 0 0 𝑎 𝑏 𝑑
𝐴 = 𝐿𝐿 𝑇
→ = 𝑏 𝑐 0 0 𝑐 𝑒
𝑑 𝑒 𝑓 0 0 𝑓

0 0 𝑦1 By using calculator:
1) Solve Ly = b, → 0 𝑦2 = → 𝑦1 =
Forward substitution
𝑦3 𝑦2 =
𝑦3 =

𝑥1 By using calculator:
2) Solve 𝐿𝑇 x = y, → 0 𝑥2 = → 𝑥1 =
0 0 𝑥3 𝑥2 =
Backward substitution
𝑥3 =

Solution: 𝑥1 = 𝑥2 = 𝑥3 =
MUHAMMAD MUSA BIN YUSOF
A17KA0105

Solve the following tridiagonal system using


a) Thomas factorization method
b) Thomas algorithm

2 −1 0 𝑥1 1
14. a) Ax = b → −1 2 −1 𝑥2 = 2
0 −1 2 𝑥3 3

Using Thomas factorization,

𝑑1 𝑒1 0 2 −1 0 𝛼1 0 0 1 𝛽1 0
𝐴 = 𝐿𝑈 → 𝑐2 𝑑2 𝑒2 = −1 2 −1 = 𝑐2 𝛼2 0 0 1 𝛽2
0 𝑐3 𝑑3 0 −1 2 0 𝑐3 𝛼3 0 0 1
𝛼1 𝛼1 𝛽1 0
= 𝑐2 𝑐2 𝛽1 + 𝛼2 𝛼2 𝛽2
0 𝑐3 𝑐3 𝛽2 + 𝛼3
we obtain 
𝛼1 = 2.0000
−1
𝛼1 𝛽1 = −1 → 𝛽1 = = −0.5000
𝛼1
𝑐2 𝛽1 + 𝛼2 =2 → 𝛼2 = 2 − 𝑐2 𝛽1 = 1.5000
−1
𝛼2 𝛽2 = −1 → 𝛽2 = = −0.6667
𝛼2
𝑐3 𝛽2 + 𝛼3 =2 → 𝛼3 = 2 − 𝑐3 𝛽2 = 1.3333

2 −1 0 2 0 0 1 −0.5 0
then  𝐴 = 𝐿𝑈 → −1 2 −1 = −1 1.5 0 0 1 −0.6667
0 −1 2 0 −1 1.3333 0 0 1

2 0 0 𝑤1 1 By using calculator:
1) Solve Lw = b, → −1 1.5 0 𝑤2 = 2 → 𝑤1 = 0.5
0 −1 1.3333 𝑤3 3
Forward substitution 𝑤2 = 1.6667
𝑤3 = 3.5001

1 −0.5 0 𝑥1 0.5 By using calculator:


2) Solve Ux = w, → 0 1 −0.6667 𝑥2 = 1.6667 → 𝑥1 = 2.5001
0 0 1 𝑥3 3.5001 𝑥2 = 4.0002
Backward substitution
𝑥3 = 3.5001

Solution: 𝑥1 = 2.5001 𝑥2 = 4.0002 𝑥3 = 3.5001

EXACT SOLUTION: x = (2.5 , 4.0 , 3.5)


MUHAMMAD MUSA BIN YUSOF
A17KA0105

2 −1 0 𝑥1 1
14. b) Ax = b → −1 2 −1 𝑥2 = 2
0 −1 2 𝑥3 3

Using Thomas algorithm,

𝛼1 = 𝑑1
𝛼𝑖 = 𝑑𝑖 − 𝑐𝑖 𝛽𝑖−1 , 𝑖 = 2 ,3 ,…,𝑛
𝑒𝑖
𝛽𝑖 = , 𝑖 = 1 ,2 ,3 ,…,𝑛 − 1
𝛼𝑖
𝑏1
𝑤1 =
𝛼1
𝑤𝑖 = (𝑏𝑖 − 𝑐𝑖 𝑤𝑖−1 )/𝛼𝑖 , 𝑖 = 2 ,3 ,…,𝑛
𝑥𝑛 = 𝑤𝑛
𝑥𝑖 = 𝑤𝑖 − 𝛽𝑖 𝑥𝑖+1 , 𝑖 = 𝑛 − 1 ,𝑛 − 2 ,…,1

𝑖 1 2 3 4
𝑑𝑖 2 2 2 Type equation here.

𝑒𝑖 −1 −1 0 Type equation here.

𝑐𝑖 0 −1 −1 Type equation here.

Type equation here.


𝑏𝑖 1 2 3

(𝛼1 = 𝑑1 )
2 1.5 1.3333 Type equation here.
𝛼𝑖 = 𝑑𝑖 − 𝑐𝑖 𝛽𝑖−1

𝛽𝑖 = 𝑒𝑖 /𝛼𝑖 −0.5 −0.6667 0 Type equation here.

(𝑤1 = 𝑏1 /𝛼1 )
0.5 1.6667 3.5001 Type equation here.
𝑤𝑖 = (𝑏𝑖 − 𝑐𝑖 𝑤𝑖−1 )/𝛼𝑖

𝑥3 = 𝑤3
2.5001 4.0002 3.5001 Type equation here.
𝑥𝑖 = 𝑤𝑖 − 𝛽𝑖 𝑥𝑖+1

Solution: 𝑥1 = 2.5001 𝑥2 = 4.0002 𝑥3 = 3.5001

EXACT SOLUTION: x = (2.5 , 4.0 , 3.5)


MUHAMMAD MUSA BIN YUSOF
A17KA0105

1 2 0 0 𝑥1 7
15. a) Ax = b → 2 3 −1 0 𝑥2 = 9
0 4 2 3 𝑥3 10
0 0 2 −4 𝑥4 12

Using Thomas factorization,

𝑑1 𝑒1 0 0 𝛼1 0 0 0 1 𝛽1 0 0
𝐴 = 𝐿𝑈 → 𝑐2 𝑑2 𝑒2 0 = 𝑐2 𝛼2 0 0 0 1 𝛽2 0
0 𝑐3 𝑑3 𝑒3 0 𝑐3 𝛼3 0 0 0 1 𝛽3
0 0 𝑐4 𝑑4 0 0 𝑐4 𝛼4 0 0 0 1

𝛼1 𝛼1 𝛽1 0 0
= 𝑐2 𝑐2 𝛽1 + 𝛼2 𝛼2 𝛽2 0
0 𝑐3 𝑐3 𝛽2 + 𝛼3 𝛼3 𝛽3
0 0 𝑐4 𝑐4 𝛽3 + 𝛼4

we obtain 
𝛼1 = 1.0000
2
𝛼1 𝛽1 =2 → 𝛽1 = = 2.0000
𝛼1
𝑐2 𝛽1 + 𝛼2 = 3 → 𝛼2 = 3 − 𝑐2 𝛽1 = −1.0000
−1
𝛼2 𝛽2 = −1 → 𝛽2 = = 1.0000
𝛼2
𝑐3 𝛽2 + 𝛼3 = 2 → 𝛼3 = 2 − 𝑐3 𝛽2 = −2.0000
3
𝛼3 𝛽3 =3 → 𝛽3 = = −1.5000
𝛼3
𝑐4 𝛽3 + 𝛼4 = −4 → 𝛼4 = −4 − 𝑐4 𝛽3 = −1.0000

1 2 0 0 1 0 0 0 1 2 0 0
then  𝐴 = 𝐿𝑈 → 2 3 −1 0 = 2 −1 0 0 0 1 1 0
0 4 2 3 0 4 −2 0 0 0 1 −1.5
0 0 2 −4 0 0 2 −1 0 0 0 1

By using calculator:
1 0 0 0 𝑤1 7
1) Solve Lw = b, → 2 −1 0 0 𝑤2 = 9 → 𝑤1 = 7.0000
𝑤2 = 5.0000
0 4 −2 0 𝑤3 10
Forward substitution 𝑤3 = 5.0000
0 0 2 −1 𝑤4 12
𝑤4 = −2.0000
By using calculator:
1 2 0 0 𝑥1 7 𝑥1 = 1.0000
2) Solve Ux = w, → 0 1 1 0 𝑥2 = 5 → 𝑥2 = 3.0000
0 0 1 −1.5 𝑥3 5 𝑥3 = 2.0000
Backward substitution
0 0 0 1 𝑥4 −2 𝑥4 = −2.0000

Solution: 𝑥1 = 1.0000 𝑥2 = 3.0000 𝑥3 = 2.0000 𝑥4 = −2.0000

EXACT SOLUTION: x = (1 , 3 , 2 , -2)


MUHAMMAD MUSA BIN YUSOF
A17KA0105

1 2 0 0 𝑥1 7
15. b) Ax = b → 2 3 −1 0 𝑥2 = 9
0 4 2 3 𝑥3 10
0 0 2 −4 𝑥4 12

Using Thomas algorithm,

𝛼1 = 𝑑1
𝛼𝑖 = 𝑑𝑖 − 𝑐𝑖 𝛽𝑖−1 , 𝑖 = 2 ,3 ,…,𝑛
𝑒𝑖
𝛽𝑖 = , 𝑖 = 1 ,2 ,3 ,…,𝑛 − 1
𝛼𝑖
𝑏1
𝑤1 =
𝛼1
𝑤𝑖 = (𝑏𝑖 − 𝑐𝑖 𝑤𝑖−1 )/𝛼𝑖 , 𝑖 = 2 ,3 ,…,𝑛
𝑥𝑛 = 𝑤𝑛
𝑥𝑖 = 𝑤𝑖 − 𝛽𝑖 𝑥𝑖+1 , 𝑖 = 𝑛 − 1 ,𝑛 − 2 ,…,1

𝑖 1 2 3 4
𝑑𝑖 1 3 2 −4

𝑒𝑖 2 −1 3 0

𝑐𝑖 0 2 4 2

𝑏𝑖 7 9 10 12

(𝛼1 = 𝑑1 )
1 −1 −2 −1
𝛼𝑖 = 𝑑𝑖 − 𝑐𝑖 𝛽𝑖−1

𝛽𝑖 = 𝑒𝑖 /𝛼𝑖 2 1 −1.5 0

(𝑤1 = 𝑏1 /𝛼1 )
7 5 5 −2
𝑤𝑖 = (𝑏𝑖 − 𝑐𝑖 𝑤𝑖−1 )/𝛼𝑖

𝑥4 = 𝑤4
1.0000 3.0000 2.0000 −2.0000
𝑥𝑖 = 𝑤𝑖 − 𝛽𝑖 𝑥𝑖+1

Solution: 𝑥1 = 1.0000 𝑥2 = 3.0000 𝑥3 = 2.0000 𝑥4 = −2.0000

EXACT SOLUTION: x = (1 , 3 , 2 , -2)


MUHAMMAD MUSA BIN YUSOF
A17KA0105

1 1 0 0 𝑥1 5
16. a) Ax = b → 2 −1 5 0 𝑥2 = −9
0 3 −4 2 𝑥3 19
0 0 2 6 𝑥4 2

Using Thomas factorization,

𝑑1 𝑒1 0 0 𝛼1 0 0 0 1 𝛽1 0 0
𝐴 = 𝐿𝑈 → 𝑐2 𝑑2 𝑒2 0 = 𝑐2 𝛼2 0 0 0 1 𝛽2 0
0 𝑐3 𝑑3 𝑒3 0 𝑐3 𝛼3 0 0 0 1 𝛽3
0 0 𝑐4 𝑑4 0 0 𝑐4 𝛼4 0 0 0 1

𝛼1 𝛼1 𝛽1 0 0
= 𝑐2 𝑐2 𝛽1 + 𝛼2 𝛼2 𝛽2 0
0 𝑐3 𝑐3 𝛽2 + 𝛼3 𝛼3 𝛽3
0 0 𝑐4 𝑐4 𝛽3 + 𝛼4

we obtain 
𝛼1 = 1.0000
1
𝛼1 𝛽1 =1 → 𝛽1 = = 1.0000
𝛼1
𝑐2 𝛽1 + 𝛼2 = −1 → 𝛼2 = −1 − 𝑐2 𝛽1 = −3.0000
5
𝛼2 𝛽2 =5 → 𝛽2 = = −1.6667
𝛼2
𝑐3 𝛽2 + 𝛼3 = −4 → 𝛼3 = −4 − 𝑐3 𝛽2 = 1.0001
2
𝛼3 𝛽3 =2 → 𝛽3 = = 1.9998
𝛼3
𝑐4 𝛽3 + 𝛼4 = 6 → 𝛼4 = 6 − 𝑐4 𝛽3 = 2.0004

1 1 0 0 1 0 0 0 1 1 0 0
then  𝐴 = 𝐿𝑈 → 2 −1 5 0 = 2 −3 0 0 0 1 −1.6667 0
0 3 −4 2 0 3 1.0001 0 0 0 1 1.9998
0 0 2 −4 0 0 2 2.0004 0 0 0 1

By using calculator:
1 0 0 0 𝑤1 5
1) Solve Lw = b, → 2 −3 0 0 𝑤2 = −9 → 𝑤1 = 5.0000
𝑤2 = 6.3333
0 3 1.0001 0 𝑤3 19
Forward substitution 𝑤3 = 0.0000
0 0 2 2.0004 𝑤4 2
𝑤4 = 0.9998
By using calculator:
1 1 0 0 𝑥1 5 𝑥1 = 1.9991
2) Solve Ux = w, → 0 1 −1.6667 0 𝑥2 = 6.3333 → 𝑥2 = 3.0009
0 0 1 1.9998 𝑥3 0 𝑥3 = −1.9994
Backward substitution
0 0 0 1 𝑥4 0.9998 𝑥4 = 0.9998

Solution: 𝑥1 = 1.9991 𝑥2 = 3.0009 𝑥3 = −1.9994 𝑥4 = 0.9998

EXACT SOLUTION: x = (2 , 3 , -2 , 1)
MUHAMMAD MUSA BIN YUSOF
A17KA0105

1 1 0 0 𝑥1 5
16. b) Ax = b → 2 −1 5 0 𝑥2 = −9
0 3 −4 2 𝑥3 19
0 0 2 6 𝑥4 2

Using Thomas algorithm,

𝛼1 = 𝑑1
𝛼𝑖 = 𝑑𝑖 − 𝑐𝑖 𝛽𝑖−1 , 𝑖 = 2 ,3 ,…,𝑛
𝑒𝑖
𝛽𝑖 = , 𝑖 = 1 ,2 ,3 ,…,𝑛 − 1
𝛼𝑖
𝑏1
𝑤1 =
𝛼1
𝑤𝑖 = (𝑏𝑖 − 𝑐𝑖 𝑤𝑖−1 )/𝛼𝑖 , 𝑖 = 2 ,3 ,…,𝑛
𝑥𝑛 = 𝑤𝑛
𝑥𝑖 = 𝑤𝑖 − 𝛽𝑖 𝑥𝑖+1 , 𝑖 = 𝑛 − 1 ,𝑛 − 2 ,…,1

𝑖 1 2 3 4
𝑑𝑖 1 −1 −4 6

𝑒𝑖 1 5 2 0

𝑐𝑖 0 2 3 2

𝑏𝑖 5 −9 19 2

(𝛼1 = 𝑑1 )
1 −3 1.0001 2.0004
𝛼𝑖 = 𝑑𝑖 − 𝑐𝑖 𝛽𝑖−1

𝛽𝑖 = 𝑒𝑖 /𝛼𝑖 1 −1.6667 1.9998 0

(𝑤1 = 𝑏1 /𝛼1 )
5 6.3333 0.0001 0.9998
𝑤𝑖 = (𝑏𝑖 − 𝑐𝑖 𝑤𝑖−1 )/𝛼𝑖

𝑥4 = 𝑤4
1.9989 3.0011 −1.9993 0.9998
𝑥𝑖 = 𝑤𝑖 − 𝛽𝑖 𝑥𝑖+1

Solution: 𝑥1 = 1.9989 𝑥2 = 3.0011 𝑥3 = −1.9993 𝑥4 = 0.9998

EXACT SOLUTION: x = (2 , 3 , -2 , 1)
MUHAMMAD MUSA BIN YUSOF
A17KA0105

5 2 0 0 𝑥1 16
17. a) Ax = b → 2 3 1 0 𝑥2 = 15
0 1 2 −1 𝑥3 4
0 0 −1 2 𝑥4 4

Using Thomas factorization,

𝑑1 𝑒1 0 0 𝛼1 0 0 0 1 𝛽1 0 0
𝐴 = 𝐿𝑈 → 𝑐2 𝑑2 𝑒2 0 = 𝑐2 𝛼2 0 0 0 1 𝛽2 0
0 𝑐3 𝑑3 𝑒3 0 𝑐3 𝛼3 0 0 0 1 𝛽3
0 0 𝑐4 𝑑4 0 0 𝑐4 𝛼4 0 0 0 1

𝛼1 𝛼1 𝛽1 0 0
= 𝑐2 𝑐2 𝛽1 + 𝛼2 𝛼2 𝛽2 0
0 𝑐3 𝑐3 𝛽2 + 𝛼3 𝛼3 𝛽3
0 0 𝑐4 𝑐4 𝛽3 + 𝛼4

we obtain 
𝛼1 = 5.0000
2
𝛼1 𝛽1 =2 → 𝛽1 = = 0.4000
𝛼1
𝑐2 𝛽1 + 𝛼2 = 3 → 𝛼2 = 3 − 𝑐2 𝛽1 = 2.2000
1
𝛼2 𝛽2 =1 → 𝛽2 = = 0.4545
𝛼2
𝑐3 𝛽2 + 𝛼3 = 2 → 𝛼3 = 2 − 𝑐3 𝛽2 = 1.5455
−1
𝛼3 𝛽3 = −1 → 𝛽3 = = −0.6470
𝛼3
𝑐4 𝛽3 + 𝛼4 = 2 → 𝛼4 = 2 − 𝑐4 𝛽3 = 1.3530

1 1 0 0 5 0 0 0 1 0.4 0 0
then  𝐴 = 𝐿𝑈 → 2 −1 5 0 = 2 2.2 0 0 0 1 0.4545 0
0 3 −4 2 0 1 1.5455 0 0 0 1 −0.647
0 0 2 −4 0 0 −1 1.353 0 0 0 1

By using calculator:
5 0 0 0 𝑤1 16
1) Solve Lw = b, → 2 2.2 0 0 𝑤2 = 15 → 𝑤1 = 3.2000
𝑤2 = 3.9091
0 1 1.5455 0 𝑤3 4
Forward substitution 𝑤3 = 0.0588
0 0 −1 1.353 𝑤4 4
𝑤4 = 2.9999
By using calculator:
1 0.4 0 0 𝑥1 3.2 𝑥1 = 1.9999
2) Solve Ux = w, → 0 1 0.4545 0 𝑥2 = 3.9091 → 𝑥2 = 3.0002
0 0 1 −0.647 𝑥3 0.0588 𝑥3 = 1.9997
Backward substitution
0 0 0 1 𝑥4 2.9999 𝑥4 = 2.9999

Solution: 𝑥1 = 1.9999 𝑥2 = 3.0002 𝑥3 = 1.9997 𝑥4 = 2.9999

EXACT SOLUTION: x = (2 , 3 , 2 , 3)
MUHAMMAD MUSA BIN YUSOF
A17KA0105

5 2 0 0 𝑥1 16
17. b) Ax = b → 2 3 1 0 𝑥2 = 15
0 1 2 −1 𝑥3 4
0 0 −1 2 𝑥4 4

Using Thomas algorithm,

𝛼1 = 𝑑1
𝛼𝑖 = 𝑑𝑖 − 𝑐𝑖 𝛽𝑖−1 , 𝑖 = 2 ,3 ,…,𝑛
𝑒𝑖
𝛽𝑖 = , 𝑖 = 1 ,2 ,3 ,…,𝑛 − 1
𝛼𝑖
𝑏1
𝑤1 =
𝛼1
𝑤𝑖 = (𝑏𝑖 − 𝑐𝑖 𝑤𝑖−1 )/𝛼𝑖 , 𝑖 = 2 ,3 ,…,𝑛
𝑥𝑛 = 𝑤𝑛
𝑥𝑖 = 𝑤𝑖 − 𝛽𝑖 𝑥𝑖+1 , 𝑖 = 𝑛 − 1 ,𝑛 − 2 ,…,1

𝑖 1 2 3 4
𝑑𝑖 5 3 2 2

𝑒𝑖 2 1 −1 0

𝑐𝑖 0 2 1 −1

𝑏𝑖 16 15 4 4

(𝛼1 = 𝑑1 )
5 2.2 1.5455 1.353
𝛼𝑖 = 𝑑𝑖 − 𝑐𝑖 𝛽𝑖−1

𝛽𝑖 = 𝑒𝑖 /𝛼𝑖 0.4 0.4545 −0.647 0

(𝑤1 = 𝑏1 /𝛼1 )
3.2 3.9091 0.0588 2.9999
𝑤𝑖 = (𝑏𝑖 − 𝑐𝑖 𝑤𝑖−1 )/𝛼𝑖

𝑥4 = 𝑤4
1.9999 3.0002 1.9997 2.9999
𝑥𝑖 = 𝑤𝑖 − 𝛽𝑖 𝑥𝑖+1

Solution: 𝑥1 = 1.9999 𝑥2 = 3.0002 𝑥3 = 1.9997 𝑥4 = 2.9999

EXACT SOLUTION: x = (2 , 3 , 2 , 3)
MUHAMMAD MUSA BIN YUSOF
A17KA0105

Thomas factorization TEMPLATE

𝑥1
Ax = b → 𝑥2 =
𝑥3

Using Thomas factorization,

𝑑1 𝑒1 0 𝛼1 0 0 1 𝛽1 0
𝐴 = 𝐿𝑈 → 𝑐2 𝑑2 𝑒2 = 𝑐2 𝛼2 0 0 1 𝛽2
0 𝑐3 𝑑3 0 𝑐3 𝛼3 0 0 1
𝛼1 𝛼1 𝛽1 0
= 𝑐2 𝑐2 𝛽1 + 𝛼2 𝛼2 𝛽2
0 𝑐3 𝑐3 𝛽2 + 𝛼3
we obtain 
𝛼1 = 𝑑1
𝑒1
𝛼1 𝛽1 = 𝑒1 → 𝛽1 = =
𝛼1
𝑐2 𝛽1 + 𝛼2 = 𝑑2 → 𝛼2 = 𝑑2 − 𝑐2 𝛽1 =
𝑒2
𝛼2 𝛽2 = 𝑒2 → 𝛽2 = =
𝛼2
𝑐3 𝛽2 + 𝛼3 = 𝑑3 → 𝛼3 = 𝑑3 − 𝑐3 𝛽2 =

𝑑1 𝑒1 0 𝛼1 0 0 1 𝛽1 0
then  𝐴 = 𝐿𝑈 → 𝑐2 𝑑2 𝑒2 = 𝑐2 𝛼2 0 0 1 𝛽2
0 𝑐3 𝑑3 0 𝑐3 𝛼3 0 0 1

𝑤1 By using calculator:
1) Solve Lw = b, → 𝑤2 = → 𝑤1 =
Forward substitution
𝑤3 𝑤2 =
𝑤3 =
𝑥1 By using calculator:
2) Solve Ux = w, → 𝑥2 = → 𝑥1 =
Backward substitution
𝑥3 𝑥2 =
𝑥3 =

Solution: 𝑥1 = 𝑥2 = 𝑥3 =
MUHAMMAD MUSA BIN YUSOF
A17KA0105

Thomas algorithm TEMPLATE

𝑥1
Ax = b → 𝑥2 =
𝑥3

Using Thomas algorithm,

𝛼1 = 𝑑1
𝛼𝑖 = 𝑑𝑖 − 𝑐𝑖 𝛽𝑖−1 , 𝑖 = 2 ,3 ,…,𝑛
𝑒𝑖
𝛽𝑖 = , 𝑖 = 1 ,2 ,3 ,…,𝑛 − 1
𝛼𝑖
𝑏1
𝑤1 =
𝛼1
𝑤𝑖 = (𝑏𝑖 − 𝑐𝑖 𝑤𝑖−1 )/𝛼𝑖 , 𝑖 = 2 ,3 ,…,𝑛
𝑥𝑛 = 𝑤𝑛
𝑥𝑖 = 𝑤𝑖 − 𝛽𝑖 𝑥𝑖+1 , 𝑖 = 𝑛 − 1 ,𝑛 − 2 ,…,1

𝑖 1 2 3 4
𝑑𝑖 Type equation here. Type equation here. Type equation here. Type equation here.

𝑒𝑖 Type equation here. Type equation here. Type equation here. Type equation here.

𝑐𝑖 Type equation here. Type equation here. Type equation here. Type equation here.

Type equation here. Type equation here. Type equation here. Type equation here.
𝑏𝑖

(𝛼1 = 𝑑1 )
Type equation here. Type equation here. Type equation here. Type equation here.
𝛼𝑖 = 𝑑𝑖 − 𝑐𝑖 𝛽𝑖−1

𝛽𝑖 = 𝑒𝑖 /𝛼𝑖 Type equation here. Type equation here. Type equation here. Type equation here.

(𝑤1 = 𝑏1 /𝛼1 )
Type equation here. Type equation here. Type equation here. Type equation here.
𝑤𝑖 = (𝑏𝑖 − 𝑐𝑖 𝑤𝑖−1 )/𝛼𝑖

𝑥𝑛 = 𝑤𝑛
Type equation here. Type equation here. Type equation here. Type equation here.
𝑥𝑖 = 𝑤𝑖 − 𝛽𝑖 𝑥𝑖+1

Solution: 𝑥1 = 𝑥2 = 𝑥3 =
MUHAMMAD MUSA BIN YUSOF
A17KA0105

ITERATIVE METHOD
***Exercise 2.3
Solve the following linear system using :
(a) Jacobi iterative method
(b) Gauss-Seidel iterative method

With initial guess 𝐱 (0) = 𝟎. Shown the calculation in 3DP and let ε = 0.005. if possible,
rearrange the given system of linear equations into strictly diagonally dominant system to
ensure the method is convergence.
(Note: Stop after 10 iteration if the method still not converge)

10 3 1 𝑥1 38 |10| > |3| + |1|


1. a) Ax = b → 2 −10 3 𝑥2 = −37 |−10| > |2| + |3| *no need to rearrange
1 2 10 𝑥3 42 |10| > |1| + |2|

Coefficient matrix A is diagonally dominant, thus Jacobi iteration converges.


Using Jacobi iteration,
(𝑘) (𝑘) (𝑘) (𝑘)
(𝑘+1) 𝑏1 − 𝑎12 𝑥2 − 𝑎13 𝑥3 38 − 3𝑥2 − 1𝑥3
𝑥1 = =
𝑎11 10
(𝑘) (𝑘) (𝑘) (𝑘)
(𝑘+1) 𝑏2 − 𝑎21 𝑥1 − 𝑎23 𝑥3 −37 − 2𝑥1 − 3𝑥3 Starting with 𝐱 (0) = 𝟎 = (0 , 0 , 0)
𝑥2 = =
𝑎22 −10 3DP  Let ε = 0.005
(𝑘) (𝑘) (𝑘) (𝑘)
(𝑘+1) 𝑏3 − 𝑎31 𝑥1 − 𝑎32 𝑥2 42 − 1𝑥1 − 2𝑥2
𝑥3 = =
𝑎33 10

(𝑘) (𝑘) (𝑘)


𝑘 A  𝑥1 B  𝑥2 C  𝑥3
0 0.000 0.000 0.000
1 3.800 3.700 4.200
2 2.270 5.720 2.980
3 1.486 5.048 2.829
4 2.003 4.846 3.042
5 2.042 5.013 3.031
6 1.993 5.018 2.993
7 1.995 4.997 2.997
8 2.001 4.998 3.001
9 2.001 5.001 3.000

(9)
‖𝐱 (9) − 𝐱 (8) ‖∞ = max {|𝑥𝑖 − 𝑥𝑖(8) |}
1≤𝑖≤3
= max {|𝑥19 − 𝑥18 | , |𝑥29 − 𝑥28 | , |𝑥39 − 𝑥38 |}
( ) ( ) ( ) ( ) ( ) ( )

= max{0.000 , 0.003 , 00001}


= 0.003 < ε = 0.005
𝐱 ≈ 𝐱 (9) = (𝟐. 𝟎𝟎𝟏 , 𝟓. 𝟎𝟎𝟏 , 𝟑. 𝟎𝟎𝟎)
SOLUTION → 𝑥1 = 2.001 𝑥2 = 5.001 𝑥3 = 3.000
MUHAMMAD MUSA BIN YUSOF
A17KA0105

10 3 1 𝑥1 38 |10| > |3| + |1|


1. b) Ax = b → 2 −10 3 𝑥2 = −37 |−10| > |2| + |3| *no need to rearrange
1 2 10 𝑥3 42 |10| > |1| + |2|

Coefficient matrix A is diagonally dominant, thus Gauss-Seidel iteration converges.


Using Gauss-Seidel iteration,

(𝑘) (𝑘) (𝑘) (𝑘)


(𝑘+1) 𝑏1 − 𝑎12 𝑥2 − 𝑎13 𝑥3 38 − 3𝑥2 − 1𝑥3
𝑥1 = =
𝑎11 10
(𝑘+1) (𝑘) (𝑘+1) (𝑘)
(𝑘+1) 𝑏2 − 𝑎21 𝑥1 − 𝑎23 𝑥3 −37 − 2𝑥1 − 3𝑥3 Starting with 𝐱 (0) = 𝟎 = (0 , 0 , 0)
𝑥2 = = 3DP  Let ε = 0.005
𝑎22 −10
(𝑘+1) (𝑘+1) (𝑘+1) (𝑘+1)
(𝑘+1) 𝑏3 − 𝑎31 𝑥1 − 𝑎32 𝑥2 42 − 1𝑥1 − 2𝑥2
𝑥3 = =
𝑎33 10

(𝑘) (𝑘) (𝑘)


𝑘 A  𝑥1 B  𝑥2 C  𝑥3
0 0.000 0.000 0.000
1 3.800 4.460 2.928
2 2.169 5.012 2.981
3 1.998 4.994 3.001
4 2.002 5.001 3.000
5 2.000 5.000 3.000

5
( ) 4 ( )
‖𝐱 (5) − 𝐱 (4) ‖∞ = max {|𝑥𝑖 − 𝑥𝑖 |}
1≤𝑖≤3
= max {|𝑥15 − 𝑥14 | , |𝑥25 − 𝑥24 | , |𝑥35 − 𝑥34 |}
( ) ( ) ( ) ( ) ( ) ( )

= max{0.002 , 0.001 , 0.000}


= 0.002 < ε = 0.005
𝐱 ≈ 𝐱 (5) = (𝟐. 𝟎𝟎𝟎 , 𝟓. 𝟎𝟎𝟎 , 𝟑. 𝟎𝟎𝟎)
SOLUTION → 𝑥1 = 2.000 𝑥2 = 5.000 𝑥3 = 3.000
MUHAMMAD MUSA BIN YUSOF
A17KA0105

10 −1 0 𝑥1 25 |10| > |−1| + |0|


2. a) Ax = b → −1 10 −2 𝑥2 = 41 |10| > |−1| + |−2| *no need to rearrange
0 −1 5 𝑥3 10 |5| > |0| + |−1|

Coefficient matrix A is diagonally dominant, thus Jacobi iteration converges.


Using Jacobi iteration,

(𝑘) (𝑘) (𝑘) (𝑘)


(𝑘+1) 𝑏1 − 𝑎12 𝑥2 − 𝑎13 𝑥3 25 + 1𝑥2 − 0𝑥3
𝑥1 = =
𝑎11 10
(𝑘) (𝑘) (𝑘) (𝑘)
(𝑘+1) 𝑏2 − 𝑎21 𝑥1 − 𝑎23 𝑥3 41 + 1𝑥1 + 2𝑥3 Starting with 𝐱 (0) = 𝟎 = (0 , 0 , 0)
𝑥2 = = 3DP  Let ε = 0.005
𝑎22 10
(𝑘) (𝑘) (𝑘) (𝑘)
(𝑘+1) 𝑏3 − 𝑎31 𝑥1 − 𝑎32 𝑥2 10 − 0𝑥1 + 1𝑥2
𝑥3 = =
𝑎33 5

(𝑘) (𝑘) (𝑘)


𝑘 A  𝑥1 B  𝑥2 C  𝑥3
0 0.000 0.000 0.000
1 2.500 4.100 2.000
2 2.910 4.750 2.820
3 2.975 4.955 2.950
4 2.996 4.988 2.991
5 2.999 4.988 2.998
6 2.999 5.000 2.998

6( ) 5 ( )
‖𝐱 (6) − 𝐱 (5) ‖∞ = max {|𝑥𝑖 − 𝑥𝑖 |}
1≤𝑖≤3
(6) (5) (6) (5) (6) (5)
= max {|𝑥1 − 𝑥1 | , |𝑥2 − 𝑥2 | , |𝑥3 − 𝑥3 |}
= max{0.000 , 0.002 , 0.000}
= 0.002 < ε = 0.005
(6)
𝐱≈𝐱 = (𝟐. 𝟗𝟗𝟗 , 𝟓. 𝟎𝟎𝟎 , 𝟐. 𝟗𝟗𝟖)
SOLUTION → 𝑥1 = 2.999 𝑥2 = 5.000 𝑥3 = 2998
MUHAMMAD MUSA BIN YUSOF
A17KA0105

10 −1 0 𝑥1 25 |10| > |−1| + |0|


2. b) Ax = b → −1 10 −2 𝑥2 = 41 |10| > |−1| + |−2| *no need to rearrange
0 −1 5 𝑥3 10 |5| > |0| + |−1|

Coefficient matrix A is diagonally dominant, thus Gauss-Seidel iteration converges.


Using Gauss-Seidel iteration,

(𝑘) (𝑘) (𝑘)


(𝑘+1) 𝑏1 − 𝑎12 𝑥2 − 𝑎13 𝑥3 25 ∓ 1 − 0𝑥3
𝑥1 = =
𝑎11 10
(𝑘+1) (𝑘) (𝑘+1) (𝑘)
(𝑘+1) 𝑏2 − 𝑎21 𝑥1 − 𝑎23 𝑥3 41 + 1𝑥1 + 2𝑥3 Starting with 𝐱 (0) = 𝟎 = (0 , 0 , 0)
𝑥2 = = 3DP  Let ε = 0.005
𝑎22 10
(𝑘+1) (𝑘+1) (𝑘+1) (𝑘+1)
(𝑘+1) 𝑏3 − 𝑎31 𝑥1 − 𝑎32 𝑥2 10 − 0𝑥1 + 1𝑥2
𝑥3 = =
𝑎33 5

(𝑘) (𝑘) (𝑘)


𝑘 A  𝑥1 B  𝑥2 C  𝑥3
0 0.000 0.000 0.000
1 2.500 4.350 2.870
2 2.935 4.968 2.994
3 2.997 4.998 3.000
4 3.000 5.000 3.000

4
( ) 3 ( )
‖𝐱 (4) − 𝐱 (3) ‖∞ = max {|𝑥𝑖 − 𝑥𝑖 |}
1≤𝑖≤3
(4) (3) (4) (3) (4) (3)
= max {|𝑥1 − 𝑥1 | , |𝑥2 − 𝑥2 | , |𝑥3 − 𝑥3 |}
= max{0.003 , 0.002 , 0.000}
= 0.003 < ε = 0.005
𝐱 ≈ 𝐱 (4) = (𝟑. 𝟎𝟎𝟎 , 𝟓. 𝟎𝟎𝟎 , 𝟑. 𝟎𝟎𝟎)
SOLUTION → 𝑥1 = 3.000 𝑥2 = 5.000 𝑥3 = 3.000
MUHAMMAD MUSA BIN YUSOF
A17KA0105

10 −5 1 𝑥1 2 |10| > |−5| + |1|


3. a) Ax = b → 4 11 4 𝑥2 = 25 |11| > |4| + |4| *cannot be rearranged
4 −5 −6 𝑥3 41 |−6| < |4| + |−5|

Coefficient matrix A is diagonally dominant, thus Jacobi iteration converges.


Using Jacobi iteration,

(𝑘) (𝑘) (𝑘) (𝑘)


(𝑘+1) 𝑏1 − 𝑎12 𝑥2 − 𝑎13 𝑥3 2 + 5𝑥2 − 1𝑥3
𝑥1 = =
𝑎11 10
(𝑘) (𝑘) (𝑘) (𝑘)
(𝑘+1) 𝑏2 − 𝑎21 𝑥1 − 𝑎23 𝑥3 25 − 4𝑥1 − 4𝑥3 Starting with 𝐱 (0) = 𝟎 = (0 , 0 , 0)
𝑥2 = = 3DP  Let ε = 0.005
𝑎22 11
(𝑘) (𝑘) (𝑘) (𝑘)
(𝑘+1) 𝑏3 − 𝑎31 𝑥1 − 𝑎32 𝑥2 41 − 4𝑥1 + 5𝑥2
𝑥3 = =
𝑎33 −6

(𝑘) (𝑘) (𝑘)


𝑘 A  𝑥1 B  𝑥2 C  𝑥3
0 0.000 0.000 0.000
1 0.200 2.273 - 6.833
2 2.020 4.685 - 8.594
3 3.402 4.663 - 9.391
4 3.471 4.451 - 8.451
5 3.271 4.084 - 8.229
6 3.065 4.076 - 8.056
7 3.044 4.088 - 8.187
8 3.063 4.143 - 8.211
9 3.093 4.145 - 8.244
10 3.097 4.146 - 8.226

𝑺𝒕𝒐𝒑 𝒂𝒇𝒕𝒆𝒓 𝟏𝟎 𝒊𝒕𝒆𝒓𝒂𝒕𝒊𝒐𝒏. 𝑻𝒉𝒆 𝒎𝒆𝒕𝒉𝒐𝒅 𝒔𝒕𝒊𝒍𝒍 𝒏𝒐𝒕 𝒄𝒐𝒏𝒗𝒆𝒓𝒈𝒆.


MUHAMMAD MUSA BIN YUSOF
A17KA0105

10 −5 1 𝑥1 2 |10| > |−5| + |1|


3. b) Ax = b → 4 11 4 𝑥2 = 25 |11| > |4| + |4| *cannot be rearranged
4 −5 −6 𝑥3 41 |−6| < |4| + |−5|

Coefficient matrix A is diagonally dominant, thus Gauss-Seidel iteration converges.


Using Gauss-Seidel iteration,

(𝑘) (𝑘) (𝑘) (𝑘)


(𝑘+1) 𝑏1 − 𝑎12 𝑥2 − 𝑎13 𝑥3 2 + 5𝑥2 − 1𝑥3
𝑥1 = =
𝑎11 10
(𝑘+1) (𝑘) (𝑘+1) (𝑘)
(𝑘+1) 𝑏2 − 𝑎21 𝑥1 − 𝑎23 𝑥3 25 − 4𝑥1 − 4𝑥3 Starting with 𝐱 (0) = 𝟎 = (0 , 0 , 0)
𝑥2 = = 3DP  Let ε = 0.005
𝑎22 11
(𝑘+1) (𝑘+1) (𝑘+1) (𝑘+1)
(𝑘+1) 𝑏3 − 𝑎31 𝑥1 − 𝑎32 𝑥2 41 − 4𝑥1 + 5𝑥2
𝑥3 = =
𝑎33 −6

(𝑘) (𝑘) (𝑘)


𝑘 A  𝑥1 B  𝑥2 C  𝑥3
0 0.000 0.000 0.000
1 0.200 2.200 - 8.533
2 2.153 4.593 - 9.225
3 3.419 4.384 - 8.207
4 3.213 4.089 - 8.099
5 3.054 4.107 - 8.220
6 3.076 4.143 - 8.236
7 3.095 4.142 - 8.222
8 3.093 4.138 - 8.219
9 3.091 4.138 - 8.221

9( ) 8 ( )
‖𝐱 (9) − 𝐱 (8) ‖∞ = max {|𝑥𝑖 − 𝑥𝑖 |}
1≤𝑖≤3
= max {|𝑥19 − 𝑥18 | , |𝑥29 − 𝑥28 | , |𝑥39 − 𝑥38 |}
( ) ( ) ( ) ( ) ( ) ( )

= max{0.002 , 0.000 , 0.003}


= 0.003 < ε = 0.005
(9)
𝐱≈𝐱 = (𝟑. 𝟎𝟗𝟏 , 𝟒. 𝟏𝟑𝟖 , −𝟖. 𝟐𝟐𝟏)
SOLUTION → 𝑥1 = 3.091 𝑥2 = 4.138 𝑥3 = −8.221
MUHAMMAD MUSA BIN YUSOF
A17KA0105

4 −1 1 𝑥1 7 |4| > |−1| + |1|


4. a) Ax = b → 4 −8 1 𝑥2 = −21 |−8| > |4| + |1| *no need to rearrange
−2 1 5 𝑥3 15 |5| > |−2| + |1|

Coefficient matrix A is diagonally dominant, thus Jacobi iteration converges.


Using Jacobi iteration,

(𝑘) (𝑘) (𝑘) (𝑘)


(𝑘+1) 𝑏1 − 𝑎12 𝑥2 − 𝑎13 𝑥3 7 + 1𝑥2 − 1𝑥3
𝑥1 = =
𝑎11 4
(𝑘) (𝑘) (𝑘) (𝑘)
(𝑘+1) 𝑏2 − 𝑎21 𝑥1 − 𝑎23 𝑥3 −21 − 4𝑥1 − 1𝑥3 Starting with 𝐱 (0) = 𝟎 = (0 , 0 , 0)
𝑥2 = = 3DP  Let ε = 0.005
𝑎22 −8
(𝑘) (𝑘) (𝑘) (𝑘)
(𝑘+1) 𝑏3 − 𝑎31 𝑥1 − 𝑎32 𝑥2 15 + 2𝑥1 − 1𝑥2
𝑥3 = =
𝑎33 5

(𝑘) (𝑘) (𝑘)


𝑘 A  𝑥1 B  𝑥2 C  𝑥3
0 0.000 0.000 0.000
1 1.750 2.625 3.000
2 1.656 3.875 3.175
3 1.925 3.850 2.887
4 1.991 3.948 3.000
5 1.987 3.996 3.007
6 1.997 3.994 2.996
7 2.000 3.998 3.000

7( ) 6 ( )
‖𝐱 (7) − 𝐱 (6) ‖∞ = max {|𝑥𝑖 − 𝑥𝑖 |}
1≤𝑖≤3
= max {|𝑥17 − 𝑥16 | , |𝑥27 − 𝑥26 | , |𝑥37 − 𝑥36 |}
( ) ( ) ( ) ( ) ( ) ( )

= max{0.003 , 0.004 , 0.004}


= 0.004 < ε = 0.005
(7)
𝐱≈𝐱 = (𝟐. 𝟎𝟎𝟎 , 𝟑. 𝟗𝟗𝟖 , 𝟑. 𝟎𝟎𝟎)
SOLUTION → 𝑥1 = 2.000 𝑥2 = 3.998 𝑥3 = 3.000
MUHAMMAD MUSA BIN YUSOF
A17KA0105

4 −1 1 𝑥1 7 |4| > |−1| + |1|


4. b) Ax = b → 4 −8 1 𝑥2 = −21 |−8| > |4| + |1| *no need to rearrange
−2 1 5 𝑥3 15 |5| > |−2| + |1|

Coefficient matrix A is diagonally dominant, thus Gauss-Seidel iteration converges.


Using Gauss-Seidel iteration,

(𝑘) (𝑘) (𝑘) (𝑘)


(𝑘+1) 𝑏1 − 𝑎12 𝑥2 − 𝑎13 𝑥3 7 + 1𝑥2 − 𝑥3
𝑥1 = =
𝑎11 4
(𝑘+1) (𝑘) (𝑘+1) (𝑘)
(𝑘+1) 𝑏2 − 𝑎21 𝑥1 − 𝑎23 𝑥3 −21 − 4𝑥1 − 1𝑥3 Starting with 𝐱 (0) = 𝟎 = (0 , 0 , 0)
𝑥2 = = 3DP  Let ε = 0.005
𝑎22 −8
(𝑘+1) (𝑘+1) (𝑘+1) (𝑘+1)
(𝑘+1) 𝑏3 − 𝑎31 𝑥1 − 𝑎32 𝑥2 15 + 2𝑥1 − 1𝑥2
𝑥3 = =
𝑎33 5

(𝑘) (𝑘) (𝑘)


𝑘 A  𝑥1 B  𝑥2 C  𝑥3
0 0.000 0.000 0.000
1 1.750 3.500 3.000
2 1.875 3.938 2.963
3 1.994 3.992 2.999
4 1.998 3.999 3.000
5 2.000 4.000 3.000

5
( ) 4 ( )
‖𝐱 (5) − 𝐱 (4) ‖∞ = max {|𝑥𝑖 − 𝑥𝑖 |}
1≤𝑖≤3
= max {|𝑥15 − 𝑥14 | , |𝑥25 − 𝑥24 | , |𝑥35 − 𝑥34 |}
( ) ( ) ( ) ( ) ( ) ( )

= max{0.002 , 0.001 , 0.000}


= 0.002 < ε = 0.005
𝐱 ≈ 𝐱 (5) = (𝟐. 𝟎𝟎𝟎 , 𝟒. 𝟎𝟎𝟎 , 𝟑. 𝟎𝟎𝟎)
SOLUTION → 𝑥1 = 2.000 𝑥2 = 4.000 𝑥3 = 3.000
MUHAMMAD MUSA BIN YUSOF
A17KA0105

5 −1 1 𝑥1 11 |5| > |−1| + |1|


5. a) Ax = b → 2 8 −1 𝑥2 = 17 |8| > |2| + |−1| *no need to rearrange
−1 1 7 𝑥3 21 |7| > |−1| + |1|

Coefficient matrix A is diagonally dominant, thus Jacobi iteration converges.


Using Jacobi iteration,

(𝑘) (𝑘) (𝑘) (𝑘)


(𝑘+1) 𝑏1 − 𝑎12 𝑥2 − 𝑎13 𝑥3 11 + 1𝑥2 − 1𝑥3
𝑥1 = =
𝑎11 5
(𝑘) (𝑘) (𝑘) (𝑘)
(𝑘+1) 𝑏2 − 𝑎21 𝑥1 − 𝑎23 𝑥3 17 − 2𝑥1 + 1𝑥3 Starting with 𝐱 (0) = 𝟎 = (0 , 0 , 0)
𝑥2 = = 3DP  Let ε = 0.005
𝑎22 8
(𝑘) (𝑘) (𝑘) (𝑘)
(𝑘+1) 𝑏3 − 𝑎31 𝑥1 − 𝑎32 𝑥2 21 + 1𝑥1 − 1𝑥2
𝑥3 = =
𝑎33 7

(𝑘) (𝑘) (𝑘)


𝑘 A  𝑥1 B  𝑥2 C  𝑥3
0 0.000 0.000 0.000
1 2.200 2.125 3.000
2 2.025 1.950 3.011
3 1.988 1.995 3.011
4 1.997 2.002 2.998
5 2.001 2.001 2.999

5( ) 4 ( )
‖𝐱 (5) − 𝐱 (4) ‖∞ = max {|𝑥𝑖 − 𝑥𝑖 |}
1≤𝑖≤3
(5) (4) (5) (4) (5) (4)
= max {|𝑥1 − 𝑥1 | , |𝑥2 − 𝑥2 | , |𝑥3 − 𝑥3 |}
= max{0.004 , 0.001 , 0.001}
= 0.004 < ε = 0.005
(5)
𝐱≈𝐱 = (𝟐. 𝟎𝟎𝟏 , 𝟐. 𝟎𝟎𝟏 , 𝟐. 𝟗𝟗𝟗)
SOLUTION → 𝑥1 = 2.001 𝑥2 = 2.001 𝑥3 = 2.999
MUHAMMAD MUSA BIN YUSOF
A17KA0105

5 −1 1 𝑥1 11 |5| > |−1| + |1|


5. b) Ax = b → 2 8 −1 𝑥2 = 17 |8| > |2| + |−1| *no need to rearrange
−1 1 7 𝑥3 21 |7| > |−1| + |1|

Coefficient matrix A is diagonally dominant, thus Gauss-Seidel iteration converges.


Using Gauss-Seidel iteration,

(𝑘) (𝑘) (𝑘) (𝑘)


(𝑘+1) 𝑏1 − 𝑎12 𝑥2 − 𝑎13 𝑥3 11 + 1𝑥2 − 3𝑥3
𝑥1 = =
𝑎11 5
(𝑘+1) (𝑘) (𝑘+1) (𝑘)
(𝑘+1) 𝑏2 − 𝑎21 𝑥1 − 𝑎23 𝑥3 17 − 2𝑥1 + 1𝑥3 Starting with 𝐱 (0) = 𝟎 = (0 , 0 , 0)
𝑥2 = = 3DP  Let ε = 0.005
𝑎22 8
(𝑘+1) (𝑘+1) (𝑘+1) (𝑘+1)
(𝑘+1) 𝑏3 − 𝑎31 𝑥1 − 𝑎32 𝑥2 21 + 1𝑥1 − 1𝑥2
𝑥3 = =
𝑎33 7

(𝑘) (𝑘) (𝑘)


𝑘 A  𝑥1 B  𝑥2 C  𝑥3
0 0.000 0.000 0.000
1 2.200 1.575 3.089
2 1.897 2.037 2.980
3 2.011 1.995 3.002
4 1.998 2.001 3.000
5 2.000 2.000 3.000

5( ) 4 ( )
‖𝐱 (5) − 𝐱 (4) ‖∞ = max {|𝑥𝑖 − 𝑥𝑖 |}
1≤𝑖≤3
= max {|𝑥15 − 𝑥14 | , |𝑥25 − 𝑥24 | , |𝑥35 − 𝑥34 |}
( ) ( ) ( ) ( ) ( ) ( )

= max{0.002 , 0.001 , 0.000}


= 0.002 < ε = 0.005
(5)
𝐱≈𝐱 = (𝟐. 𝟎𝟎𝟎 , 𝟐. 𝟎𝟎𝟎 , 𝟑. 𝟎𝟎𝟎)
SOLUTION → 𝑥1 = 2.000 𝑥2 = 2.000 𝑥3 = 3.000
MUHAMMAD MUSA BIN YUSOF
A17KA0105

7. Solve the following linear system using Gauss-Seidel method starting 𝐱 (0) = 𝟎.

𝑅 3 4 𝑥1 21 | | > | |+| |
Ax = b → 1 2𝑅 −1 𝑥2 = 9 | | > | |+| | *no need to rearrange
2 −1 𝑅 𝑥3 18 | | > | |+| |
Compare the number of iteration to obtain the solution if
a) R = 10
b) R = 100
Show the calculation in 4DP and let ε = 0.0005

10 3 4 𝑥1 21 |10| > |3| + |4|


a) Ax = b → 1 20 −1 𝑥2 = 9 |20| > |1| + |−1| *no need to rearrange
2 −1 10 𝑥3 18 |10| > |2| + |−1|

Using Gauss-Seidel iteration,


(𝑘) (𝑘) (𝑘) (𝑘)
(𝑘+1) 𝑏1 − 𝑎12 𝑥2 − 𝑎13 𝑥3 21 − 3𝑥2 − 4𝑥3 Starting with 𝐱 (0) = 𝟎 = (0 , 0 , 0)
𝑥1 = =
𝑎11 10 4DP  Let ε = 0.0005
(𝑘+1) (𝑘) (𝑘+1) (𝑘)
(𝑘+1) 𝑏2 − 𝑎21 𝑥1 − 𝑎23 𝑥3 9 − 1𝑥1 + 1𝑥3
𝑥2 = =
𝑎22 20
(𝑘+1) (𝑘+1) (𝑘+1) (𝑘+1)
(𝑘+1) 𝑏3 − 𝑎31 𝑥1 − 𝑎32 𝑥2 18 − 2𝑥1 + 1𝑥2
𝑥3 = =
𝑎33 10

(𝑘) (𝑘) (𝑘)


𝑘 A  𝑥1 B  𝑥2 C  𝑥3
0 0.0000 0.0000 0.0000
1 2.1000 0.3450 1.4145
2 1.4307 0.4492 1.5588
3 1.3417 0.4609 1.5777
4 1.3306 0.4624 1.5801
5 1.3293 0.4625 1.5804
6 1.3291 0.4626 1.5804

6( ) 5 ( )
‖𝐱 (6) − 𝐱 (5) ‖∞ = max {|𝑥𝑖 − 𝑥𝑖 |}
1≤𝑖≤3
= max {|𝑥16 − 𝑥15 | , |𝑥26 − 𝑥25 | , |𝑥36 − 𝑥35 |}
( ) ( ) ( ) ( ) ( ) ( )

= max{0.0002 , 0.0001 , 0.0000}


= 0.0002 < ε = 0.0005
(𝑘)
𝐱≈𝐱 = (𝟏. 𝟑𝟐𝟗𝟏 , 𝟎. 𝟒𝟔𝟐𝟔 , 𝟏. 𝟓𝟖𝟎𝟒)
SOLUTION → 𝑥1 = 1.3291 𝑥2 = 0.4626 𝑥3 = 1.5804

𝐍𝐔𝐌𝐁𝐄𝐑 𝐎𝐅 𝐈𝐓𝐄𝐑𝐀𝐓𝐈𝐎𝐍 = 𝟔
MUHAMMAD MUSA BIN YUSOF
A17KA0105

100 3 4 𝑥1 21 |100| > |3| + |4|


b) Ax = b → 1 200 −1 𝑥2 = 9 |200| > |1| + |−1| *no need to rearrange
2 −1 100 𝑥3 18 |100| > |2| + |−1|

Using Gauss-Seidel iteration,


(𝑘) (𝑘) (𝑘) (𝑘)
(𝑘+1) 𝑏1 − 𝑎12 𝑥2 − 𝑎13 𝑥3 21 − 3𝑥2 − 4𝑥3 Starting with 𝐱 (0) = 𝟎 = (0 , 0 , 0)
𝑥1 = =
𝑎11 100 4DP  Let ε = 0.0005
(𝑘+1) (𝑘) (𝑘+1) (𝑘)
(𝑘+1) 𝑏2 − 𝑎21 𝑥1 − 𝑎23 𝑥3 9 − 1𝑥1 + 1𝑥3
𝑥2 = =
𝑎22 200
(𝑘+1) (𝑘+1) (𝑘+1) (𝑘+1)
(𝑘+1) 𝑏3 − 𝑎31 𝑥1 − 𝑎32 𝑥2 18 − 2𝑥1 + 1𝑥2
𝑥3 = =
𝑎33 100

(𝑘) (𝑘) (𝑘)


𝑘 A  𝑥1 B  𝑥2 C  𝑥3
0 0.0000 0.0000 0.0000
1 0.2100 0.0440 0.1762
2 0.2016 0.0449 0.1764
3 0.2016 0.0449 0.1764

3 2
( ) ( )
‖𝐱 (3) − 𝐱 (2) ‖∞ = max {|𝑥𝑖 − 𝑥𝑖 |}
1≤𝑖≤3
= max {|𝑥13 − 𝑥12 | , |𝑥23 − 𝑥22 | , |𝑥33 − 𝑥32 |}
( ) ( ) ( ) ( ) ( ) ( )

= max{0.0000 , 0.0000 , 0.0000}


= 0.0000 < ε = 0.0005
(𝑘)
𝐱≈𝐱 = (𝟎. 𝟐𝟎𝟏𝟔 , 𝟎. 𝟎𝟒𝟒𝟗 , 𝟎. 𝟏𝟕𝟔𝟒)
SOLUTION → 𝑥1 = 0.2016 𝑥2 = 0.0449 𝑥3 = 0.1764

𝐍𝐔𝐌𝐁𝐄𝐑 𝐎𝐅 𝐈𝐓𝐄𝐑𝐀𝐓𝐈𝐎𝐍 = 𝟑
MUHAMMAD MUSA BIN YUSOF
A17KA0105

Jacobi Iteration TEMPLATE

𝑥1 | | > | |+| |
Ax = b → 𝑥2 = | | > | |+| | *no need to rearrange
𝑥3 | | > | |+| |

Coefficient matrix A is diagonally dominant, thus Jacobi iteration converges.


Using Jacobi iteration,

(𝑘) (𝑘) (𝑘) (𝑘)


(𝑘+1) 𝑏1 − 𝑎12 𝑥2 − 𝑎13 𝑥3 −𝑥2 − 𝑥3
𝑥1 = =
𝑎11
(𝑘) (𝑘) (𝑘) (𝑘)
(𝑘+1) 𝑏2 − 𝑎21 𝑥1 − 𝑎23 𝑥3 −𝑥1 − 𝑥3 Starting with 𝐱 (0) = 𝟎 = (0 , 0 , 0)
𝑥2 = = 3DP  Let ε = 0.005
𝑎22
(𝑘) (𝑘) (𝑘) (𝑘)
(𝑘+1) 𝑏3 − 𝑎31 𝑥1 − 𝑎32 𝑥2 −𝑥1 − 𝑥2
𝑥3 = =
𝑎33

(𝑘) (𝑘) (𝑘)


𝑘 A  𝑥1 B  𝑥2 C  𝑥3
0
1
2
3
4
5
6
7
8
9
10

𝑘 ( ) 𝑘−1 ( )
‖𝐱 (𝑘) − 𝐱 (𝑘−1) ‖∞ = max {|𝑥𝑖 − 𝑥𝑖 |}
1≤𝑖≤3
(𝑘) (𝑘−1) (𝑘) (𝑘−1) (𝑘) (𝑘−1)
= max {|𝑥1 − 𝑥1 | , |𝑥2 − 𝑥2 | , |𝑥3 − 𝑥3 |}
= max{ }
=< ε = 0.005
(𝑘)
𝐱≈𝐱 =( )
SOLUTION → 𝑥1 = 𝑥2 = 𝑥3 =
MUHAMMAD MUSA BIN YUSOF
A17KA0105

Gauss-Seidel Iteration TEMPLATE

𝑥1 | | > | |+| |
Ax = b → 𝑥2 = | | > | |+| | *no need to rearrange
𝑥3 | | > | |+| |

Coefficient matrix A is diagonally dominant, thus Gauss-Seidel iteration converges.


Using Gauss-Seidel iteration,

(𝑘) (𝑘) (𝑘) (𝑘)


(𝑘+1) 𝑏1 − 𝑎12 𝑥2 − 𝑎13 𝑥3 −𝑥2 − 𝑥3
𝑥1 = =
𝑎11
(𝑘+1) (𝑘) (𝑘+1) (𝑘)
(𝑘+1) 𝑏2 − 𝑎21 𝑥1 − 𝑎23 𝑥3 −𝑥1 − 𝑥3 Starting with 𝐱 (0) = 𝟎 = (0 , 0 , 0)
𝑥2 = = 3DP  Let ε = 0.005
𝑎22
(𝑘+1) (𝑘+1) (𝑘+1) (𝑘+1)
(𝑘+1) 𝑏3 − 𝑎31 𝑥1 − 𝑎32 𝑥2 −𝑥1 − 𝑥2
𝑥3 = =
𝑎33

(𝑘) (𝑘) (𝑘)


𝑘 A  𝑥1 B  𝑥2 C  𝑥3
0
1
2
3
4
5
6
7
8
9
10

𝑘 ( ) 𝑘−1 ( )
‖𝐱 (𝑘) − 𝐱 (𝑘−1) ‖∞ = max {|𝑥𝑖 − 𝑥𝑖 |}
1≤𝑖≤3
= max {|𝑥1𝑘 − 𝑥1𝑘−1 | , |𝑥2𝑘 − 𝑥2𝑘−1 | , |𝑥3𝑘 − 𝑥3𝑘−1 |}
( ) ( ) ( ) ( ) ( ) ( )

= max{ }
=< ε = 0.005
(𝑘)
𝐱≈𝐱 =( )
SOLUTION → 𝑥1 = 𝑥2 = 𝑥3 =
MUHAMMAD MUSA BIN YUSOF
A17KA0105

LAGRANGE INTERPOLATION
***Exercise 3.1
For the question 1 – 10, using Lagrange Interpolation approximate the value of:

1. 𝑓(2) if 𝑖 0 1 2
𝑥𝑖 0 1 3
𝑦𝑖 = 𝑓(𝑥𝑖 ) 0 1 0

Lagrange Interpolation polynomial,


𝑃2 (𝑥) = 𝐿0 (𝑥)𝑦0 + 𝐿1 (𝑥)𝑦1 + 𝐿2 (𝑥)𝑦2 where :
(𝑥 − 𝑥1 )(𝑥 − 𝑥2 ) (𝑥 − 1)(𝑥 − 3) 1
𝐿0 (𝑥) = = = (𝑥 − 1)(𝑥 − 3)
(𝑥0 − 𝑥1 )(𝑥0 − 𝑥2 ) (0 − 1)(0 − 3) 3
(𝑥 − 𝑥0 )(𝑥 − 𝑥2 ) (𝑥 − 0)(𝑥 − 3) 1
𝐿1 (𝑥) = = = − (𝑥)(𝑥 − 3)
(𝑥1 − 𝑥0 )(𝑥1 − 𝑥2 ) (1 − 0)(1 − 3) 2
(𝑥 − 𝑥0 )(𝑥 − 𝑥1 ) (𝑥 − 0)(𝑥 − 1) 1
𝐿2 (𝑥) = = = (𝑥)(𝑥 − 1)
(𝑥2 − 𝑥0 )(𝑥2 − 𝑥1 ) (3 − 0)(3 − 1) 6

1 1 1
Then : 𝑃2 (𝑥) = 3 (𝑥 − 1)(𝑥 − 3)(0) + (− 2) (𝑥)(𝑥 − 3)(1) + 6 (𝑥)(𝑥 − 1)(0)
1
= − 2 (𝑥)(𝑥 − 3)

Verifying Interpolation condition,


𝑃2 (0) = 0
Interpolation condition are satisfied.
𝑃2 (1) = 1
Verification is not compulsory if question does not ask for it.
𝑃2 (3) = 0

When 𝒙 = 𝟐,
𝑃2 (2) = 1
Then : 𝑓(2) = 𝑃2 (2) = 1

Degree of Lagrange interpolation polynomial,


Expanding 𝑃2 (𝑥) we have,
1 3
𝑃2 (𝑥) = − 2 𝑥 2 + 2 𝑥 Or directly substitute the value x = 2 into
𝐿0 (𝑥) , 𝐿1 (𝑥) , 𝐿2 (𝑥) to get 𝑃2 (2)
Then : Degree of 𝑃2 (𝑥) is 2
MUHAMMAD MUSA BIN YUSOF
A17KA0105

2. 𝑓(3) if 𝑖 0 1 2
𝑥𝑖 0 1 4
𝑦𝑖 = 𝑓(𝑥𝑖 ) 2 1 4

Lagrange Interpolation polynomial,


𝑃2 (𝑥) = 𝐿0 (𝑥)𝑦0 + 𝐿1 (𝑥)𝑦1 + 𝐿2 (𝑥)𝑦2 where :
(𝑥 − 𝑥1 )(𝑥 − 𝑥2 ) (𝑥 − 1)(𝑥 − 4) 1
𝐿0 (𝑥) = = = (𝑥 − 1)(𝑥 − 4)
(𝑥0 − 𝑥1 )(𝑥0 − 𝑥2 ) (0 − 1)(0 − 4) 4
(𝑥 − 𝑥0 )(𝑥 − 𝑥2 ) (𝑥 − 0)(𝑥 − 4) 1
𝐿1 (𝑥) = = = − (𝑥)(𝑥 − 4)
(𝑥1 − 𝑥0 )(𝑥1 − 𝑥2 ) (1 − 0)(1 − 4) 3
(𝑥 − 𝑥0 )(𝑥 − 𝑥1 ) (𝑥 − 0)(𝑥 − 1) 1
𝐿2 (𝑥) = = = (𝑥)(𝑥 − 1)
(𝑥2 − 𝑥0 )(𝑥2 − 𝑥1 ) (4 − 0)(4 − 1) 12

1 1 1
Then : 𝑃2 (𝑥) = 4 (𝑥 − 1)(𝑥 − 4)(2) + (− 3) (𝑥)(𝑥 − 4)(1) + 12 (𝑥)(𝑥 − 1)(4)
1 1 1
= 2 (𝑥 − 1)(𝑥 − 4) + (− 3) (𝑥)(𝑥 − 4) + 3 (𝑥)(𝑥 − 1)

Verifying Interpolation condition,


𝑃2 (0) = 2
Interpolation condition are satisfied.
𝑃2 (1) = 1
Verification is not compulsory if question does not ask for it.
𝑃2 (4) = 4

When 𝒙 = 𝟑,
𝑃2 (3) = 2
Then : 𝑓(3) = 𝑃2 (3) = 2

Or directly substitute the value x = 3 into


𝐿0 (𝑥) , 𝐿1 (𝑥) , 𝐿2 (𝑥) to get 𝑃2 (3)
MUHAMMAD MUSA BIN YUSOF
A17KA0105

3. 𝑓(0.2) if 𝑖 0 1 2
𝑥𝑖 0.1 0.3 0.4
𝑦𝑖 = 𝑓(𝑥𝑖 ) 1.2314 1.9121 2.3855

Lagrange Interpolation polynomial,


𝑃2 (𝑥) = 𝐿0 (𝑥)𝑦0 + 𝐿1 (𝑥)𝑦1 + 𝐿2 (𝑥)𝑦2 where :
(𝑥 − 𝑥1 )(𝑥 − 𝑥2 ) (𝑥 − 0.3)(𝑥 − 0.4) 1
𝐿0 (𝑥) = = = (𝑥 − 0.3)(𝑥 − 0.4)
(𝑥0 − 𝑥1 )(𝑥0 − 𝑥2 ) (0.1 − 0.3)(0.1 − 0.4) 0.06
(𝑥 − 𝑥0 )(𝑥 − 𝑥2 ) (𝑥 − 0.1)(𝑥 − 0.4) 1
𝐿1 (𝑥) = = =− (𝑥 − 0.1)(𝑥 − 0.4)
(𝑥1 − 𝑥0 )(𝑥1 − 𝑥2 ) (0.3 − 0.1)(0.3 − 0.4) 0.02
(𝑥 − 𝑥0 )(𝑥 − 𝑥1 ) (𝑥 − 0.1)(𝑥 − 0.3) 1
𝐿2 (𝑥) = = = (𝑥 − 0.1)(𝑥 − 0.3)
(𝑥2 − 𝑥0 )(𝑥2 − 𝑥1 ) (0.4 − 0.1)(0.4 − 0.3) 0.03

1 1
Then : 𝑃2 (𝑥) = 0.06 (𝑥 − 0.3)(𝑥 − 0.4)(1.2314) + (− 0.02) (𝑥 − 0.1)(𝑥 − 0.4)(1.9121) +
1
(𝑥 − 0.1)(𝑥 − 0.3)(2.3855)
0.03

Verifying Interpolation condition,


𝑃2 (0.1) = 1.2314
Interpolation condition are satisfied.
𝑃2 (0.3) = 1.9121
Verification is not compulsory if question does not ask for it.
𝑃2 (0.4) = 2.3855

When 𝒙 = 𝟎. 𝟐,
𝑃2 (0.2) = 1.5274
Then : 𝑓(0.2) = 𝑃2 (0.2) = 1.5274

Or directly substitute the value x = 0.2 into


𝐿0 (𝑥) , 𝐿1 (𝑥) , 𝐿2 (𝑥) to get 𝑃2 (0.2)
MUHAMMAD MUSA BIN YUSOF
A17KA0105

4. 𝑓(2.5) if 𝑖 0 1 2
𝑥𝑖 2.1 2.4 2.6
𝑦𝑖 = 𝑓(𝑥𝑖 ) 0.5208 0.5104 0.3813

Lagrange Interpolation polynomial,


𝑃2 (𝑥) = 𝐿0 (𝑥)𝑦0 + 𝐿1 (𝑥)𝑦1 + 𝐿2 (𝑥)𝑦2 where :
(𝑥 − 𝑥1 )(𝑥 − 𝑥2 ) (𝑥 − 2.4)(𝑥 − 2.6) 1
𝐿0 (𝑥) = = = (𝑥 − 2.4)(𝑥 − 2.6)
(𝑥0 − 𝑥1 )(𝑥0 − 𝑥2 ) (2.1 − 2.4)(2.1 − 2.6) 0.15
(𝑥 − 𝑥0 )(𝑥 − 𝑥2 ) (𝑥 − 2.1)(𝑥 − 2.6) 1
𝐿1 (𝑥) = = =− (𝑥 − 2.1)(𝑥 − 2.6)
(𝑥1 − 𝑥0 )(𝑥1 − 𝑥2 ) (2.4 − 2.1)(2.4 − 2.6) 0.06
(𝑥 − 𝑥0 )(𝑥 − 𝑥1 ) (𝑥 − 2.1)(𝑥 − 2.4) 1
𝐿2 (𝑥) = = = (𝑥 − 2.1)(𝑥 − 2.4)
(𝑥2 − 𝑥0 )(𝑥2 − 𝑥1 ) (2.6 − 2.1)(2.6 − 2.4) 0.1

1 1
Then : 𝑃2 (𝑥) = 0.15 (𝑥 − 2.4)(𝑥 − 2.6)(0.5208) + (− 0.06) (𝑥 − 2.1)(𝑥 − 2.6)(0.5104) +
1
(𝑥 − 2.1)(𝑥 − 2.4)(0.3813)
0.1

Verifying Interpolation condition,


𝑃2 (2.1) = 0.5208
Interpolation condition are satisfied.
𝑃2 (2.4) = 0.5104
Verification is not compulsory if question does not ask for it.
𝑃2 (2.6) = 0.3813

When 𝒙 = 𝟐. 𝟓,
𝑃2 (2.5) = 0.4581
Then : 𝑓(2.5) = 𝑃2 (2.5) = 0.4581

Or directly substitute the value x = 2.5 into


𝐿0 (𝑥) , 𝐿1 (𝑥) , 𝐿2 (𝑥) to get 𝑃2 (2.5)
MUHAMMAD MUSA BIN YUSOF
A17KA0105

5. 𝑓(3) if 𝑖 0 1 2 3
𝑥𝑖 0 1 2 4
𝑦𝑖 = 𝑓(𝑥𝑖 ) 1 1 2 5

Lagrange Interpolation polynomial,


𝑃3 (𝑥) = 𝐿0 (𝑥)𝑦0 + 𝐿1 (𝑥)𝑦1 + 𝐿2 (𝑥)𝑦2 + 𝐿3 (𝑥)𝑦3 where :
(𝑥 − 𝑥1 )(𝑥 − 𝑥2 )(𝑥 − 𝑥3 ) (𝑥 − 1)(𝑥 − 2)(𝑥 − 4) 1
𝐿0 (𝑥) = = = − (𝑥 − 1)(𝑥 − 2)(𝑥 − 4)
(𝑥0 − 𝑥1 )(𝑥0 − 𝑥2 )(𝑥0 − 𝑥3 ) (0 − 1)(0 − 2)(0 − 4) 8
(𝑥 − 𝑥0 )(𝑥 − 𝑥2 )(𝑥 − 𝑥3 ) (𝑥 − 0)(𝑥 − 2)(𝑥 − 4) 1
𝐿1 (𝑥) = = = (𝑥)(𝑥 − 2)(𝑥 − 4)
(𝑥1 − 𝑥0 )(𝑥1 − 𝑥2 )(𝑥1 − 𝑥3 ) (1 − 0)(1 − 2)(1 − 4) 3
(𝑥 − 𝑥0 )(𝑥 − 𝑥1 )(𝑥 − 𝑥3 ) (𝑥 − 0)(𝑥 − 1)(𝑥 − 4) 1
𝐿2 (𝑥) = = = − (𝑥)(𝑥 − 1)(𝑥 − 4)
(𝑥2 − 𝑥0 )(𝑥2 − 𝑥1 )(𝑥2 − 𝑥3 ) (2 − 0)(2 − 1)(2 − 4) 4
(𝑥 − 𝑥0 )(𝑥 − 𝑥1 )(𝑥 − 𝑥2 ) (𝑥 − 0)(𝑥 − 1)(𝑥 − 2) 1
𝐿3 (𝑥) = = = − (𝑥)(𝑥 − 1)(𝑥 − 2)
(𝑥3 − 𝑥0 )(𝑥3 − 𝑥1 )(𝑥3 − 𝑥2 ) (4 − 0)(4 − 1)(1 − 2) 12

1 1
Then : 𝑃3 (𝑥) = − 8 (𝑥 − 1)(𝑥 − 2)(𝑥 − 4)(1) + 3 (𝑥)(𝑥 − 2)(𝑥 − 4)(1) +
1 1
(− ) (𝑥)(𝑥 − 1)(𝑥 − 4)(2) + (− ) (𝑥)(𝑥 − 1)(𝑥 − 2)(5)
4 12

Verifying Interpolation condition,


𝑃3 (0) = 1
𝑃3 (1) = 1 Interpolation condition are satisfied.
𝑃3 (2) = 2 Verification is not compulsory if question does not ask for it.
𝑃3 (4) = 5

When 𝒙 = 𝟑,
𝑃3 (3) = −1/4
Then : 𝑓(3) = 𝑃3 (3) = −1/4

Or directly substitute the value x = 3 into


𝐿0 (𝑥) , 𝐿1 (𝑥) , 𝐿2 (𝑥), 𝐿3 (𝑥) to get 𝑃3 (3)
MUHAMMAD MUSA BIN YUSOF
A17KA0105

6. 𝑓(3) if 𝑖 0 1 2 3
𝑓(5)
𝑥𝑖 0 2 4 6
𝑦𝑖 = 𝑓(𝑥𝑖 ) 1 -1 -1 -1

Lagrange Interpolation polynomial,


𝑃3 (𝑥) = 𝐿0 (𝑥)𝑦0 + 𝐿1 (𝑥)𝑦1 + 𝐿2 (𝑥)𝑦2 + 𝐿3 (𝑥)𝑦3 where :
(𝑥 − 𝑥1 )(𝑥 − 𝑥2 )(𝑥 − 𝑥3 ) (𝑥 − 2)(𝑥 − 4)(𝑥 − 6) 1
𝐿0 (𝑥) = = = − (𝑥 − 2)(𝑥 − 4)(𝑥 − 6)
(𝑥0 − 𝑥1 )(𝑥0 − 𝑥2 )(𝑥0 − 𝑥3 ) (0 − 2)(0 − 4)(0 − 6) 48
(𝑥 − 𝑥0 )(𝑥 − 𝑥2 )(𝑥 − 𝑥3 ) (𝑥 − 0)(𝑥 − 4)(𝑥 − 6) 1
𝐿1 (𝑥) = = = (𝑥)(𝑥 − 4)(𝑥 − 6)
(𝑥1 − 𝑥0 )(𝑥1 − 𝑥2 )(𝑥1 − 𝑥3 ) (2 − 0)(2 − 4)(2 − 6) 16
(𝑥 − 𝑥0 )(𝑥 − 𝑥1 )(𝑥 − 𝑥3 ) (𝑥 − 0)(𝑥 − 2)(𝑥 − 6) 1
𝐿2 (𝑥) = = = − (𝑥)(𝑥 − 2)(𝑥 − 6)
(𝑥2 − 𝑥0 )(𝑥2 − 𝑥1 )(𝑥2 − 𝑥3 ) (4 − 0)(4 − 2)(4 − 6) 16
(𝑥 − 𝑥0 )(𝑥 − 𝑥1 )(𝑥 − 𝑥2 ) (𝑥 − 0)(𝑥 − 2)(𝑥 − 4) 1
𝐿3 (𝑥) = = = (𝑥)(𝑥 − 2)(𝑥 − 4)
(𝑥3 − 𝑥0 )(𝑥3 − 𝑥1 )(𝑥3 − 𝑥2 ) (6 − 0)(6 − 2)(6 − 4) 48

1 1
Then : 𝑃3 (𝑥) = − 48 (𝑥 − 2)(𝑥 − 4)(𝑥 − 6)(1) + 16 (𝑥)(𝑥 − 4)(𝑥 − 6)(−1) +
1 1
(− ) (𝑥)(𝑥 − 2)(𝑥 − 6)(−1) + (𝑥)(𝑥 − 2)(𝑥 − 4)(−1)
16 48

Verifying Interpolation condition,


𝑃3 (0) = 1
𝑃3 (2) = −1 Interpolation condition are satisfied.
𝑃3 (4) = −1 Verification is not compulsory if question does not ask for it.
𝑃3 (6) = −1

When 𝒙 = 𝟑,
𝑃3 (3) = −9/8
Then : 𝑓(3) = 𝑃3 (3) = −9/8
Or directly substitute the value x = 3 & x = 5 into
𝐿0 (𝑥) , 𝐿1 (𝑥) , 𝐿2 (𝑥), 𝐿3 (𝑥) to get 𝑃3 (3) & 𝑃3 (5)
When 𝒙 = 𝟓,
𝑃3 (5) = −7/8
Then : 𝑓(5) = 𝑃3 (5) = −7/8
MUHAMMAD MUSA BIN YUSOF
A17KA0105

NEWTON DIVIDED DIFFERENCE INTERPOLATION


***Exercise 3.2
For the question 1 – 10, using Newton divided difference interpolation find the polynomial
interpolation and approximate the value of:

1. 𝑓(2) if 𝑖 0 1 2
𝑥𝑖 0 1 3
𝑦𝑖 = 𝑓(𝑥𝑖 ) 0 1 0

Divided Difference Table,


[0] [1] [2]
𝑖 𝑥𝑖 𝑦𝑖 = 𝑦𝑖 𝑦𝑖 𝑦𝑖
1−0 −0.5 − 1
0 0 0 =1 = −0.5
1−0 3−0
0−1
1 1 1 = −0.5
3−1

2 3 0

Newton Divided Difference Interpolation,


[1] [2] [𝑛]
𝑃𝑛 (𝑥) = 𝑦0 + 𝑦0 (𝑥 − 𝑥0 ) + 𝑦0 (𝑥 − 𝑥0 )(𝑥 − 𝑥1 ) + ⋯ + 𝑦0 (𝑥 − 𝑥0 )(𝑥 − 𝑥1 ) … (𝑥 − 𝑥𝑛−1 )
[1] [2]
𝑃2 (𝑥) = 𝑦0 + 𝑦0 (𝑥 − 𝑥0 ) + 𝑦0 (𝑥 − 𝑥0 )(𝑥 − 𝑥1 )
= 0 + 1(𝑥 − 0) + (−0.5)(𝑥 − 0)(𝑥 − 1)
= 𝑥 − 0.5𝑥(𝑥 − 1)

Verifying Interpolation condition,


𝑃2 (0) = 0
𝑃2 (1) = 1 Interpolation condition are satisfied.
Verification is not compulsory if question does not ask for it.
𝑃2 (3) = 0

Degree of interpolation polynomial,


From Divided Difference Table, clearly that the degree of 𝑃2 (𝑥) is 2

When 𝒙 = 𝟐,
𝑃2 (2) = 1
Then : 𝑓(2) = 𝑃2 (2) = 1
Or directly substitute the value x = 2 into
𝑃2 (𝑥) to get 𝑃2 (2)
MUHAMMAD MUSA BIN YUSOF
A17KA0105

2. 𝑓(3) if 𝑖 0 1 2
𝑥𝑖 0 1 4
𝑦𝑖 = 𝑓(𝑥𝑖 ) 2 1 4

Divided Difference Table,


[0] [1] [2]
𝑖 𝑥𝑖 𝑦𝑖 = 𝑦𝑖 𝑦𝑖 𝑦𝑖
1−2 1 − (−1)
0 0 2 = −1 = 0.5
1−0 4−0
4−1
1 1 1 =1
4−1

2 4 4

Newton Divided Difference Interpolation,


[1] [2] [𝑛]
𝑃𝑛 (𝑥) = 𝑦0 + 𝑦0 (𝑥 − 𝑥0 ) + 𝑦0 (𝑥 − 𝑥0 )(𝑥 − 𝑥1 ) + ⋯ + 𝑦0 (𝑥 − 𝑥0 )(𝑥 − 𝑥1 ) … (𝑥 − 𝑥𝑛−1 )
[1] [2]
𝑃2 (𝑥) = 𝑦0 + 𝑦0 (𝑥 − 𝑥0 ) + 𝑦0 (𝑥 − 𝑥0 )(𝑥 − 𝑥1 )
= 2 + (−1)(𝑥 − 0) + 0.5(𝑥 − 0)(𝑥 − 1)
= 2 − 𝑥 + 0.5𝑥(𝑥 − 1)

Verifying Interpolation condition,


𝑃2 (0) = 2
𝑃2 (1) = 1 Interpolation condition are satisfied.
Verification is not compulsory if question does not ask for it.
𝑃2 (4) = 4

Degree of interpolation polynomial,


From Divided Difference Table, clearly that the degree of 𝑃2 (𝑥) is 2

When 𝒙 = 𝟑,
𝑃2 (3) = 2
Then : 𝑓(3) = 𝑃2 (3) = 2
Or directly substitute the value x = 3 into
𝑃2 (𝑥) to get 𝑃2 (3)
MUHAMMAD MUSA BIN YUSOF
A17KA0105

3. 𝑓(0.2) if 𝑖 0 1 2
𝑥𝑖 0.1 0.3 0.4
𝑦𝑖 = 𝑓(𝑥𝑖 ) 1.2314 1.9121 2.3855

Divided Difference Table,


[0] [1] [2]
𝑖 𝑥𝑖 𝑦𝑖 = 𝑦𝑖 𝑦𝑖 𝑦𝑖
1.9121 − 1.2314 4.734 − 3.4035
0 0.1 1.2314 0.3 − 0.1 0.4 − 0.1
= 3.4035 = 4.435
2.3855 − 1.9121
1 0.3 1.9121 0.4 − 0.3
= 4.734

2 0.4 2.3855

Newton Divided Difference Interpolation,


[1] [2] [𝑛]
𝑃𝑛 (𝑥) = 𝑦0 + 𝑦0 (𝑥 − 𝑥0 ) + 𝑦0 (𝑥 − 𝑥0 )(𝑥 − 𝑥1 ) + ⋯ + 𝑦0 (𝑥 − 𝑥0 )(𝑥 − 𝑥1 ) … (𝑥 − 𝑥𝑛−1 )
[1] [2]
𝑃2 (𝑥) = 𝑦0 + 𝑦0 (𝑥 − 𝑥0 ) + 𝑦0 (𝑥 − 𝑥0 )(𝑥 − 𝑥1 )
= 1.2314 + (3.4035)(𝑥 − 0.1) + 4.435(𝑥 − 0.1)(𝑥 − 0.3)

Verifying Interpolation condition,


𝑃2 (0.1) = 1.2314
𝑃2 (0.3) = 1.9121 Interpolation condition are satisfied.
Verification is not compulsory if question does not ask for it.
𝑃2 (0.4) = 2.3855

Degree of interpolation polynomial,


From Divided Difference Table, clearly that the degree of 𝑃2 (𝑥) is 2

When 𝒙 = 𝟎. 𝟐,
𝑃2 (0.2) = 1.5274
Then : 𝑓(0.2) = 𝑃2 (0.2) = 1.5274
Or directly substitute the value x = 0.2 into
𝑃2 (𝑥) to get 𝑃2 (0.2)
MUHAMMAD MUSA BIN YUSOF
A17KA0105

4. 𝑓(2.5) if 𝑖 0 1 2
𝑥𝑖 2.1 2.4 2.6
𝑦𝑖 = 𝑓(𝑥𝑖 ) 0.5208 0.5104 0.3813

Divided Difference Table,


[0] [1] [2]
𝑖 𝑥𝑖 𝑦𝑖 = 𝑦𝑖 𝑦𝑖 𝑦𝑖
0.5104 − 0.5208 −0.6455 + 0.0347
0 2.1 0.5208 2.4 − 2.1 2.6 − 2.1
= −0.0347 = −1.2216
0.3813 − 0.5104
1 2.4 0.5104 2.6 − 2.4
= −0.6455

2 2.6 0.3813

Newton Divided Difference Interpolation,


[1] [2] [𝑛]
𝑃𝑛 (𝑥) = 𝑦0 + 𝑦0 (𝑥 − 𝑥0 ) + 𝑦0 (𝑥 − 𝑥0 )(𝑥 − 𝑥1 ) + ⋯ + 𝑦0 (𝑥 − 𝑥0 )(𝑥 − 𝑥1 ) … (𝑥 − 𝑥𝑛−1 )
[1] [2]
𝑃2 (𝑥) = 𝑦0 + 𝑦0 (𝑥 − 𝑥0 ) + 𝑦0 (𝑥 − 𝑥0 )(𝑥 − 𝑥1 )
= 0.5208 + (−0.0347)(𝑥 − 2.1) + (−1.2216)(𝑥 − 2.1)(𝑥 − 2.4)

Verifying Interpolation condition,


𝑃2 (2.1) = 0.5208
𝑃2 (2.4) = 0.5104 Interpolation condition are satisfied.
Verification is not compulsory if question does not ask for it.
𝑃2 (2.6) = 0.3813

Degree of interpolation polynomial,


From Divided Difference Table, clearly that the degree of 𝑃2 (𝑥) is 2

When 𝒙 = 𝟐. 𝟓,
𝑃2 (2.5) = 0.4581
Then : 𝑓(2.5) = 𝑃2 (2.5) = 0.4581
Or directly substitute the value x = 2.5 into
𝑃2 (𝑥) to get 𝑃2 (2.5)
MUHAMMAD MUSA BIN YUSOF
A17KA0105

5. 𝑓(3) if 𝑖 0 1 2 3
𝑥𝑖 0 1 2 4
𝑦𝑖 = 𝑓(𝑥𝑖 ) 1 1 2 5

Divided Difference Table,


[0] [1] [2] [3]
𝑖 𝑥𝑖 𝑦𝑖 = 𝑦𝑖 𝑦𝑖 𝑦𝑖 𝑦𝑖
1−1 1−0 1/6 − 0.5 1
0 0 1 =0 = 0.5 =−
1−0 2−0 4−0 12

2−1 1.5 − 1 1
1 1 1 =1 =
2−1 4−1 6

5−2
2 2 2 = 1.5
4−2

3 4 5

Newton Divided Difference Interpolation,


[1] [2] [𝑛]
𝑃𝑛 (𝑥) = 𝑦0 + 𝑦0 (𝑥 − 𝑥0 ) + 𝑦0 (𝑥 − 𝑥0 )(𝑥 − 𝑥1 ) + ⋯ + 𝑦0 (𝑥 − 𝑥0 )(𝑥 − 𝑥1 ) … (𝑥 − 𝑥𝑛−1 )
[1] [2] [3]
𝑃3 (𝑥) = 𝑦0 + 𝑦0 (𝑥 − 𝑥0 ) + 𝑦0 (𝑥 − 𝑥0 )(𝑥 − 𝑥1 ) + 𝑦0 (𝑥 − 𝑥0 )(𝑥 − 𝑥1 )(𝑥 − 𝑥2 )
= 1 + (0)(𝑥 − 0) + 0.5(𝑥 − 0)(𝑥 − 1) + (−1/12)(𝑥 − 0)(𝑥 − 1)(𝑥 − 2)
1
= 1 + 0.5𝑥(𝑥 − 1) − 𝑥(𝑥 − 1)(𝑥 − 2)
12

Verifying Interpolation condition,


𝑃3 (0) = 1
Interpolation condition are satisfied.
𝑃3 (1) = 1
Verification is not compulsory if question does not ask for it.
𝑃3 (2) = 2
𝑃3 (4) = 5

Degree of interpolation polynomial,


From Divided Difference Table, clearly that the degree of 𝑃3 (𝑥) is 3

When 𝒙 = 𝟑,
𝑃3 (3) = 7/2
Then : 𝑓(3) = 𝑃3 (3) = 7/2
Or directly substitute the value x = 3 into
𝑃3 (𝑥) to get 𝑃3 (3)
MUHAMMAD MUSA BIN YUSOF
A17KA0105

6. 𝑓(3) 𝑖 0 1 2 3
𝑓(5) if
𝑥𝑖 0 2 4 6
𝑦𝑖 = 𝑓(𝑥𝑖 ) 1 -1 -1 -1

Divided Difference Table,


[0] [1] [2] [3]
𝑖 𝑥𝑖 𝑦𝑖 = 𝑦𝑖 𝑦𝑖 𝑦𝑖 𝑦𝑖
−1 − 1 0+1 1 0 − 1/4 1
0 0 1 = −1 = =−
2−0 4−0 4 6−0 24

−1 + 1 0−0
1 2 -1 =0 =0
4−2 6−2

−1 + 1
2 4 -1 =0
6−4

3 6 -1

Newton Divided Difference Interpolation,


[1] [2] [𝑛]
𝑃𝑛 (𝑥) = 𝑦0 + 𝑦0 (𝑥 − 𝑥0 ) + 𝑦0 (𝑥 − 𝑥0 )(𝑥 − 𝑥1 ) + ⋯ + 𝑦0 (𝑥 − 𝑥0 )(𝑥 − 𝑥1 ) … (𝑥 − 𝑥𝑛−1 )
[1] [2] [3]
𝑃3 (𝑥) = 𝑦0 + 𝑦0 (𝑥 − 𝑥0 ) + 𝑦0 (𝑥 − 𝑥0 )(𝑥 − 𝑥1 ) + 𝑦0 (𝑥 − 𝑥0 )(𝑥 − 𝑥1 )(𝑥 − 𝑥2 )
1 1
= 1 + (−1)(𝑥 − 0) + (𝑥 − 0)(𝑥 − 2) + (− )(𝑥 − 0)(𝑥 − 2)(𝑥 − 4)
4 24
1 1
= 1 − 𝑥 + 𝑥(𝑥 − 2) + (− )𝑥(𝑥 − 2)(𝑥 − 4)
4 24

Verifying Interpolation condition,


𝑃3 (0) = 1
Interpolation condition are satisfied.
𝑃3 (2) = −1
Verification is not compulsory if question does not ask for it.
𝑃3 (4) = −1
𝑃3 (6) = −1

Degree of interpolation polynomial,


From Divided Difference Table, clearly that the degree of 𝑃3 (𝑥) is 3

When 𝒙 = 𝟑, When 𝒙 = 𝟓,
𝑃3 (3) = −9/8 𝑃3 (5) = −7/8
Then : 𝑓(3) = 𝑃3 (3) = −9/8 Then : 𝑓(5) = 𝑃3 (5) = −7/8

Or directly substitute the value x = 3 & x = 5


into 𝑃3 (𝑥) to get 𝑃3 (3) & 𝑃3 (5)
MUHAMMAD MUSA BIN YUSOF
A17KA0105

Newton Divided Difference Interpolation TEMPLATE

𝑓(𝑔) if 𝑖 0 1 2 3
𝑥𝑖 a b c d
𝑦𝑖 = 𝑓(𝑥𝑖 ) P Q R S

Divided Difference Table,


[0] [1] [2] [3]
𝑖 𝑥𝑖 𝑦𝑖 = 𝑦𝑖 𝑦𝑖 𝑦𝑖 𝑦𝑖
𝑄−𝑃 𝑡−𝑠 𝑤−𝑣
0 a P =𝑠 =𝑣 =𝑧
𝑏−𝑎 𝑐−𝑎 𝑑−𝑎

𝑅−𝑄 𝑢−𝑡
1 b Q =𝑡 =𝑤
𝑐−𝑏 𝑑−𝑏

𝑆−𝑅
2 c R =𝑢
𝑑−𝑐

3 d S

Newton Divided Difference Interpolation,


[1] [2] [𝑛]
𝑃𝑛 (𝑥) = 𝑦0 + 𝑦0 (𝑥 − 𝑥0 ) + 𝑦0 (𝑥 − 𝑥0 )(𝑥 − 𝑥1 ) + ⋯ + 𝑦0 (𝑥 − 𝑥0 )(𝑥 − 𝑥1 ) … (𝑥 − 𝑥𝑛−1 )
[1] [2] [3]
𝑃𝑛 (𝑥) = 𝑦0 + 𝑦0 (𝑥 − 𝑥0 ) + 𝑦0 (𝑥 − 𝑥0 )(𝑥 − 𝑥1 ) + 𝑦0 (𝑥 − 𝑥0 )(𝑥 − 𝑥1 )(𝑥 − 𝑥2 )
= 𝑃 + 𝑠(𝑥 − 𝑎) + 𝑣(𝑥 − 𝑎)(𝑥 − 𝑏) + 𝑧(𝑥 − 𝑎)(𝑥 − 𝑏)(𝑥 − 𝑐)

Verifying Interpolation condition,


𝑃𝑛 (𝑎) = 𝑃
𝑃𝑛 (𝑏) = 𝑄 Interpolation condition are satisfied.
Verification is not compulsory if question does not ask for it.
𝑃𝑛 (𝑐) = 𝑅
𝑃𝑛 (𝑑) = 𝑆

When 𝒙 = 𝒈,
𝑃𝑛 (𝑔) = _____
Then : 𝑓(𝑔) = 𝑃𝑛 (𝑔) = _____

Or directly substitute the value x = g into


𝑃𝑛 (𝑥) to get 𝑃𝑛 (𝑔)
MUHAMMAD MUSA BIN YUSOF
A17KA0105

INTERPOLATION WITH UNIFORMLY SPACED DATA


***Exercise 3.3
1. The following data obtain from polynomial function 𝑓(𝑥) = 2𝑥 3 + 3𝑥 + 1,
𝑖 0 1 2 3 4
𝑥𝑖 0.1 0.2 0.3 0.4 0.5
𝑦𝑖 = 𝑓(𝑥𝑖 ) 1.3020 1.6160 1.9540 2.3280 2.7500

a) Construct the forward difference table and show that the forward difference of
order four is zero

𝑖 𝑥𝑖 𝑦𝑖 ∆𝑦𝑖 ∆2 𝑦𝑖 ∆3 𝑦𝑖 ∆4 𝑦𝑖

1.6160 − 1.3020 0.3380 − 0.3140 0.0360 − 0.0240 0.0120 − 0.0120


0 0.1 1.3020
= 0.3140 = 0.0240 = 0.0120 = 0.0000

1.9540 − 1.6160 0.3740 − 0.3380 0.0480 − 0.0360


1 0.2 1.6160
= 0.3380 = 0.0360 = 0.0120

2.3280 − 1.9540 0.4220 − 0.3740


2 0.3 1.9540
= 0.3740 = 0.0480

2.7500 − 2.3280
3 0.4 2.3280
= 0.4220

4 0.5 2.7500
MUHAMMAD MUSA BIN YUSOF
A17KA0105

2. Use the data below to approximate the value of :


𝑖 0 1 2 3
𝑥𝑖 -0.3 -0.1 0.1 0.3
𝑦𝑖 = 𝑓(𝑥𝑖 ) -0.2043 -0.0899 0.1101 0.3957

a) 𝑓(−0.2) using Newton FORWARD Difference Polynomial Interpolation


Forward Difference Table,

𝑖 𝑥𝑖 𝑦𝑖 ∆𝑦𝑖 ∆2 𝑦𝑖 ∆3 𝑦𝑖

−0.0899 + 0.2043 0.2000 − 0.1144 0.0856 − 0.0856


0 -0.3 -0.2043
= 0.1144 = 0.0856 = 0.0000

0.1101 + 0.0899 0.2856 − 0.20000


1 -0.1 -0.0899
= 0.2000 = 0.0856

0.3957 − 0.1101
2 0.1 0.1101
= 0.2856

3 0.3 0.3957

Newton Forward Difference Polynomial Interpolation,


𝑟(𝑟 − 1) 2 𝑟(𝑟 − 1) … (𝑟 − (𝑛 − 1)) 𝑛
𝑃𝑛 (𝑥) = 𝑃𝑛 (𝑥0 + 𝑟ℎ) = 𝑦0 + 𝑟∆𝑦0 + ∆ 𝑦0 + ⋯ + ∆ 𝑦0
2! 𝑛!
𝑟(𝑟 − 1) 2 𝑟(𝑟 − 1)(𝑟 − 2) 3
𝑃3 (𝑥) = 𝑃3 (𝑥0 + 𝑟ℎ) = 𝑦0 + 𝑟∆𝑦0 + ∆ 𝑦0 + ∆ 𝑦0
2! 3!
When 𝒙 = −𝟎. 𝟐,
𝑥 − 𝑥0 𝑥 − 𝑥0 −0.2 − (−0.3)
𝑟= = = = 0.5
ℎ 𝑥1 − 𝑥0 −0.1 − (−0.3)

Therefore,
0.5(0.5 − 1) 0.5(0.5 − 1)(0.5 − 2)
𝑃3 (−0.2) = −0.2043 + 0.5(0.1144) + (0.0856) + (0)
2! 3!
= −0.2043 + 0.0572 + (−0.0107) + 0
= −0.1578

∴ 𝒇(−𝟎. 𝟐) = 𝑷𝟑 (−𝟎. 𝟐) = −𝟎. 𝟏𝟓𝟕𝟖


MUHAMMAD MUSA BIN YUSOF
A17KA0105

b) 𝑓(0.2) using Newton BACKWARD Difference Polynomial Interpolation


Backward Difference Table,

𝑖 𝑥𝑖 𝑦𝑖 ∇𝑦𝑖 ∇2 𝑦𝑖 ∇3 𝑦𝑖

0 -0.3 -0.2043

−0.0899 + 0.2043
1 -0.1 -0.0899
= 0.1144

0.1101 + 0.0899 0.2000 − 0.1144


2 0.1 0.1101
= 0.2000 = 0.0856

0.3957 − 0.1101 0.2856 − 0.20000 0.0856 − 0.0856


3 0.3 0.3957
= 0.2856 = 0.0856 = 0.0000

Newton Backward Difference Polynomial Interpolation,


𝑟(𝑟 + 1) 2 𝑟(𝑟 + 1) … (𝑟 + (𝑛 − 1)) 𝑛
𝑃𝑛 (𝑥) = 𝑃𝑛 (𝑥𝑛 + 𝑟ℎ) = 𝑦𝑛 + 𝑟∇𝑦𝑛 + ∇ 𝑦𝑛 + ⋯ + ∇ 𝑦𝑛
2! 𝑛!
𝑟(𝑟 + 1) 2 𝑟(𝑟 + 1)(𝑟 + 2) 3
𝑃3 (𝑥) = 𝑃3 (𝑥3 + 𝑟ℎ) = 𝑦3 + 𝑟∇𝑦3 + ∇ 𝑦3 + ∇ 𝑦3
2! 3!
When 𝒙 = 𝟎. 𝟐,
𝑥 − 𝑥𝑛 𝑥 − 𝑥3 0.2 − 0.3
𝑟= = = = −0.5
ℎ 𝑥3 − 𝑥2 0.3 − 0.1

Therefore,
(−0.5)(−0.5 + 1) (−0.5)(−0.5 + 1)(−0.5 + 2)
𝑃3 (0.2) = 0.3957 + (−0.5)(0.2856) + (0.0856) + (0)
2! 3!
= 0.3957 + (−0.1428) + (−0.0107) + 0
= 0.2422

∴ 𝒇(𝟎. 𝟐) = 𝑷𝟑 (𝟎. 𝟐) = 𝟎. 𝟐𝟒𝟐𝟐


MUHAMMAD MUSA BIN YUSOF
A17KA0105

3. Use the data below to approximate the value of :


𝑖 0 1 2 3
𝑥𝑖 0.2 0.4 0.6 0.8
𝑦𝑖 = 𝑓(𝑥𝑖 ) 0.9799 0.9178 0.8080 0.6386

a) 𝑓(0.25) using Newton FORWARD Difference Polynomial Interpolation


Forward Difference Table,

𝑖 𝑥𝑖 𝑦𝑖 ∆𝑦𝑖 ∆2 𝑦𝑖 ∆3 𝑦𝑖

0.9178 − 0.9799 −0.1098 + 0.0621 −0.0596 + 0.0477


0 0.2 0.9799
= −0.0621 = −0.0477 = −0.0119

0.8080 − 0.9178 −0.1694 + 0.1098


1 0.4 0.9178
= −0.1098 = −0.0596

0.6386 − 0.8080
2 0.6 0.8080
= −0.1694

3 0.8 0.6386

Newton Forward Difference Polynomial Interpolation,


𝑟(𝑟 − 1) 2 𝑟(𝑟 − 1) … (𝑟 − (𝑛 − 1)) 𝑛
𝑃𝑛 (𝑥) = 𝑃𝑛 (𝑥0 + 𝑟ℎ) = 𝑦0 + 𝑟∆𝑦0 + ∆ 𝑦0 + ⋯ + ∆ 𝑦0
2! 𝑛!
𝑟(𝑟 − 1) 2 𝑟(𝑟 − 1)(𝑟 − 2) 3
𝑃3 (𝑥) = 𝑃3 (𝑥0 + 𝑟ℎ) = 𝑦0 + 𝑟∆𝑦0 + ∆ 𝑦0 + ∆ 𝑦0
2! 3!
When 𝒙 = 𝟎. 𝟐𝟓,
𝑥 − 𝑥0 𝑥 − 𝑥0 0.25 − 0.2
𝑟= = = = 0.25
ℎ 𝑥1 − 𝑥0 0.4 − 0.2

Therefore,
0.25(0.25 − 1) 0.25(0.25 − 1)(0.25 − 2)
𝑃3 (0.25) = 0.9799 + 0.25(−0.0621) + (−0.0477) + (−0.0119)
2! 3!
= 0.9799 + (−0.0155) + 0.0045 + (−0.0007)
= 0.9682

∴ 𝒇(𝟎. 𝟐𝟓) = 𝑷𝟑 (𝟎. 𝟐𝟓) = 𝟎. 𝟗𝟔𝟖𝟐


MUHAMMAD MUSA BIN YUSOF
A17KA0105

b) 𝑓(0.75) using Newton BACKWARD Difference Polynomial Interpolation


Backward Difference Table,

𝑖 𝑥𝑖 𝑦𝑖 ∇𝑦𝑖 ∇2 𝑦𝑖 ∇3 𝑦𝑖

0 0.2 0.9799

0.9178 − 0.9799
1 0.4 0.9178
= −0.0621

0.8080 − 0.9178 −0.1098 + 0.0621


2 0.6 0.8080
= −0.1098 = −0.0477

0.6386 − 0.8080 −0.1694 + 0.1098 −0.0596 + 0.0477


3 0.8 0.6386
= −0.1694 = −0.0596 = −0.0119

Newton Backward Difference Polynomial Interpolation,


𝑟(𝑟 + 1) 2 𝑟(𝑟 + 1) … (𝑟 + (𝑛 − 1)) 𝑛
𝑃𝑛 (𝑥) = 𝑃𝑛 (𝑥𝑛 + 𝑟ℎ) = 𝑦𝑛 + 𝑟∇𝑦𝑛 + ∇ 𝑦𝑛 + ⋯ + ∇ 𝑦𝑛
2! 𝑛!
𝑟(𝑟 + 1) 2 𝑟(𝑟 + 1)(𝑟 + 2) 3
𝑃3 (𝑥) = 𝑃3 (𝑥3 + 𝑟ℎ) = 𝑦3 + 𝑟∇𝑦3 + ∇ 𝑦3 + ∇ 𝑦3
2! 3!
When 𝒙 = 𝟎. 𝟕𝟓,
𝑥 − 𝑥𝑛 𝑥 − 𝑥3 0.75 − 0.8
𝑟= = = = −0.25
ℎ 𝑥3 − 𝑥2 0.8 − 0.6

Therefore,
(−0.25)(−0.25 + 1)
𝑃3 (0.75) = 0.6386 + (−0.25)(−0.1694) + (−0.0596)
2!
(−0.25)(−0.25 + 1)(−0.25 + 2)
+ (−0.0119)
3!
= 0.6386 + 0.0424 + 0.0056 + 0.0007
= 0.6873

∴ 𝒇(𝟎. 𝟕𝟓) = 𝑷𝟑 (𝟎. 𝟕𝟓) = 𝟎. 𝟔𝟖𝟕𝟑


MUHAMMAD MUSA BIN YUSOF
A17KA0105

4. Use the data below to approximate the value of :


𝑖 0 1 2 3 4
𝑥𝑖 0.0 0.2 0.4 0.6 0.8
𝑦𝑖 = 𝑓(𝑥𝑖 ) 1.0000 1.2214 1.4918 1.8221 2.2255

a) 𝑓(0.05) using Newton FORWARD Difference Polynomial Interpolation


Forward Difference Table,

𝑖 𝑥𝑖 𝑦𝑖 ∆𝑦𝑖 ∆2 𝑦𝑖 ∆3 𝑦𝑖 ∆4 𝑦𝑖

1.2214 − 1.0000 0.2704 − 0.2214 0.0599 − 0.0490 0.0132 − 0.0109


0 0.0 1.0000
= 0.2214 = 0.0490 = 0.0109 = 0.0023

1.4918 − 1.2214 0.3303 − 0.2704 0.0731 − 0.0599


1 0.2 1.2214
= 0.2704 = 0.0599 = 0.0132

1.8221 − 1.4918 0.4034 − 0.3303


2 0.4 1.4918
= 0.3303 = 0.0731

2.2255 − 1.8221
3 0.6 1.8221
= 0.4034

4 0.8 2.2255

Newton Forward Difference Polynomial Interpolation,


𝑟(𝑟 − 1) 2 𝑟(𝑟 − 1) … (𝑟 − (𝑛 − 1)) 𝑛
𝑃𝑛 (𝑥) = 𝑃𝑛 (𝑥0 + 𝑟ℎ) = 𝑦0 + 𝑟∆𝑦0 + ∆ 𝑦0 + ⋯ + ∆ 𝑦0
2! 𝑛!
𝑃4 (𝑥) = 𝑃4 (𝑥0 + 𝑟ℎ)
𝑟(𝑟 − 1) 2 𝑟(𝑟 − 1)(𝑟 − 2) 3 𝑟(𝑟 − 1)(𝑟 − 2)(𝑟 − 3) 4
= 𝑦0 + 𝑟∆𝑦0 + ∆ 𝑦0 + ∆ 𝑦0 + ∆ 𝑦0
2! 3! 4!
When 𝒙 = 𝟎. 𝟎𝟓,
𝑥 − 𝑥0 𝑥 − 𝑥0 0.05 − 0.0
𝑟= = = = 0.25
ℎ 𝑥1 − 𝑥0 0.2 − 0.0

Therefore,
0.25(0.25 − 1) 0.25(0.25 − 1)(0.25 − 2)
𝑃4 (0.05) = 1 + 0.25(0.2214) + (0.049) + (0.0109)
2! 3!
0.25(0.25 − 1)(0.25 − 2)(0.25 − 3)
+ (0.0023)
4!
= 1 + 0.0554 + (−0.0046) + 0.0006 + (−0.0001)
= 1.0513
∴ 𝒇(𝟎. 𝟎𝟓) = 𝑷𝟒 (𝟎. 𝟎𝟓) = 𝟏. 𝟎𝟓𝟏𝟑
MUHAMMAD MUSA BIN YUSOF
A17KA0105

b) 𝑓(0.65) using Newton BACKWARD Difference Polynomial Interpolation


Backward Difference Table,

𝑖 𝑥𝑖 𝑦𝑖 ∇𝑦𝑖 ∇2 𝑦𝑖 ∇3 𝑦𝑖 ∇4 𝑦𝑖

0 0.0 1.0000

1.2214 − 1.0000
1 0.2 1.2214
= 0.2214

1.4918 − 1.2214 0.2704 − 0.2214


2 0.4 1.4918
= 0.2704 = 0.0490

1.8221 − 1.4918 0.3303 − 0.2704 0.0599 − 0.0490


3 0.6 1.8221
= 0.3303 = 0.0599 = 0.0109

2.2255 − 1.8221 0.4034 − 0.3303 0.0731 − 0.0599 0.0132 − 0.0109


4 0.8 2.2255
= 0.4034 = 0.0731 = 0.0132 = 0.0023

Newton Backward Difference Polynomial Interpolation,


𝑟(𝑟 + 1) 2 𝑟(𝑟 + 1) … (𝑟 + (𝑛 − 1)) 𝑛
𝑃𝑛 (𝑥) = 𝑃𝑛 (𝑥𝑛 + 𝑟ℎ) = 𝑦𝑛 + 𝑟∇𝑦𝑛 + ∇ 𝑦𝑛 + ⋯ + ∇ 𝑦𝑛
2! 𝑛!
𝑃4 (𝑥) = 𝑃4 (𝑥4 + 𝑟ℎ)
𝑟(𝑟 + 1) 2 𝑟(𝑟 + 1)(𝑟 + 2) 3 𝑟(𝑟 + 1)(𝑟 + 2)(𝑟 + 3) 4
= 𝑦4 + 𝑟∇𝑦4 + ∇ 𝑦4 + ∇ 𝑦4 + ∇ 𝑦4
2! 3! 4!
When 𝒙 = 𝟎. 𝟔𝟓,
𝑥 − 𝑥𝑛 𝑥 − 𝑥4 0.65 − 0.8
𝑟= = = = −0.75
ℎ 𝑥4 − 𝑥3 0.8 − 0.6

Therefore,
(−0.75)(−0.75 + 1)
𝑃4 (0.65) = 2.2255 + (−0.75)(0.4034) + (0.0731)
2!
(−0.75)(−0.75 + 1)(−0.75 + 2)
+ (0.0132)
3!
(−0.75)(−0.75 + 1)(−0.75 + 2)(−0.75 + 3)
+ (0.0023)
4!
= 2.2255 + (−0.3026) + (−0.0069) + (−0.0005) + (−0.0001)
= 1.9154

∴ 𝒇(𝟎. 𝟔𝟓) = 𝑷𝟒 (𝟎. 𝟔𝟓) = 𝟏. 𝟗𝟏𝟓𝟒


MUHAMMAD MUSA BIN YUSOF
A17KA0105

Newton Forward Difference Polynomial Interpolation TEMPLATE

𝑖 0 1 2 3 4
𝑥𝑖 a b c d e
𝑦𝑖 = 𝑓(𝑥𝑖 ) P Q R S T

𝑓(𝑧) using Newton FORWARD Difference Polynomial Interpolation


Forward Difference Table,

𝑖 𝑥𝑖 𝑦𝑖 ∆𝑦𝑖 ∆2 𝑦𝑖 ∆3 𝑦𝑖 ∆4 𝑦𝑖

0 a P Q–P=G H–G=K L–K=N O–N=V

1 b Q R–Q=H I–H=L M–L=O

2 c R S–R=I J–I=M

3 d S T–S=J

4 e T

Newton Forward Difference Polynomial Interpolation,


𝑟(𝑟 − 1) 2 𝑟(𝑟 − 1) … (𝑟 − (𝑛 − 1)) 𝑛
𝑃𝑛 (𝑥) = 𝑃𝑛 (𝑥0 + 𝑟ℎ) = 𝑦0 + 𝑟∆𝑦0 + ∆ 𝑦0 + ⋯ + ∆ 𝑦0
2! 𝑛!
𝑃𝑛 (𝑥) = 𝑃𝑛 (𝑥0 + 𝑟ℎ)
𝑟(𝑟 − 1) 2 𝑟(𝑟 − 1)(𝑟 − 2) 3 𝑟(𝑟 − 1)(𝑟 − 2)(𝑟 − 3) 4
= 𝑦0 + 𝑟∆𝑦0 + ∆ 𝑦0 + ∆ 𝑦0 + ∆ 𝑦0
2! 3! 4!
When 𝒙 = 𝒛,
𝑥 − 𝑥0 𝑥 − 𝑥0 z−a
𝑟= = = =W
ℎ 𝑥1 − 𝑥0 b − a

Therefore,
W(W − 1) W(W − 1)(W − 2) W(W − 1)(W − 2)(W − 3)
𝑃𝑛 (z) = P + W(G) + (K) + (N) + (V)
2! 3! 4!
= _____________
∴ 𝒇(𝒛) = 𝑷𝒏 (𝒛) = ________________
MUHAMMAD MUSA BIN YUSOF
A17KA0105

Newton Backward Difference Polynomial Interpolation TEMPLATE

𝑖 0 1 2 3 4
𝑥𝑖 a b c d e
𝑦𝑖 = 𝑓(𝑥𝑖 ) P Q R S T

𝑓(𝑧) using Newton BACKWARD Difference Polynomial Interpolation


Backward Difference Table,

𝑖 𝑥𝑖 𝑦𝑖 ∇𝑦𝑖 ∇2 𝑦𝑖 ∇3 𝑦𝑖 ∇4 𝑦𝑖

0 a P

1 b Q Q–P=G

2 c R R–Q=H H–G=K

3 d S S–R=I I–H=L L–K=N

4 e T T–S=J J–I=M M–L=O O–N=V

Newton Backward Difference Polynomial Interpolation,


𝑟(𝑟 + 1) 2 𝑟(𝑟 + 1) … (𝑟 + (𝑛 − 1)) 𝑛
𝑃𝑛 (𝑥) = 𝑃𝑛 (𝑥𝑛 + 𝑟ℎ) = 𝑦𝑛 + 𝑟∇𝑦𝑛 + ∇ 𝑦𝑛 + ⋯ + ∇ 𝑦𝑛
2! 𝑛!
𝑃𝑛 (𝑥) = 𝑃𝑛 (𝑥𝑛 + 𝑟ℎ)
𝑟(𝑟 + 1) 2 𝑟(𝑟 + 1)(𝑟 + 2) 3 𝑟(𝑟 + 1)(𝑟 + 2)(𝑟 + 3) 4
= 𝑦𝑛 + 𝑟∇𝑦𝑛 + ∇ 𝑦𝑛 + ∇ 𝑦𝑛 + ∇ 𝑦𝑛
2! 3! 4!
When 𝒙 = 𝒛,
𝑥 − 𝑥𝑛 𝑥 − 𝑥4 z−e
𝑟= = = =W
ℎ 𝑥4 − 𝑥3 e − d

Therefore,
W(W + 1) W(W + 1)(W + 2) W(W + 1)(W + 2)(W + 3)
𝑃𝑛 (z) = T + W(J) + (M) + (O) + (V)
2! 3! 4!
= _____________

∴ 𝒇(𝒛) = 𝑷𝒏 (𝒛) = ________________


MUHAMMAD MUSA BIN YUSOF
A17KA0105

LINEAR LEAST-SQUARES
***Exercise 4.1
For question 1 – 4, fit the given data using the least square line 𝑦 = 𝐴 + 𝐵𝑥. Calculate the sum
of the squares of errors, S. Shown calculation in four decimal places (4DP).

𝑥 1.0 2.1 3.2 4.3 5.2 6.0


1.
𝑦 1.5 3.2 3.5 3.0 3.5 4.2

Let linear least square as 𝑦 = 𝐴 + 𝐵𝑥 to the data {(𝑥𝑖 , 𝑦𝑖 )}5𝑖=0. The unknown A and B can
determine by solving the following linear system
5 5 5

∑1 ∑ 𝑥𝑖 ∑ 𝑦𝑖
𝑖=0 𝑖=0 𝐴 𝑖=0
5 5 ( )= 5
𝐵
∑ 𝑥𝑖 ∑ 𝑥𝑖2 ∑ 𝑥𝑖 𝑦𝑖
( 𝑖=0 𝑖=0 ) ( 𝑖=0 )
The various summations are evaluated in a tabular form as follow:
𝑖 𝑥𝑖 𝑦𝑖 𝑥𝑖2 𝑥𝑖 𝑦𝑖
0 1.0 1.5 1.0 1.5
1 2.1 3.2 4.41 6.72
2 3.2 3.5 10.24 11.2
3 4.3 3.0 18.49 12.9
4 5.2 3.5 27.04 18.2
5 6.0 4.2 36 25.2
5

∑ 21.8 18.9 97.18 75.72


𝑖=0

Gives
6 21.8 𝐴 18.9
( )( ) = ( )
21.8 97.18 𝐵 75.72
Solve this linear system to get A = 1.7248 and B = 0.3922  𝒚(𝒙) = 𝟏. 𝟕𝟐𝟒𝟖 + 𝟎. 𝟑𝟗𝟐𝟐𝒙
The sum of square errors, S, is evaluated in a tabular form as follows.

𝑖 𝑥𝑖 𝑦𝑖 𝑦(𝑥𝑖 ) 𝑒𝑖 = 𝑦𝑖 − 𝑦(𝑥𝑖 ) 𝑒𝑖2 = (𝑦𝑖 − 𝑦(𝑥𝑖 ))2


0 1.0 1.5 2.1170 -0.6170 0.3807
1 2.1 3.2 2.5484 0.6516 0.4246
2 3.2 3.5 2.9798 0.5202 0.2706
3 4.3 3.0 3.4113 -0.4113 0.1692
4 5.2 3.5 3.7642 -0.2642 0.0698
5 6.0 4.2 4.0780 0.1220 0.0149
5

𝑆 = ∑ 𝑒𝑖2 1.3298
𝑖=0
MUHAMMAD MUSA BIN YUSOF
A17KA0105

2. 𝑥 0 0.15 0.31 0.5 0.6 0.75


𝑦 1.0 1.006 1.035 1.175 1.234 1.254

Let linear least square as 𝑦 = 𝐴 + 𝐵𝑥 to the data {(𝑥𝑖 , 𝑦𝑖 )}5𝑖=0. The unknown A and B can
determine by solving the following linear system
5 5 5

∑1 ∑ 𝑥𝑖 ∑ 𝑦𝑖
𝑖=0 𝑖=0 𝐴 𝑖=0
5 5 ( )= 5
𝐵
∑ 𝑥𝑖 ∑ 𝑥𝑖2 ∑ 𝑥𝑖 𝑦𝑖
( 𝑖=0 𝑖=0 ) ( 𝑖=0 )
Using Calculator [Mode = Statistics] :-
5 5

∑1 = 6 ∑ 𝑥𝑖2 = 1.2911
5
𝑖=0 𝑖=0
∑ 𝑥𝑖 𝑦𝑖 = 2.7402
5 5
𝑖=0
∑ 𝑥𝑖 = 2.31 ∑ 𝑦𝑖 = 6.704
𝑖=0 𝑖=0

6 2.31 𝐴 6.704
( )( ) = ( )
2.31 1.2911 𝐵 2.7402
Solve this linear system to get A = 0.9649 and B = 0.3960  𝒚(𝒙) = 𝟎. 𝟗𝟔𝟒𝟗 + 𝟎. 𝟑𝟗𝟔𝟎𝒙
The sum of square errors, S, is evaluated in a tabular form as follows.

𝑖 𝑥𝑖 𝑦𝑖 𝑦(𝑥𝑖 ) 𝑒𝑖 = 𝑦𝑖 − 𝑦(𝑥𝑖 ) 𝑒𝑖2 = (𝑦𝑖 − 𝑦(𝑥𝑖 ))2


0 0 1.0 0.9649 0.0351 0.0012
1 0.15 1.006 1.0243 -0.0183 0.0003
2 0.31 1.035 1.0877 -0.0527 0.0028
3 0.5 1.175 1.1629 0.0121 0.0001
4 0.6 1.234 1.2025 0.0315 0.0010
5 0.75 1.254 1.2619 -0.0079 0.0001
5

𝑆 = ∑ 𝑒𝑖2 0.0055
𝑖=0

𝐒𝐔𝐌 𝐎𝐅 𝐒𝐐𝐔𝐀𝐑𝐄 𝐄𝐑𝐑𝐎𝐑𝐒 , 𝑺 ∶ 𝟎. 𝟎𝟎𝟓𝟓


MUHAMMAD MUSA BIN YUSOF
A17KA0105

3. 𝑥 4.0 4.2 4.5 4.8 5.2 5.6 6.0


𝑦 10.36 9.48 13.02 12.21 16.83 14.54 22.58

Let linear least square as 𝑦 = 𝐴 + 𝐵𝑥 to the data {(𝑥𝑖 , 𝑦𝑖 )}6𝑖=0. The unknown A and B can
determine by solving the following linear system
6 6 6

∑1 ∑ 𝑥𝑖 ∑ 𝑦𝑖
𝑖=0 𝑖=0 𝐴 𝑖=0
6 6 ( )= 6
𝐵
∑ 𝑥𝑖 ∑ 𝑥𝑖2 ∑ 𝑥𝑖 𝑦𝑖
( 𝑖=0 𝑖=0 ) ( 𝑖=0 )
Using Calculator [Mode = Statistics] :-
6 6

∑1 = 7 ∑ 𝑥𝑖2 = 171.33
6
𝑖=0 𝑖=0
∑ 𝑥𝑖 𝑦𝑖 = 502.874
6 6
𝑖=0
∑ 𝑥𝑖 = 34.3 ∑ 𝑦𝑖 = 99.02
𝑖=0 𝑖=0

7 34.3 𝐴 99.02
( )( ) = ( )
34.3 171.33 𝐵 502.874
Solve this linear system to get A = - 12.4225 and B = 5.4221  𝒚(𝒙) = −𝟏𝟐. 𝟒𝟐𝟐𝟓 + 𝟓. 𝟒𝟐𝟐𝟏𝒙
The sum of square errors, S, is evaluated in a tabular form as follows.

𝑖 𝑥𝑖 𝑦𝑖 𝑦(𝑥𝑖 ) 𝑒𝑖 = 𝑦𝑖 − 𝑦(𝑥𝑖 ) 𝑒𝑖2 = (𝑦𝑖 − 𝑦(𝑥𝑖 ))2


0 4.0 10.36 9.2659 1.0941 1.1971
1 4.2 9.48 10.3503 -0.8703 0.7574
2 4.5 13.02 11.9770 1.0430 1.0878
3 4.8 12.21 13.6036 -1.3936 1.9421
4 5.2 16.83 15.7724 1.0576 1.1185
5 5.6 14.54 17.9413 -3.4013 11.5688
6 6.0 22.58 20.1101 2.4699 6.1004
6

𝑆 = ∑ 𝑒𝑖2 23.7721
𝑖=0

𝐒𝐔𝐌 𝐎𝐅 𝐒𝐐𝐔𝐀𝐑𝐄 𝐄𝐑𝐑𝐎𝐑𝐒 , 𝑺 ∶ 𝟐𝟑. 𝟕𝟕𝟐𝟏


MUHAMMAD MUSA BIN YUSOF
A17KA0105

4. 𝑥 0.2 0.3 0.6 0.9 1.1 1.3 1.4 1.5


𝑦 5.04 6.83 4.34 10.25 13.96 15.76 18.47 19.15

Let linear least square as 𝑦 = 𝐴 + 𝐵𝑥 to the data {(𝑥𝑖 , 𝑦𝑖 )}7𝑖=0. The unknown A and B can
determine by solving the following linear system
7 7 7

∑1 ∑ 𝑥𝑖 ∑ 𝑦𝑖
𝑖=0 𝑖=0 𝐴 𝑖=0
7 7 ( )= 7
𝐵
∑ 𝑥𝑖 ∑ 𝑥𝑖2 ∑ 𝑥𝑖 𝑦𝑖
( 𝑖=0 𝑖=0 ) ( 𝑖=0 )

Using Calculator [Mode = Statistics] :-


7 7

∑1 = 8 ∑ 𝑥𝑖2 = 8.41
7
𝑖=0 𝑖=0
∑ 𝑥𝑖 𝑦𝑖 = 105.313
7 7
𝑖=0
∑ 𝑥𝑖 = 7.3 ∑ 𝑦𝑖 = 93.8
𝑖=0 𝑖=0

8 7.3 𝐴 93.8
( )( ) = ( )
7.3 8.41 𝐵 105.313
Solve this linear system to get A = 1.4348 and B = 11.2769  𝒚(𝒙) = 𝟏. 𝟒𝟑𝟒𝟖 + 𝟏𝟏. 𝟐𝟕𝟔𝟗𝒙
The sum of square errors, S, is evaluated in a tabular form as follows.
𝑖 𝑥𝑖 𝑦𝑖 𝑦(𝑥𝑖 ) 𝑒𝑖 = 𝑦𝑖 − 𝑦(𝑥𝑖 ) 𝑒𝑖2 = (𝑦𝑖 − 𝑦(𝑥𝑖 ))2
0 0.2 5.04 3.6902 1.3498 1.8220
1 0.3 6.83 4.8179 2.0121 4.0485
2 0.6 4.34 8.2009 -3.8609 14.9065
3 0.9 10.25 11.5840 -1.3340 1.7796
4 1.1 13.96 13.8394 0.1206 0.0145
5 1.3 15.76 16.0948 -0.3348 0.1121
6 1.4 18.47 17.2225 1.2475 1.5563
7 1.5 19.15 18.3502 0.7998 0.6397
7

𝑆 = ∑ 𝑒𝑖2 24.8792
𝑖=0

𝐒𝐔𝐌 𝐎𝐅 𝐒𝐐𝐔𝐀𝐑𝐄 𝐄𝐑𝐑𝐎𝐑𝐒 , 𝑺 ∶ 𝟐𝟒. 𝟖𝟕𝟗𝟐


MUHAMMAD MUSA BIN YUSOF
A17KA0105

Linear Least-Squares TEMPLATE

𝑥
𝑦

Let linear least square as 𝑦 = 𝐴 + 𝐵𝑥 to the data {(𝑥𝑖 , 𝑦𝑖 )}𝑛𝑖=0. The unknown A and B can
determine by solving the following linear system
n n n

∑1 ∑ 𝑥𝑖 ∑ 𝑦𝑖
𝑖=0 𝑖=0 𝐴 𝑖=0
n n ( )= n
𝐵
∑ 𝑥𝑖 ∑ 𝑥𝑖2 ∑ 𝑥𝑖 𝑦𝑖
( 𝑖=0 𝑖=0 ) ( 𝑖=0 )
Using Calculator [Mode = Statistics] :-
n n

∑1 = ∑ 𝑥𝑖2 =
n
𝑖=0 𝑖=0
∑ 𝑥𝑖 𝑦𝑖 =
n n
𝑖=0
∑ 𝑥𝑖 = ∑ 𝑦𝑖 =
𝑖=0 𝑖=0

𝐴
( )( ) = ( )
𝐵
Solve this linear system to get A = ______ and B = ______  𝒚(𝒙) = 𝑨 + 𝑩𝒙
The sum of square errors, S, is evaluated in a tabular form as follows.
𝑖 𝑥𝑖 𝑦𝑖 𝑦(𝑥𝑖 ) 𝑒𝑖 = 𝑦𝑖 − 𝑦(𝑥𝑖 ) 𝑒𝑖2 = (𝑦𝑖 − 𝑦(𝑥𝑖 ))2
0
1
2
3
4
5
6
7
𝑛

𝑆 = ∑ 𝑒𝑖2
𝑖=0

𝐒𝐔𝐌 𝐎𝐅 𝐒𝐐𝐔𝐀𝐑𝐄 𝐄𝐑𝐑𝐎𝐑𝐒 , 𝑺 ∶


MUHAMMAD MUSA BIN YUSOF
A17KA0105

QUADRATIC LEAST-SQUARES
***Exercise 4.2
For question 1 – 4, fit the given data using the parabolic least square, 𝑦 = 𝐴 + 𝐵𝑥 + 𝐶𝑥 2 .
Calculate the sum of the squares of errors. Shown calculation in four decimal places (4DP).

1. 𝑥 1.0 2.1 3.2 4.3 5.2 6.0


𝑦 1.5 3.2 3.5 3.0 3.5 4.2

Let quadratic least square as 𝑦 = 𝐴 + 𝐵𝑥 to the data {(𝑥𝑖 , 𝑦𝑖 )}5𝑖=0. The unknown A, B and C
can determine by solving
5 5 5 5

∑1 ∑ 𝑥𝑖 ∑ 𝑥𝑖2 ∑ 𝑦𝑖
𝑖=0 𝑖=0 𝑖=0 𝑖=0
5 5 5 𝐴 5

∑ 𝑥𝑖 ∑ 𝑥𝑖2 ∑ 𝑥𝑖3 (𝐵 ) = ∑ 𝑥𝑖 𝑦𝑖
𝑖=0 𝑖=0 𝑖=0 𝐶 𝑖=0
5 5 5 5

∑ 𝑥𝑖2 ∑ 𝑥𝑖3 ∑ 𝑥𝑖4 ∑ 𝑥𝑖2 𝑦𝑖


( 𝑖=0 𝑖=0 𝑖=0 ) ( 𝑖=0 )
Using Calculator [Mode = Statistics] :-
5 5 5 5

∑1 = 6 ∑ 𝑥𝑖2 = 97.18 ∑ 𝑥𝑖4 = 2494.3474 ∑ 𝑥𝑖 𝑦𝑖 = 75.72


𝑖=0 𝑖=0 𝑖=0 𝑖=0
5 5 5 5

∑ 𝑥𝑖 = 21.8 ∑ 𝑥𝑖3 = 479.144 ∑ 𝑦𝑖 = 18.9 ∑ 𝑥𝑖2 𝑦𝑖 = 352.762


𝑖=0 𝑖=0 𝑖=0 𝑖=0

6 21.8 97.18 𝐴 18.9


( 21.8 97.18 479.144 ) (𝐵 ) = ( 75.72 )
97.18 479.144 2494.3474 𝐶 352.762
Solve this linear system to get A = 1.0075 and B = 0.9340 and C = -0.0772
 𝒚(𝒙) = 𝟏. 𝟎𝟎𝟕𝟓 + 𝟎. 𝟗𝟑𝟒𝟎𝒙 − 𝟎. 𝟎𝟕𝟕𝟐𝒙𝟐
The sum of square errors, S, is evaluated in a tabular form as follows.
𝑖 𝑥𝑖 𝑦𝑖 𝑦(𝑥𝑖 ) 𝑒𝑖 = 𝑦𝑖 − 𝑦(𝑥𝑖 ) 𝑒𝑖2 = (𝑦𝑖 − 𝑦(𝑥𝑖 ))2
0 1.0 1.5 1.8643 -0.3643 0.1327
1 2.1 3.2 2.6284 0.5716 0.3267
2 3.2 3.5 3.2058 0.2942 0.0866
3 4.3 3.0 3.5963 -0.5963 0.3556
4 5.2 3.5 3.7768 -0.2768 0.0766
5 6.0 4.2 3.8323 0.3677 0.1352
5

𝑆 = ∑ 𝑒𝑖2 1.1134
𝑖=0
MUHAMMAD MUSA BIN YUSOF
A17KA0105

2. 𝑥 0 0.15 0.31 0.5 0.6 0.75


𝑦 1.0 1.006 1.035 1.175 1.234 1.254

Let quadratic least square as 𝑦 = 𝐴 + 𝐵𝑥 to the data {(𝑥𝑖 , 𝑦𝑖 )}5𝑖=0. The unknown A, B and C
can determine by solving
5 5 5 5

∑1 ∑ 𝑥𝑖 ∑ 𝑥𝑖2 ∑ 𝑦𝑖
𝑖=0 𝑖=0 𝑖=0 𝑖=0
5 5 5 𝐴 5

∑ 𝑥𝑖 ∑ 𝑥𝑖2 ∑ 𝑥𝑖3 (𝐵 ) = ∑ 𝑥𝑖 𝑦𝑖
𝑖=0 𝑖=0 𝑖=0 𝐶 𝑖=0
5 5 5 5

∑ 𝑥𝑖2 ∑ 𝑥𝑖3 ∑ 𝑥𝑖4 ∑ 𝑥𝑖2 𝑦𝑖


( 𝑖=0 𝑖=0 𝑖=0 ) ( 𝑖=0 )
Using Calculator [Mode = Statistics] :-
5 5 5 5

∑1 = 6 ∑ 𝑥𝑖2 = 1.2911 ∑ 𝑥𝑖4 = 0.5182 ∑ 𝑥𝑖 𝑦𝑖 = 2.7402


𝑖=0 𝑖=0 𝑖=0 𝑖=0
5 5 5 5

∑ 𝑥𝑖 = 2.31 ∑ 𝑥𝑖3 = 0.7960 ∑ 𝑦𝑖 = 6.704 ∑ 𝑥𝑖2 𝑦𝑖 = 1.5655


𝑖=0 𝑖=0 𝑖=0 𝑖=0

6 2.31 1.2911 𝐴 6.704


( 2.31 1.2911 0.7960) (𝐵 ) = (2.7402)
1.2911 0.7960 0.5182 𝐶 1.5655
Solve this linear system to get A = 0.9826 and B = 0.2106 and C = 0.2492
 𝒚(𝒙) = 𝟎. 𝟗𝟖𝟐𝟔 + 𝟎. 𝟐𝟏𝟎𝟔𝒙 + 𝟎. 𝟐𝟒𝟗𝟐𝒙𝟐
The sum of square errors, S, is evaluated in a tabular form as follows.

𝑖 𝑥𝑖 𝑦𝑖 𝑦(𝑥𝑖 ) 𝑒𝑖 = 𝑦𝑖 − 𝑦(𝑥𝑖 ) 𝑒𝑖2 = (𝑦𝑖 − 𝑦(𝑥𝑖 ))2


0 0 1.0 0.9826 0.0174 0.0003
1 0.15 1.006 1.0198 -0.0138 0.0002
2 0.31 1.035 1.0718 -0.0368 0.0014
3 0.5 1.175 1.1502 0.0248 0.0006
4 0.6 1.234 1.1987 0.0353 0.0012
5 0.75 1.254 1.2807 -0.0267 0.0007
5

𝑆 = ∑ 𝑒𝑖2 0.0044
𝑖=0

𝐒𝐔𝐌 𝐎𝐅 𝐒𝐐𝐔𝐀𝐑𝐄 𝐄𝐑𝐑𝐎𝐑𝐒 , 𝑺 ∶ 𝟎. 𝟎𝟎𝟒𝟒


MUHAMMAD MUSA BIN YUSOF
A17KA0105

3. 𝑥 4.0 4.2 4.5 4.8 5.2 5.6 6.0


𝑦 10.36 9.48 13.02 12.21 16.83 14.54 22.58

Let quadratic least square as 𝑦 = 𝐴 + 𝐵𝑥 to the data {(𝑥𝑖 , 𝑦𝑖 )}6𝑖=0. The unknown A, B and C
can determine by solving
6 6 6 6

∑1 ∑ 𝑥𝑖 ∑ 𝑥𝑖2 ∑ 𝑦𝑖
𝑖=0 𝑖=0 𝑖=0 𝑖=0
6 6 6 𝐴 6

∑ 𝑥𝑖 ∑ 𝑥𝑖2 ∑ 𝑥𝑖3 (𝐵 ) = ∑ 𝑥𝑖 𝑦𝑖
𝑖=0 𝑖=0 𝑖=0 𝐶 𝑖=0
6 6 6 6

∑ 𝑥𝑖2 ∑ 𝑥𝑖3 ∑ 𝑥𝑖4 ∑ 𝑥𝑖2 𝑦𝑖


( 𝑖=0 𝑖=0 𝑖=0 ) ( 𝑖=0 )
Using Calculator [Mode = Statistics] :-
6 6 6 6

∑1 = 7 ∑ 𝑥𝑖2 = 171.33 ∑ 𝑥𝑖4 = 4518.6849 ∑ 𝑥𝑖 𝑦𝑖 = 502.874


𝑖=0 𝑖=0 𝑖=0 𝑖=0
6 6 6 6

∑ 𝑥𝑖 = 34.3 ∑ 𝑥𝑖3 = 872.029 ∑ 𝑦𝑖 = 99.02 ∑ 𝑥𝑖2 𝑦𝑖 = 2601.8982


𝑖=0 𝑖=0 𝑖=0 𝑖=0

7 34.3 171.33 𝐴 99.02


( 34.3 171.33 872.029 ) (𝐵 ) = ( 502.874 )
171.33 872.029 4518.6849 𝐶 2601.8982
Solve this linear system to get A = 36.2016 and B = -14.4585 and C = 1.9934
 𝒚(𝒙) = 𝟑𝟔. 𝟐𝟎𝟏𝟔 − 𝟏𝟒. 𝟒𝟓𝟖𝟓𝒙 + 𝟏. 𝟗𝟗𝟑𝟒𝒙𝟐
The sum of square errors, S, is evaluated in a tabular form as follows.
𝑖 𝑥𝑖 𝑦𝑖 𝑦(𝑥𝑖 ) 𝑒𝑖 = 𝑦𝑖 − 𝑦(𝑥𝑖 ) 𝑒𝑖2 = (𝑦𝑖 − 𝑦(𝑥𝑖 ))2
0 4.0 10.36 10.2620 0.0980 0.0096
1 4.2 9.48 10.6395 -1.1595 1.3444
2 4.5 13.02 11.5047 1.5153 2.2961
3 4.8 12.21 12.7287 -0.5187 0.2690
4 5.2 16.83 14.9189 1.9111 3.6523
5 5.6 14.54 17.7470 -3.2070 10.2848
6 6.0 22.58 21.2130 1.3670 1.8687
6

𝑆 = ∑ 𝑒𝑖2 19.7249
𝑖=0

𝐒𝐔𝐌 𝐎𝐅 𝐒𝐐𝐔𝐀𝐑𝐄 𝐄𝐑𝐑𝐎𝐑𝐒 , 𝑺 ∶ 𝟏𝟗. 𝟕𝟐𝟒𝟗


MUHAMMAD MUSA BIN YUSOF
A17KA0105

4. 𝑥 0.2 0.3 0.6 0.9 1.1 1.3 1.4 1.5


𝑦 5.04 6.83 4.34 10.25 13.96 15.76 18.47 19.15

Let quadratic least square as 𝑦 = 𝐴 + 𝐵𝑥 to the data {(𝑥𝑖 , 𝑦𝑖 )}7𝑖=0. The unknown A, B and C
can determine by solving
7 7 7 7

∑1 ∑ 𝑥𝑖 ∑ 𝑥𝑖2 ∑ 𝑦𝑖
𝑖=0 𝑖=0 𝑖=0 𝑖=0
7 7 7 𝐴 7

∑ 𝑥𝑖 ∑ 𝑥𝑖2 ∑ 𝑥𝑖3 (𝐵 ) = ∑ 𝑥𝑖 𝑦𝑖
𝑖=0 𝑖=0 𝑖=0 𝐶 𝑖=0
7 7 7 7

∑ 𝑥𝑖2 ∑ 𝑥𝑖3 ∑ 𝑥𝑖4 ∑ 𝑥𝑖2 𝑦𝑖


( 𝑖=0 𝑖=0 𝑖=0 ) ( 𝑖=0 )
Using Calculator [Mode = Statistics] :-
7 7 7 7

∑1 = 8 ∑ 𝑥𝑖2 = 8.41 ∑ 𝑥𝑖4 = 14.0197 ∑ 𝑥𝑖 𝑦𝑖 = 105.313


𝑖=0 𝑖=0 𝑖=0 𝑖=0
7 7 7 7

∑ 𝑥𝑖 = 7.3 ∑ 𝑥𝑖3 = 10.627 ∑ 𝑦𝑖 = 93.8 ∑ 𝑥𝑖2 𝑦𝑖 = 133.4959


𝑖=0 𝑖=0 𝑖=0 𝑖=0

8 7.3 8.41 𝐴 93.8


( 7.3 8.41 10.627 ) ( 𝐵 ) = ( 105.313 )
8.41 10.627 14.0197 𝐶 133.4959
Solve this linear system to get A = 5.4753 and B = -2.6592 and C = 8.2532
 𝒚(𝒙) = 𝟓. 𝟒𝟕𝟓𝟑 − 𝟐. 𝟔𝟓𝟗𝟐𝒙 + 𝟖. 𝟐𝟓𝟑𝟐𝒙𝟐
The sum of square errors, S, is evaluated in a tabular form as follows.
𝑖 𝑥𝑖 𝑦𝑖 𝑦(𝑥𝑖 ) 𝑒𝑖 = 𝑦𝑖 − 𝑦(𝑥𝑖 ) 𝑒𝑖2 = (𝑦𝑖 − 𝑦(𝑥𝑖 ))2
0 0.2 5.04 5.2736 -0.2336 0.0546
1 0.3 6.83 5.4203 1.4097 1.9873
2 0.6 4.34 6.8509 -2.5109 6.3046
3 0.9 10.25 9.7671 0.4829 0.2332
4 1.1 13.96 12.5366 1.4234 2.0261
5 1.3 15.76 15.9662 -0.2062 0.0425
6 1.4 18.47 17.9287 0.5413 0.2930
7 1.5 19.15 20.0562 -0.9062 0.8212
7

𝑆 = ∑ 𝑒𝑖2 11.7625
𝑖=0

𝐒𝐔𝐌 𝐎𝐅 𝐒𝐐𝐔𝐀𝐑𝐄 𝐄𝐑𝐑𝐎𝐑𝐒 , 𝑺 ∶ 𝟏𝟏. 𝟕𝟔𝟐𝟓


MUHAMMAD MUSA BIN YUSOF
A17KA0105

Quadratic Least-Squares TEMPLATE

𝑥
𝑦

Let linear least square as 𝑦 = 𝐴 + 𝐵𝑥 to the data {(𝑥𝑖 , 𝑦𝑖 )}𝑛𝑖=0. The unknown A and B can
determine by solving the following linear system
n n n n

∑1 ∑ 𝑥𝑖 ∑ 𝑥𝑖2 ∑ 𝑦𝑖
𝑖=0 𝑖=0 𝑖=0 𝑖=0
n n n n
𝐴
∑ 𝑥𝑖 ∑ 𝑥𝑖2 ∑ 𝑥𝑖3 (𝐵 ) = ∑ 𝑥𝑖 𝑦𝑖
𝑖=0 𝑖=0 𝑖=0 𝐶 𝑖=0
n n n n

∑ 𝑥𝑖2 ∑ 𝑥𝑖3 ∑ 𝑥𝑖4 ∑ 𝑥𝑖2 𝑦𝑖


( 𝑖=0 𝑖=0 𝑖=0 ) ( 𝑖=0 )
Using Calculator [Mode = Statistics] :-
n n n n

∑1 = ∑ 𝑥𝑖2 = ∑ 𝑥𝑖4 = ∑ 𝑥𝑖 𝑦𝑖 =
𝑖=0 𝑖=0 𝑖=0 𝑖=0
n n n n

∑ 𝑥𝑖 = ∑ 𝑥𝑖3 = ∑ 𝑦𝑖 = ∑ 𝑥𝑖2 𝑦𝑖 =
𝑖=0 𝑖=0 𝑖=0 𝑖=0

𝐴
( ) (𝐵 ) = ( )
𝐶
Solve this linear system to get A = _________ and B = _________ and C = __________
 𝒚(𝒙) = 𝑨 + 𝑩𝒙 + 𝑪𝒙𝟐
The sum of square errors, S, is evaluated in a tabular form as follows.

𝑖 𝑥𝑖 𝑦𝑖 𝑦(𝑥𝑖 ) 𝑒𝑖 = 𝑦𝑖 − 𝑦(𝑥𝑖 ) 𝑒𝑖2 = (𝑦𝑖 − 𝑦(𝑥𝑖 ))2


0
1
2
3
4
5
𝑛

𝑆 = ∑ 𝑒𝑖2
𝑖=0

𝐒𝐔𝐌 𝐎𝐅 𝐒𝐐𝐔𝐀𝐑𝐄 𝐄𝐑𝐑𝐎𝐑𝐒 , 𝑺 ∶


MUHAMMAD MUSA BIN YUSOF
A17KA0105

FIRST DERIVATIVE
Two Point Forward Difference Formula
𝑓(𝑥 + ℎ) − 𝑓(𝑥)
𝑓 ′ (𝑥) =

Two Point Backward Difference Formula


𝑓(𝑥) − 𝑓(𝑥 − ℎ)
𝑓 ′ (𝑥) =

Two Point Central Difference Formula / Three Point Central Difference Formula
𝑓(𝑥 + ℎ) − 𝑓(𝑥 − ℎ)
𝑓 ′ (𝑥) =
2ℎ

Three Point Forward Difference Formula


1
𝑓 ′ (𝑥) = [−𝑓(𝑥 + 2ℎ) + 4𝑓(𝑥 + ℎ) − 3𝑓(𝑥)]
2ℎ

Three Point Backward Difference Formula


1
𝑓 ′ (𝑥) = [3𝑓(𝑥) − 4𝑓(𝑥 − ℎ) + 𝑓(𝑥 − 2ℎ)]
2ℎ

Five Point Central Difference Formula


1
𝑓 ′ (𝑥) = [−𝑓(𝑥 + 2ℎ) + 8𝑓(𝑥 + ℎ) − 8𝑓(𝑥 − ℎ) + 𝑓(𝑥 − 2ℎ)]
12ℎ

SECOND DERIVATIVE
Three Point Central Difference Formula
1
𝑓 ′′ (𝑥) = [𝑓(𝑥 + ℎ) − 2𝑓(𝑥) + 𝑓(𝑥 − ℎ)]
ℎ2

Five Point Central Difference Formula


1
𝑓 ′′ (𝑥) = [−𝑓(𝑥 + 2ℎ) + 16𝑓(𝑥 + ℎ) − 30𝑓(𝑥) + 16𝑓(𝑥 − ℎ) − 𝑓(𝑥 − 2ℎ)]
12ℎ2
MUHAMMAD MUSA BIN YUSOF
A17KA0105

***Exercise 5
1. If 𝑓(𝑥) = 𝑒 𝑥 , approximate 𝑓 ′ (2.3) using the following formula with ℎ = 0.1 and ℎ = 0.01.
𝑓(𝑥 + ℎ) − 𝑓(𝑥)
𝑓 ′ (𝑥) =

′ (2.3)
𝑓(2.3 + 0.1) − 𝑓(2.3) 𝑒 2.4 − 𝑒 2.3
ℎ = 0.1 → 𝑓 = = = 10.4899
0.1 0.1
′ (2.3)
𝑓(2.3 + 0.01) − 𝑓(2.3) 𝑒 2.31 − 𝑒 2.3
ℎ = 0.01 → 𝑓 = = = 10.0242
0.01 0.01

Exact value of 𝑓 ′ (2.3) = 𝑒 2.3 = 9.9742


ℎ = 0.1 → Absolute error = |9.9742 − 10.4899| = 0.5157
ℎ = 0.01 → Absolute error = |9.9742 − 10.0242| = 0.0500

𝑓(𝑥) − 𝑓(𝑥 − ℎ)
𝑓 ′ (𝑥) =

′ (2.3)
𝑓(2.3) − 𝑓(2.3 − 0.1) 𝑒 2.3 − 𝑒 2.2
ℎ = 0.1 → 𝑓 = = = 9.4917
0.1 0.1
′ (2.3)
𝑓(2.3) − 𝑓(2.3 − 0.01) 𝑒 2.3 − 𝑒 2.29
ℎ = 0.01 → 𝑓 = = = 9.9245
0.01 0.01

Exact value of 𝑓 ′ (2.3) = 𝑒 2.3 = 9.9742


ℎ = 0.1 → Absolute error = |9.9742 − 9.4917| = 0.4825
ℎ = 0.01 → Absolute error = |9.9742 − 9.9245| = 0.0497

𝑓(𝑥 + ℎ) − 𝑓(𝑥 − ℎ)
𝑓 ′ (𝑥) =
2ℎ
′ (2.3)
𝑓(2.3 + 0.1) − 𝑓(2.3 − 0.1) 𝑒 2.4 − 𝑒 2.2
ℎ = 0.1 → 𝑓 = = = 9.9908
2(0.1) 0.2
𝑓(2.3 + 0.01) − 𝑓(2.3 − 0.01) 𝑒 2.31 − 𝑒 2.29
ℎ = 0.01 → 𝑓 ′ (2.3) = = = 9.9743
2(0.01) 0.02

Exact value of 𝑓 ′ (2.3) = 𝑒 2.3 = 9.9742


ℎ = 0.1 → Absolute error = |9.9742 − 9.9908| = 0.0166
ℎ = 0.01 → Absolute error = |9.9742 − 9.9743| = 0.0001
MUHAMMAD MUSA BIN YUSOF
A17KA0105

2. Use the following formula


𝑓(𝑥 + ℎ) − 𝑓(𝑥 − ℎ)
𝑓 ′ (𝑥) =
2ℎ
Or formula
𝑓(𝑥 + ℎ) − 𝑓(𝑥)
𝑓 ′ (𝑥) =

𝑓(𝑥) − 𝑓(𝑥 − ℎ)
𝑓 ′ (𝑥) =

To complete the given table.

(a)
𝑥 −0.3 −0.1 0.1 0.3
𝑓(𝑥) −0.2043 −0.0899 0.1101 0.3957
𝑓 ′ (𝑥) 0.5720 0.7860 1.2140 1.4280

ℎ = −0.1 − (−0.3) = 0.2

(b)
𝑥 1.1 1.2 1.3 1.4
𝑓(𝑥) 0.4860 0.8616 1.5975 3.7616
𝑓 ′ (𝑥) 3.7560 5.5575 14.5000 21.6410

ℎ = 1.2 − 1.1 = 0.1


MUHAMMAD MUSA BIN YUSOF
A17KA0105

3. Given the tabulated values of 𝑓(𝑥) as follows :

𝑥 0.2 0.4 0.6 0.8 1.0


𝑓(𝑥) 0.9799 0.9178 0.8080 0.6386 0.3844

Using the suitable following formula with ℎ = 0.2


𝑓(𝑥 + ℎ) − 𝑓(𝑥)
𝑓 ′ (𝑥) = →1

𝑓(𝑥) − 𝑓(𝑥 − ℎ)
𝑓 ′ (𝑥) = →2

𝑓(𝑥 + ℎ) − 𝑓(𝑥 − ℎ)
𝑓 ′ (𝑥) = →3
2ℎ
1
𝑓 ′ (𝑥) = [−𝑓(𝑥 + 2ℎ) + 4𝑓(𝑥 + ℎ) − 3𝑓(𝑥)] →4
2ℎ
1
𝑓 ′ (𝑥) = [3𝑓(𝑥) − 4𝑓(𝑥 − ℎ) + 𝑓(𝑥 − 2ℎ)] →5
2ℎ
1
𝑓 ′ (𝑥) = [−𝑓(𝑥 + 2ℎ) + 8𝑓(𝑥 + ℎ) − 8𝑓(𝑥 − ℎ) + 𝑓(𝑥 − 2ℎ)] →6
12ℎ
1
𝑓 ′′ (𝑥) = 2 [𝑓(𝑥 + ℎ) − 2𝑓(𝑥) + 𝑓(𝑥 − ℎ)] →7

MUHAMMAD MUSA BIN YUSOF
A17KA0105

Approximate :
(a) 𝑓 ′ (0.6) → using equation 1 to 6

𝑓(𝑥 + ℎ) − 𝑓(𝑥)
𝑓 ′ (𝑥) =

𝑓(0.8) − 𝑓(0.6)
=
0.2
= −0.8470
𝑓(𝑥) − 𝑓(𝑥 − ℎ)
𝑓 ′ (𝑥) =

𝑓(0.6) − 𝑓(0.4)
=
0.2
= −0.5490
𝑓(𝑥 + ℎ) − 𝑓(𝑥 − ℎ)
𝑓 ′ (𝑥) =
2ℎ
𝑓(0.8) − 𝑓(0.4)
=
0.4
= −0.6980
1
𝑓 ′ (𝑥) = [−𝑓(𝑥 + 2ℎ) + 4𝑓(𝑥 + ℎ) − 3𝑓(𝑥)]
2ℎ
1
= [−𝑓(1) + 4𝑓(0.8) − 3𝑓(0.6)]
0.4
= −0.6350
1
𝑓 ′ (𝑥) = [3𝑓(𝑥) − 4𝑓(𝑥 − ℎ) + 𝑓(𝑥 − 2ℎ)]
2ℎ
1
= [3𝑓(0.6) − 4𝑓(0.4) + 𝑓(0.2)]
0.4
= −0.6683
1
𝑓 ′ (𝑥) = [−𝑓(𝑥 + 2ℎ) + 8𝑓(𝑥 + ℎ) − 8𝑓(𝑥 − ℎ) + 𝑓(𝑥 − 2ℎ)]
12ℎ
1
= [−𝑓(1) + 8𝑓(0.8) − 8𝑓(0.4) + 𝑓(0.2)]
12ℎ
= −0.6825

(b) 𝑓 ′′ (0.6) → using equation 7

1
𝑓 ′′ (𝑥) = [𝑓(𝑥 + ℎ) − 2𝑓(𝑥) + 𝑓(𝑥 − ℎ)]
ℎ2
1
= [𝑓(0.8) − 2𝑓(0.6) + 𝑓(0.4)]
0.04
= −1.4900
MUHAMMAD MUSA BIN YUSOF
A17KA0105

4. Given
𝑒 −𝑥
𝑓(𝑥) =
√1 + sin(x)

Using the suitable following formula with ℎ = 0.1


𝑓(𝑥 + ℎ) − 𝑓(𝑥)
𝑓 ′ (𝑥) = →1

𝑓(𝑥) − 𝑓(𝑥 − ℎ)
𝑓 ′ (𝑥) = →2

𝑓(𝑥 + ℎ) − 𝑓(𝑥 − ℎ)
𝑓 ′ (𝑥) = →3
2ℎ
1
𝑓 ′ (𝑥) = [−𝑓(𝑥 + 2ℎ) + 4𝑓(𝑥 + ℎ) − 3𝑓(𝑥)] →4
2ℎ
1
𝑓 ′ (𝑥) = [3𝑓(𝑥) − 4𝑓(𝑥 − ℎ) + 𝑓(𝑥 − 2ℎ)] →5
2ℎ
1
𝑓 ′ (𝑥) = [−𝑓(𝑥 + 2ℎ) + 8𝑓(𝑥 + ℎ) − 8𝑓(𝑥 − ℎ) + 𝑓(𝑥 − 2ℎ)] →6
12ℎ
1
𝑓 ′′ (𝑥) = 2 [𝑓(𝑥 + ℎ) − 2𝑓(𝑥) + 𝑓(𝑥 − ℎ)] →7

𝑓(0.4) = 0.5687
𝑓(0.5) = 0.4987
𝑓(0.6) = 0.4387
𝑓(0.7) = 0.3873
𝑓(0.8) = 0.3429
MUHAMMAD MUSA BIN YUSOF
A17KA0105

Approximate :
(a) 𝑓 ′ (0.6) → using equation 1 to 6

𝑓(𝑥 + ℎ) − 𝑓(𝑥) 𝑓(0.7) − 𝑓(0.6)


𝑓 ′ (𝑥) = =
ℎ 0.1
0.3873 − 0.4387
= = −0.5140
0.1
𝑓(𝑥) − 𝑓(𝑥 − ℎ) 𝑓(0.6) − 𝑓(0.5)
𝑓 ′ (𝑥) = =
ℎ 0.1
0.4387 − 0.4987
= = −0.6000
0.1
𝑓(𝑥 + ℎ) − 𝑓(𝑥 − ℎ) 𝑓(0.7) − 𝑓(0.5)
𝑓 ′ (𝑥) = =
2ℎ 0.2
0.3873 − 0.4987
= = −0.5570
0.2
1 1
𝑓 ′ (𝑥) = [−𝑓(𝑥 + 2ℎ) + 4𝑓(𝑥 + ℎ) − 3𝑓(𝑥)] = [−𝑓(0.8) + 4𝑓(0.7) − 3𝑓(0.6)]
2ℎ 0.2
1
= [−0.3429 + 4(0.3873) − 3(0.4387)] = −0.5490
0.2
1 1
𝑓 ′ (𝑥) = [3𝑓(𝑥) − 4𝑓(𝑥 − ℎ) + 𝑓(𝑥 − 2ℎ)] = [3𝑓(0.6) − 4𝑓(0.5) + 𝑓(0.4)]
2ℎ 0.2
1
= [3(0.4387) − 4(0.4987) + 0.5687] = −0.5500
0.2
1
𝑓 ′ (𝑥) = [−𝑓(𝑥 + 2ℎ) + 8𝑓(𝑥 + ℎ) − 8𝑓(𝑥 − ℎ) + 𝑓(𝑥 − 2ℎ)]
12ℎ
1
= [−𝑓(0.8) + 8𝑓(0.7) − 8𝑓(0.5) + 𝑓(0.4)]
12ℎ
1
= [−0.3429 + 8(0.3873) − 8(0.4987) + 0.5687] = −0.5545
1.2

(b) 𝑓 ′′ (0.6) → using equation 7


1
𝑓 ′′ (𝑥) = [𝑓(𝑥 + ℎ) − 2𝑓(𝑥) + 𝑓(𝑥 − ℎ)]
ℎ2
1
= [𝑓(0.7) − 2𝑓(0.6) + 𝑓(0.5)]
0.01
1
= [0.3873 − 2(0.4387) + 0.4987]
0.01
= 0.86
MUHAMMAD MUSA BIN YUSOF
A17KA0105

TRAPEZOIDAL AND SIMPSON’S RULE

COMPOSITE TRAPEZOIDAL RULE

𝑏

∫ 𝑓(𝑥) 𝑑𝑥 = [(𝑓 + 𝑓𝑛 ) + 2(𝑓1 + 𝑓2 + ⋯ + 𝑓𝑛−1 )]
𝑎 2 0

𝑏−𝑎
Where , ℎ=
𝑛

COMPOSITE SIMPSON’S RULE OR 1/3 SIMPSON’S RULE

𝑏

∫ 𝑓(𝑥) 𝑑𝑥 = [(𝑓 + 𝑓𝑛 ) + 4(𝑓1 + 𝑓3 + ⋯ + 𝑓𝑛−1 ) + 2(𝑓2 + 𝑓4 + ⋯ + 𝑓𝑛−2 )]
𝑎 3 0

𝑏−𝑎
Where , ℎ=
𝑛
MUHAMMAD MUSA BIN YUSOF
A17KA0105

***Exercise 6.1
1.
3
Approximate the following integral ∫ √𝑥 3 + 1 𝑑𝑥 using the rules below
0
𝑏−𝑎 3−0
𝑓(𝑥) = √𝑥 3 + 1 ℎ= = = 0.3750
𝑛 8

(a) Trapezium rule with n = 8


F = √X 3 + 1

𝑖 𝑥𝑖 𝑓𝑖 = 𝑓(𝑥𝑖 ) = √𝑥𝑖3 + 1

0 0.000 1.0000
1 0.375 1.0260
2 0.750 1.1924
3 1.125 1.5569
4 1.500 2.0917
5 1.875 2.7553
6 2.250 3.5200
7 2.625 4.3690
8 3.000 5.2915

Total 6.2915 16.5113

3
𝐼 = ∫ √𝑥 3 + 1 𝑑𝑥
0
3
= ∫ 𝑓(𝑥) 𝑑𝑥
0


≈ [(𝑓 + 𝑓8 ) + 2(𝑓1 + 𝑓2 + 𝑓3 + 𝑓4 + 𝑓5 + 𝑓6 + 𝑓7 )]
2 0
0.375
= [6.2915 + 2(16.5113)]
2
= 7.3714
MUHAMMAD MUSA BIN YUSOF
A17KA0105

(b) Simpson’s rule with n = 8

F = √X 3 + 1

𝑖 𝑥𝑖 𝑓𝑖 = 𝑓(𝑥𝑖 ) = √𝑥𝑖3 + 1

0 0.000 1.0000
1 0.375 1.0260
2 0.750 1.1924
3 1.125 1.5569
4 1.500 2.0917
5 1.875 2.7553
6 2.250 3.5200
7 2.625 4.3690
8 3.000 5.2915

Total 6.2915 9.7072 6.8041

3
𝐼 = ∫ √𝑥 3 + 1 𝑑𝑥
0
3
= ∫ 𝑓(𝑥) 𝑑𝑥
0


≈ [(𝑓 + 𝑓8 ) + 4(𝑓1 + 𝑓3 + 𝑓5 + 𝑓7 ) + 2(𝑓2 + 𝑓4 + 𝑓6 )]
3 0
0.375
= [9.4765 + 4(9.7072) + 2(6.8041)]
3
= 7.3411
MUHAMMAD MUSA BIN YUSOF
A17KA0105

2.
3
1
Approximate the following integral ∫ 𝑑𝑥 using the rules below
0 √𝑥 3 + 1
1 𝑏−𝑎 3−0
𝑓(𝑥) = 𝑛= = = 10
√𝑥 3 + 1 ℎ 0.3

(a) Trapezium rule with h = 0.3


1
F=
√X 3 + 1

1
𝑓𝑖 = 𝑓(𝑥𝑖 ) =
𝑖 𝑥𝑖
√𝑥𝑖3 + 1

0 0.0 1.0000
1 0.3 0.9868
2 0.6 0.9068
3 0.9 0.7605
4 1.2 0.6054
5 1.5 0.4781
6 1.8 0.3826
7 2.1 0.3122
8 2.4 0.2597
9 2.7 0.2199
10 3.0 0.1890

Total 1.1890 4.9120

3
1
𝐼=∫ 𝑑𝑥
0 √𝑥 3 + 1
3
= ∫ 𝑓(𝑥) 𝑑𝑥
0


≈ [(𝑓 + 𝑓10 ) + 2(𝑓1 + 𝑓2 + 𝑓3 + 𝑓4 + 𝑓5 + 𝑓6 + 𝑓7 + 𝑓8 + 𝑓9 )]
2 0
0.3
= [1.1890 + 2(4.9120)]
2
= 1.6520
MUHAMMAD MUSA BIN YUSOF
A17KA0105

(b) Simpson’s rule with n = 10

1
F=
√X 3 + 1

1
𝑓𝑖 = 𝑓(𝑥𝑖 ) =
𝑖 𝑥𝑖
√𝑥𝑖3 + 1

0 0.0 1.0000
1 0.3 0.9868
2 0.6 0.9068
3 0.9 0.7605
4 1.2 0.6054
5 1.5 0.4781
6 1.8 0.3826
7 2.1 0.3122
8 2.4 0.2597
9 2.7 0.2199
10 3.0 0.1890

Total 1.1890 2.7575 2.1545

3
1
𝐼=∫ 𝑑𝑥
0 √𝑥 3 + 1
3
= ∫ 𝑓(𝑥) 𝑑𝑥
0


≈ [(𝑓 + 𝑓10 ) + 4(𝑓1 + 𝑓3 + 𝑓5 + 𝑓7 + 𝑓9 ) + 2(𝑓2 + 𝑓4 + 𝑓6 + 𝑓8 )]
3 0
0.3
= [1.1890 + 4(2.7575) + 2(2.1545)]
3
= 1.6528
MUHAMMAD MUSA BIN YUSOF
A17KA0105

3. The error function is defined as


𝑥
1 2
𝐸𝑟 𝑓(𝑥) = ∫ 𝑒 −𝑡 𝑑𝑡
√𝜋 0
Approximate 𝐸𝑟 𝑓(2) using the formula below.

2
𝑒 −𝑡 𝑏−𝑎 2−0
𝑓(𝑡) = ℎ= = = 0.25
√𝜋 𝑛 8

(a) Trapezium rule with n = 8


2
𝑒 −T
F=
√𝜋

2
𝑒 −𝑡𝑖
𝑖 𝑡𝑖 𝑓𝑖 = 𝑓(𝑡𝑖 ) =
√𝜋
0 0.00 0.5642
1 0.25 0.5300
2 0.50 0.4394
3 0.75 0.3215
4 1.00 0.2076
5 1.25 0.1183
6 1.50 0.0595
7 1.75 0.0264
8 2.00 0.0103

Total 0.5745 1.7027

2
1 2
𝐼= ∫ 𝑒 −𝑡 𝑑𝑡
√𝜋 0
2
= ∫ 𝑓(𝑡) 𝑑𝑡
0


≈ [(𝑓 + 𝑓8 ) + 2(𝑓1 + 𝑓2 + 𝑓3 + 𝑓4 + 𝑓5 + 𝑓6 + 𝑓7 )]
2 0
0.25
= [0.5745 + 2(1.7027)]
2
= 0.4975
MUHAMMAD MUSA BIN YUSOF
A17KA0105

(b) Simpson’s rule with n = 8

2
𝑒 −T
F=
√𝜋

2
𝑒 −𝑡𝑖
𝑖 𝑡𝑖 𝑓𝑖 = 𝑓(𝑡𝑖 ) =
√𝜋
0 0.00 0.5642
1 0.25 0.5300
2 0.50 0.4394
3 0.75 0.3215
4 1.00 0.2076
5 1.25 0.1183
6 1.50 0.0595
7 1.75 0.0264
8 2.00 0.0103

Total 0.5745 0.9962 0.7065

2
1 2
𝐼= ∫ 𝑒 −𝑡 𝑑𝑡
√𝜋 0
2
= ∫ 𝑓(𝑡) 𝑑𝑡
0


≈ [(𝑓 + 𝑓8 ) + 4(𝑓1 + 𝑓3 + 𝑓5 + 𝑓7 ) + 2(𝑓2 + 𝑓4 + 𝑓6 )]
3 0
0.25
= [0.5745 + 4(0.9962) + 2(0.7065)]
3
= 0.4977
MUHAMMAD MUSA BIN YUSOF
A17KA0105

4. The elliptic integral of the first kind is


𝑥
1
𝐾(𝑘, 𝑥) = ∫ 𝑑𝑡
√1 − 𝑘 2 sin2 (𝑡)
0
Approximate 𝐾(1 , 1) using the formula below.

1 𝑏−𝑎 1−0
𝑓(𝑡) = ℎ= = = 0.1
√1 − sin2 (𝑡) 𝑛 10

(a) Trapezium rule with n = 10


1
F=
√1 − sin2 (𝑇)

1
𝑖 𝑡𝑖 𝑓𝑖 = 𝑓(𝑡𝑖 ) =
√1 − sin2 (𝑡𝑖 )

0 0.0 1.0000
1 0.1 1.0050
2 0.2 1.0203
3 0.3 1.0468
4 0.4 1.0857
5 0.5 1.1395
6 0.6 1.2116
7 0.7 1.3075
8 0.8 1.4353
9 0.9 1.6087
10 1.0 1.8508

Total 2.8508 10.8604

1
1
𝐼=∫ 𝑑𝑡
0 √1 − sin2 (𝑡)
1
= ∫ 𝑓(𝑡) 𝑑𝑡
0


≈ [(𝑓 + 𝑓10 ) + 2(𝑓1 + 𝑓2 + 𝑓3 + 𝑓4 + 𝑓5 + 𝑓6 + 𝑓7 + 𝑓8 + 𝑓9 )]
2 0
0.1
= [2.8508 + 2(10.8604)]
2
= 1.2286
MUHAMMAD MUSA BIN YUSOF
A17KA0105

(b) Simpson’s rule with n = 10

1
F=
√1 − sin2 (𝑇)

1
𝑖 𝑡𝑖 𝑓𝑖 = 𝑓(𝑡𝑖 ) =
√1 − sin2 (𝑡𝑖 )

0 0.0 1.0000
1 0.1 1.0050
2 0.2 1.0203
3 0.3 1.0468
4 0.4 1.0857
5 0.5 1.1395
6 0.6 1.2116
7 0.7 1.3075
8 0.8 1.4353
9 0.9 1.6087
10 1.0 1.8508

Total 2.8508 6.1075 4.7529

1
1
𝐼=∫ 𝑑𝑡
0 √1 − sin2 (𝑡)
1
= ∫ 𝑓(𝑡) 𝑑𝑡
0


≈ [(𝑓 + 𝑓10 ) + 4(𝑓1 + 𝑓3 + 𝑓5 + 𝑓7 + 𝑓9 ) + 2(𝑓2 + 𝑓4 + 𝑓6 + 𝑓8 )]
3 0
0.1
= [2.8508 + 4(6.1075) + 2(4.7529)]
3
= 1.2262
MUHAMMAD MUSA BIN YUSOF
A17KA0105

5. The elliptic integral of the second kind is


𝑥
𝐾(𝑘, 𝑥) = ∫ √1 − 𝑘 2 sin2 (𝑡) 𝑑𝑡
0
Approximate 𝐾(1 , 1) using the formula below.

𝑏−𝑎 1−0
𝑓(𝑡) = √1 − sin2 (𝑡) 𝑛= = = 10
ℎ 0.1

(a) Trapezium rule with h = 0.1


F = √1 − sin2 (𝑇)

𝑖 𝑡𝑖 𝑓𝑖 = 𝑓(𝑡𝑖 ) = √1 − sin2 (𝑡𝑖 )

0 0.0 1.0000
1 0.1 0.9950
2 0.2 0.9801
3 0.3 0.9553
4 0.4 0.9211
5 0.5 0.8776
6 0.6 0.8253
7 0.7 0.7648
8 0.8 0.6967
9 0.9 0.6216
10 1.0 0.5403

Total 1.5403 7.6375

1
𝐼 = ∫ √1 − sin2 (𝑡) 𝑑𝑡
0
1
= ∫ 𝑓(𝑡) 𝑑𝑡
0


≈ [(𝑓 + 𝑓10 ) + 2(𝑓1 + 𝑓2 + 𝑓3 + 𝑓4 + 𝑓5 + 𝑓6 + 𝑓7 + 𝑓8 + 𝑓9 )]
2 0
0.1
= [1.5403 + 2(7.6375)]
2
= 0.8408
MUHAMMAD MUSA BIN YUSOF
A17KA0105

(b) Simpson’s rule with h = 0.125

𝑏−𝑎 1−0
𝑓(𝑡) = √1 − sin2 (𝑡) 𝑛= = =8
ℎ 0.125

F = √1 − sin2 (𝑇)

𝑖 𝑡𝑖 𝑓𝑖 = 𝑓(𝑡𝑖 ) = √1 − sin2 (𝑡𝑖 )

0 0.000 1.0000
1 0.125 0.9922
2 0.250 0.9689
3 0.375 0.9305
4 0.500 0.8776
5 0.625 0.8110
6 0.750 0.7317
7 0.875 0.6410
8 1.000 0.5403

Total 1.5403 3.3747 2.5782

1
𝐼 = ∫ √1 − sin2 (𝑡) 𝑑𝑡
0
1
= ∫ 𝑓(𝑡) 𝑑𝑡
0


≈ [(𝑓 + 𝑓8 ) + 4(𝑓1 + 𝑓3 + 𝑓5 + 𝑓7 ) + 2(𝑓2 + 𝑓4 + 𝑓6 )]
3 0
0.125
= [1.5403 + 4(3.3747) + 2(2.5782)]
3
= 0.8415
MUHAMMAD MUSA BIN YUSOF
A17KA0105

6. Approximate the arc length of the curve described by the function 𝑦 = 𝑥 3 , 0 < 𝑥 < 2 , the
length is given by
2
∫ √1 + 9𝑥 4 𝑑𝑥
0

𝑏−𝑎 2−0
𝑓(𝑥) = √1 + 9𝑥 4 ℎ= = = 0.25
𝑛 8

(a) Trapezium rule with n = 8


F = √1 + 9X 4

𝑖 𝑥𝑖 𝑓𝑖 = 𝑓(𝑥𝑖 ) = √1 + 9𝑥𝑖4

0 0.00 1.0000
1 0.25 1.0174
2 0.50 1.2500
3 0.75 1.9615
4 1.00 3.1623
5 1.25 4.7930
6 1.50 6.8237
7 1.75 9.2418
8 2.00 12.0416

Total 13.0416 28.2497

2
𝐼 = ∫ √1 + 9𝑥 4 𝑑𝑥
0
2
= ∫ 𝑓(𝑥) 𝑑𝑥
0


≈ [(𝑓 + 𝑓8 ) + 2(𝑓1 + 𝑓2 + 𝑓3 + 𝑓4 + 𝑓5 + 𝑓6 + 𝑓7 )]
2 0
0.25
= [13.0416 + 2(28.2497)]
2
= 8.6926
MUHAMMAD MUSA BIN YUSOF
A17KA0105

(b) Simpson’s rule with n = 0.8

F = √1 + 9X 4

𝑖 𝑥𝑖 𝑓𝑖 = 𝑓(𝑥𝑖 ) = √1 + 9𝑥𝑖4

0 0.00 1.0000
1 0.25 1.0174
2 0.50 1.2500
3 0.75 1.9615
4 1.00 3.1623
5 1.25 4.7930
6 1.50 6.8237
7 1.75 9.2418
8 2.00 12.0416

Total 13.0416 17.0137 11.2360

2
𝐼 = ∫ √1 + 9𝑥 4 𝑑𝑥
0
2
= ∫ 𝑓(𝑥) 𝑑𝑥
0


≈ [(𝑓 + 𝑓8 ) + 4(𝑓1 + 𝑓3 + 𝑓5 + 𝑓7 ) + 2(𝑓2 + 𝑓4 + 𝑓6 )]
3 0
0.25
= [13.0416 + 4(17.0137) + 2(11.2360)]
3
= 8.6285
MUHAMMAD MUSA BIN YUSOF
A17KA0105

7. Approximate the arc length of the curve described by the function 𝑦 = 𝑒 𝑥 , 0 < 𝑥 < 2 , the
length is given by
2
∫ √1 + 𝑒 2𝑥 𝑑𝑥
0

𝑏−𝑎 2−0
𝑓(𝑥) = √1 + 𝑒 2𝑥 𝑛= = = 10
ℎ 0.2

(a) Trapezium rule with h = 0.2


F = √1 + 𝑒 2X

𝑖 𝑥𝑖 𝑓𝑖 = 𝑓(𝑥𝑖 ) = √1 + 𝑒 2𝑥𝑖

0 0.0 1.4142
1 0.2 1.5786
2 0.4 1.7960
3 0.6 2.0785
4 0.8 2.4399
5 1.0 2.8964
6 1.2 3.4674
7 1.4 4.1767
8 1.6 5.0530
9 1.8 6.1317
10 2.00 7.4564

Total 8.8706 29.6182

2
𝐼 = ∫ √1 + 𝑒 2𝑥 𝑑𝑥
0
2
= ∫ 𝑓(𝑥) 𝑑𝑥
0


≈ [(𝑓 + 𝑓10 ) + 2(𝑓1 + 𝑓2 + 𝑓3 + 𝑓4 + 𝑓5 + 𝑓6 + 𝑓7 + 𝑓8 + 𝑓9 )]
2 0
0.2
= [8.8706 + 2(29.6182)]
2
= 6.8107
MUHAMMAD MUSA BIN YUSOF
A17KA0105

(b) Simpson’s rule with h = 0.25

𝑏−𝑎 2−0
𝑓(𝑥) = √1 + 𝑒 2𝑥 𝑛= = =8
ℎ 0.25

F = √1 + 𝑒 2X

𝑖 𝑥𝑖 𝑓𝑖 = 𝑓(𝑥𝑖 ) = √1 + 𝑒 2𝑥𝑖

0 0.00 1.4142
1 0.25 1.6275
2 0.50 1.9283
3 0.75 2.3413
4 1.00 2.8964
5 1.25 3.6308
6 1.50 4.5919
7 1.75 5.8408
8 2.00 7.4564

Total 8.8706 13.4404 9.4166

2
𝐼 = ∫ √1 + 𝑒 2𝑥 𝑑𝑥
0
2
= ∫ 𝑓(𝑥) 𝑑𝑥
0


≈ [(𝑓 + 𝑓8 ) + 4(𝑓1 + 𝑓3 + 𝑓5 + 𝑓7 ) + 2(𝑓2 + 𝑓4 + 𝑓6 )]
3 0
0.25
= [8.8706 + 4(13.4404) + 2(9.4166)]
3
= 6.7888
MUHAMMAD MUSA BIN YUSOF
A17KA0105

8. The solid of revolution obtained by rotating the region under the curve
𝑥 2
𝑦 = 1+( ) , 1≤ 𝑥 ≤2
2
about the x-axis has volume are given by

2
𝑥 2 2
𝐼 = ∫ 𝜋 [1 + ( ) ] 𝑑𝑥
1 2
Approximate the value of 𝐼 using

𝑥 2 2 𝑏−𝑎 2−1
𝑓(𝑥) = 𝜋 [1 + ( ) ] ℎ= = = 0.125
2 𝑛 8

(a) Trapezium rule with n = 8


2
X 2
F = 𝜋 [1 + ( ) ]
2

𝑥𝑖 2 2
𝑖 𝑥𝑖 𝑓𝑖 = 𝑓(𝑥𝑖 ) = 𝜋 [1 + ( ) ]
2

0 1.000 4.9087
1 1.125 5.4441
2 1.250 6.0753
3 1.375 6.8132
4 1.500 7.6699
5 1.625 8.6586
6 1.750 9.7937
7 1.875 11.0907
8 2.000 12.5664

Total 17.4751 55.5455

2
𝑥 2 2
𝐼 = ∫ 𝜋 [1 + ( ) ] 𝑑𝑥
1 2
2
= ∫ 𝑓(𝑥) 𝑑𝑥
1


≈ [(𝑓 + 𝑓8 ) + 2(𝑓1 + 𝑓2 + 𝑓3 + 𝑓4 + 𝑓5 + 𝑓6 + 𝑓7 )]
2 0
0.125
= [17.4751 + 2(55.5455)]
2
= 8.0354
MUHAMMAD MUSA BIN YUSOF
A17KA0105

(b) Simpson’s rule with n = 8

2
X 2
F = 𝜋 [1 + ( ) ]
2

𝑥𝑖 2 2
𝑖 𝑥𝑖 𝑓𝑖 = 𝑓(𝑥𝑖 ) = 𝜋 [1 + ( ) ]
2

0 1.000 4.9087
1 1.125 5.4441
2 1.250 6.0753
3 1.375 6.8132
4 1.500 7.6699
5 1.625 8.6586
6 1.750 9.7937
7 1.875 11.0907
8 2.000 12.5664

Total 17.4751 32.0066 23.5389

2
𝑥 2 2
𝐼 = ∫ 𝜋 [1 + ( ) ] 𝑑𝑥
1 2
2
= ∫ 𝑓(𝑥) 𝑑𝑥
1


≈ [(𝑓 + 𝑓8 ) + 4(𝑓1 + 𝑓3 + 𝑓5 + 𝑓7 ) + 2(𝑓2 + 𝑓4 + 𝑓6 )]
3 0
0.125
= [17.4751 + 4(32.0066) + 2(23.5389)]
3
= 8.0241
MUHAMMAD MUSA BIN YUSOF
A17KA0105

9. You are an Architect and plan to build parabolic exist where their equation is given by

𝑦 = 0.1𝑥(30 − 𝑥) meter
Where 𝑦 is the height and 𝑥 in meter. Approximate the length of curve, L, given by

30
𝑑𝑦 2
𝐿 = ∫ √1 + ( ) 𝑑𝑥
0 𝑑𝑥
Using
𝑏 − 𝑎 30 − 0
𝑓(𝑥) = √1 + (3 − 0.2𝑥)2 ℎ= = =3
𝑛 10

(a) Simpson’s rule with n = 10

F = √1 + (3 − 0.2X)2

𝑖 𝑥𝑖 𝑓𝑖 = 𝑓(𝑥𝑖 ) = √1 + (3 − 0.2𝑥𝑖 )2

0 0 3.1623
1 3 2.6000
2 6 2.0591
3 9 1.5620
4 12 1.1662
5 15 1.0000
6 18 1.1662
7 21 1.5620
8 24 2.0591
9 27 2.6000
10 30 3.1623

Total 6.3246 9.3240 6.4506

30
𝐼 = ∫ √1 + (3 − 0.2𝑥)2 𝑑𝑥
0
30
= ∫ 𝑓(𝑥) 𝑑𝑥
0


≈ [(𝑓 + 𝑓10 ) + 4(𝑓1 + 𝑓3 + 𝑓5 + 𝑓7 + 𝑓9 ) + 2(𝑓2 + 𝑓4 + 𝑓6 + 𝑓8 )]
3 0
3
= [6.3246 + 4(9.3240) + 2(6.4506)]
3
= 56.5218
MUHAMMAD MUSA BIN YUSOF
A17KA0105

10. Values of function 𝑓(𝑥) is given by the following table

𝑥 𝑓(𝑥)
0 0.0000
0.1 2.1220
0.2 3.0244
0.3 3.2568
0.4 3.1399
0.5 2.8579
0.6 2.5140
0.7 2.1639
0.8 1.8358

0.8
Evaluate ∫0 𝑓(𝑥) 𝑑𝑥 using

(a) Trapezoidal rule ; n=8 ; h = 0.1


0.8
𝐼 = ∫ 𝑓(𝑥) 𝑑𝑥
0


≈ [(𝑓 + 𝑓8 ) + 2(𝑓1 + 𝑓2 + 𝑓3 + 𝑓4 + 𝑓5 + 𝑓6 + 𝑓7 )]
2 0
0.1
= [1.8358 + 2(19.0789)]
2
= 1.9997

(b) Simpson’s rule ; n=8 ; h = 0.1


0.8
= ∫ 𝑓(𝑥) 𝑑𝑥
0


≈ [(𝑓 + 𝑓8 ) + 4(𝑓1 + 𝑓3 + 𝑓5 + 𝑓7 ) + 2(𝑓2 + 𝑓4 + 𝑓6 )]
3 0
0.1
= [1.8358 + 4(10.4006) + 2(8.6783)]
3
= 2.0265
MUHAMMAD MUSA BIN YUSOF
A17KA0105

GAUSSIAN QUADRATURE

The interval [a , b] can be transferred to interval [1 , -1] using transformation

(𝑏 − 𝑎)𝑡 + (𝑏 + 𝑎)
𝑥=
2

𝑥 = 𝑎 → 𝑡 = −1 dx 𝑏 − 𝑎
and then { and =
𝑥=𝑏 → 𝑡=1 dt 2

2-POINT GAUSS QUADRATURE

1
1 1
∫ 𝑔(𝑡) 𝑑𝑡 = 𝑔 (− )+𝑔( )
−1 √3 √3

3-POINT GAUSS QUADRATURE

1
5 3 8 5 3
∫ 𝑔(𝑡) 𝑑𝑡 = 𝑔 (−√ ) + 𝑔(0) + 𝑔 (√ )
−1 9 5 9 9 5
MUHAMMAD MUSA BIN YUSOF
A17KA0105

***Exercise 6.2
Evaluate the given integration using the method proposed. Show all calculation in 4 DP.

1
2
1. ∫ 𝑒 −𝑥 𝑑𝑥
0

(𝑏 − 𝑎)𝑡 + (𝑏 + 𝑎) (1 − 0)𝑡 + (1 + 0) 𝑡 + 1
𝑥= = =
2 2 2

𝑥 = 𝑎 = 0 → 𝑡 = −1 dx 𝑏 − 𝑎 1 − 0 1
and then { and = = =
𝑥=𝑏=1 → 𝑡=1 dt 2 2 2
1
2
then 𝐼 = ∫ 𝑒 −𝑥 𝑑𝑥
0
1 𝑡+1 2
−( ) 1
=∫ 𝑒 2 ( ) 𝑑𝑡
−1 2
1 1 −(
𝑡+1 2
)
= ∫ 𝑔(𝑡) 𝑑𝑡 , where 𝑔(𝑡) = 𝑒 2
2 −1

(a) Gaussian 2-points


1 1 1
𝐼 = [𝑔 (− ) + 𝑔 ( )]
2 √3 √3
1
= [0.9563 + 0.5369]
2
= 0.7466

(b) Gaussian 3-points

1 5 3 8 5 3
𝐼 = [ 𝑔 (−√ ) + 𝑔(0) + 𝑔 (√ )]
2 9 5 9 9 5

1 5 8 5
= [ (0.9874) + (0.7788) + (0.4551)]
2 9 9 9
= 0.7468
MUHAMMAD MUSA BIN YUSOF
A17KA0105

2
2𝑥
2. ∫ 𝑒 −cos 𝑑𝑥
0

(𝑏 − 𝑎)𝑡 + (𝑏 + 𝑎) (2 − 0)𝑡 + (2 + 0) 2𝑡 + 2
𝑥= = = =𝑡+1
2 2 2

𝑥 = 𝑎 = 0 → 𝑡 = −1 dx 𝑏 − 𝑎 2 − 0
and then { and = = =1
𝑥=𝑏=2 → 𝑡=1 dt 2 2
2
2𝑥
then 𝐼 = ∫ 𝑒 −cos 𝑑𝑥
0
1
2 (𝑡+1)
= ∫ 𝑒 −cos 𝑑𝑡
−1
1
2 (𝑡+1)
= ∫ 𝑔(𝑡) 𝑑𝑡 , where 𝑔(𝑡) = 𝑒 −cos
−1

(a) Gaussian 2-points


1 1
𝐼 = 𝑔 (− )+𝑔( )
√3 √3
= 0.4353 + 1.0000
= 1.4353

(b) Gaussian 3-points

5 3 8 5 3
𝐼 = 𝑔 (−√ ) + 𝑔(0) + 𝑔 (√ )
9 5 9 9 5

5 8 5
= (0.3867) + (0.7468) + (0.9599)
9 9 9
= 1.4119
MUHAMMAD MUSA BIN YUSOF
A17KA0105

2
2
3. ∫ 𝑥 2 𝑒 −x 𝑑𝑥
0

(𝑏 − 𝑎)𝑡 + (𝑏 + 𝑎) (2 − 0)𝑡 + (2 + 0) 2𝑡 + 2
𝑥= = = =𝑡+1
2 2 2

𝑥 = 𝑎 = 0 → 𝑡 = −1 dx 𝑏 − 𝑎 2 − 0
and then { and = = =1
𝑥=𝑏=2 → 𝑡=1 dt 2 2
2
2
then 𝐼 = ∫ 𝑥 2 𝑒 −x 𝑑𝑥
0
1
2
= ∫ (𝑡 + 1)2 𝑒 −(t+1) 𝑑𝑡
−1
1
2
= ∫ 𝑔(𝑡) 𝑑𝑡 , where 𝑔(𝑡) = (𝑡 + 1)2 𝑒 −(t+1)
−1

(a) Gaussian 2-points


1 1
𝐼 = 𝑔 (− )+𝑔( )
√3 √3
= 0.1494 + 0.2067
= 0.3561

(b) Gaussian 3-points

5 3 8 5 3
𝐼 = 𝑔 (−√ ) + 𝑔(0) + 𝑔 (√ )
9 5 9 9 5

5 8 5
= (0.0483) + (0.3679) + (0.1351)
9 9 9
= 0.4289
MUHAMMAD MUSA BIN YUSOF
A17KA0105

3
4. ∫ 𝑒 𝑥 sin(x) 𝑑𝑥
1

(𝑏 − 𝑎)𝑡 + (𝑏 + 𝑎) (3 − 1)𝑡 + (3 + 1) 2𝑡 + 4
𝑥= = = =𝑡+2
2 2 2

𝑥 = 𝑎 = 1 → 𝑡 = −1 dx 𝑏 − 𝑎 3 − 1
and then { and = = =1
𝑥=𝑏=3 → 𝑡=1 dt 2 2
3
then 𝐼 = ∫ 𝑒 𝑥 sin(x) 𝑑𝑥
1
1
= ∫ 𝑒 (𝑡+2) sin(𝑡 + 2) 𝑑𝑡
−1
1
= ∫ 𝑔(𝑡) 𝑑𝑡 , where 𝑔(𝑡) = 𝑒 (𝑡+2) sin(𝑡 + 2)
−1

(a) Gaussian 2-points


1 1
𝐼 = 𝑔 (− )+𝑔( )
√3 √3
= 4.1027 + 7.0388
= 11.1415

(b) Gaussian 3-points

5 3 8 5 3
𝐼 = 𝑔 (−√ ) + 𝑔(0) + 𝑔 (√ )
9 5 9 9 5

5 8 5
= (3.2044) + (6.7188) + (5.7525)
9 9 9
= 10.9483
MUHAMMAD MUSA BIN YUSOF
A17KA0105

2
5. ∫ √𝑥 3 − 1 𝑑𝑥
1

(𝑏 − 𝑎)𝑡 + (𝑏 + 𝑎) (2 − 1)𝑡 + (2 + 1) 𝑡 + 3
𝑥= = =
2 2 2

𝑥 = 𝑎 = 1 → 𝑡 = −1 dx 𝑏 − 𝑎 2 − 1 1
and then { and = = =
𝑥=𝑏=2 → 𝑡=1 dt 2 2 2
2
then 𝐼 = ∫ √𝑥 3 − 1 𝑑𝑥
1
1
𝑡+3 3 1
= ∫ √( ) − 1 ( ) 𝑑𝑡
−1 2 2

1 1 𝑡+3 3
= ∫ 𝑔(𝑡) 𝑑𝑡 , where 𝑔(𝑡) = √( ) −1
2 −1 2

(a) Gaussian 2-points

1 1 1
𝐼= [𝑔 (− ) + 𝑔 ( )]
2 √3 √3
1
= [0.8817 + 2.1732]
2
= 1.5275

(b) Gaussian 3-points

1 5 3 8 5 3
𝐼 = [ 𝑔 (−√ ) + 𝑔(0) + 𝑔 (√ )]
2 9 5 9 9 5

1 5 8 5
= [ (0.6145) + (1.5411) + (2.3921)]
2 9 9 9
= 1.5201
MUHAMMAD MUSA BIN YUSOF
A17KA0105

4
6. ∫ √𝑥 2 − 4 𝑑𝑥
2

(𝑏 − 𝑎)𝑡 + (𝑏 + 𝑎) (4 − 2)𝑡 + (4 + 2) 2𝑡 + 6
𝑥= = = =𝑡+3
2 2 2

𝑥 = 𝑎 = 2 → 𝑡 = −1 dx 𝑏 − 𝑎 4 − 2
and then { and = = =1
𝑥=𝑏=4 → 𝑡=1 dt 2 2
4
then 𝐼 = ∫ √𝑥 2 − 4 𝑑𝑥
2
1
= ∫ √(𝑡 + 3)2 − 4 𝑑𝑡
−1
1
= ∫ 𝑔(𝑡) 𝑑𝑡 , where 𝑔(𝑡) = √(𝑡 + 3)2 − 4
−1

(a) Gaussian 2-points


1 1
𝐼 = 𝑔 (− )+𝑔( )
√3 √3
= 1.3672 + 2.9660
= 4.3332

(b) Gaussian 3-points

5 3 8 5 3
𝐼 = 𝑔 (−√ ) + 𝑔(0) + 𝑔 (√ )
9 5 9 9 5

5 8 5
= (0.9759) + (2.2361) + (3.2012)
9 9 9
= 4.3083
MUHAMMAD MUSA BIN YUSOF
A17KA0105

2
sin 𝑡
7. ∫ 𝑑𝑡
0 𝑡

(𝑏 − 𝑎)𝑥 + (𝑏 + 𝑎) (2 − 0)𝑥 + (2 + 0) 2𝑥 + 2
𝑡= = = =𝑥+1
2 2 2

𝑡 = 𝑎 = 0 → 𝑥 = −1 dt 𝑏 − 𝑎 2 − 0
and then { and = = =1
𝑡=𝑏=2 → 𝑥=1 dx 2 2
2
sin 𝑡
then 𝐼=∫ 𝑑𝑡
0 𝑡
1
sin(𝑥 + 1)
=∫ 𝑑𝑥
−1 𝑥+1
1
sin(𝑥 + 1)
= ∫ 𝑔(𝑥) 𝑑𝑥 , where 𝑔(𝑥) =
−1 𝑥+1

(a) Gaussian 2-points


1 1
𝐼 = 𝑔 (− )+𝑔( )
√3 √3
= 0.9705 + 0.6340
= 1.6045

(b) Gaussian 3-points

5 3 8 5 3
𝐼 = 𝑔 (−√ ) + 𝑔(0) + 𝑔 (√ )
9 5 9 9 5

5 8 5
= (0.9916) + (0.8415) + (0.5518)
9 9 9
= 1.6054
MUHAMMAD MUSA BIN YUSOF
A17KA0105

POWER METHOD
***Exercise 7.1

Find the dominant eigenvalue 𝜆1 and corresponding eigenvector 𝐯1 of the following


matrix 𝐴 using power method. Show the calculation in two decimal places (2 DP) and use
𝜀 = 0.05.

4 1 2
1. 𝐴 = (1 0 1) , 𝐯 (0) = (1 , 1 , 1)𝑇
2 1 2

The power method formula,

1
𝐯 (𝑘+1) = 𝐴𝐯 (𝑘) , 𝑘 = 0, 1, 2, …
𝑚𝑘+1

Where 𝑚𝑘+1 is the largest absolute value component of 𝐴𝐯 (𝑘) .

𝑘 (𝐯 (𝑘) )𝑇 (𝐴𝐯 (𝑘) )𝑇 𝑚𝑘+1

0 1 1 1 7.00 2.00 4.00 7.00


1 1.00 0.29 0.57 5.43 1.57 2.86 5.43
2 1.00 0.29 0.53 5.34 1.53 2.82 5.34
3 1.00 0.29 0.53 5.34 1.53 2.81 5.34
4 1.00 0.29 0.53

Stop the iteration when |𝑚4 − 𝑚3 | = |5.34 − 5.34| = 0.00 < 𝜀 = 0.05
Therefore,
𝜆1 ≈ 𝑚4 = 5.34

𝐯1 ≈ 𝐯 (4) = (1.00 , 0.29 , 0.53)𝑇


MUHAMMAD MUSA BIN YUSOF
A17KA0105

2 1 1
2. 𝐴 = (1 3 2) , 𝐯 (0) = (1 , 0 , 1)𝑇
1 2 5

The power method formula,

1
𝐯 (𝑘+1) = 𝐴𝐯 (𝑘) , 𝑘 = 0, 1, 2, …
𝑚𝑘+1

Where 𝑚𝑘+1 is the largest absolute value component of 𝐴𝐯 (𝑘) .

𝑘 (𝐯 (𝑘) )𝑇 (𝐴𝐯 (𝑘) )𝑇 𝑚𝑘+1

0 1 0 1 3.00 3.00 6.00 6.00


1 0.50 0.50 1.00 2.50 4.00 6.50 6.50
2 0.38 0.62 1.00 2.38 4.23 6.62 6.62
3 0.36 0.64 1.00 2.36 4.28 6.63 6.63
4 0.36 0.64 1.00

Stop the iteration when |𝑚4 − 𝑚3 | = |6.63 − 6.62| = 0.01 < 𝜀 = 0.05
Therefore,
𝜆1 ≈ 𝑚4 = 6.63

𝐯1 ≈ 𝐯 (4) = (0.36 , 0.64 , 1.00)𝑇


MUHAMMAD MUSA BIN YUSOF
A17KA0105

3 1 1
3. 𝐴 = (1 1 4) , 𝐯 (0) = (1 , 1 , 1)𝑇
1 4 1

The power method formula,

1
𝐯 (𝑘+1) = 𝐴𝐯 (𝑘) , 𝑘 = 0, 1, 2, …
𝑚𝑘+1

Where 𝑚𝑘+1 is the largest absolute value component of 𝐴𝐯 (𝑘) .

𝑘 (𝐯 (𝑘) )𝑇 (𝐴𝐯 (𝑘) )𝑇 𝑚𝑘+1

0 1 1 1 5.00 6.00 6.00 6.00


1 0.83 1.00 1.00 4.50 5.83 5.83 5.83
2 0.77 1.00 1.00 4.32 5.77 5.77 5.77
3 0.75 1.00 1.00 4.25 5.75 5.75 5.75
4 0.74 1.00 1.00

Stop the iteration when |𝑚4 − 𝑚3 | = |5.75 − 5.77| = 0.02 < 𝜀 = 0.05
Therefore,
𝜆1 ≈ 𝑚4 = 5.75

𝐯1 ≈ 𝐯 (4) = (0.74 , 1.00 , 1.00)𝑇


MUHAMMAD MUSA BIN YUSOF
A17KA0105

1 2 0
4. 𝐴 = (2 3 1) , 𝐯 (0) = (0 , 1 , 0)𝑇
0 1 1

The power method formula,

1
𝐯 (𝑘+1) = 𝐴𝐯 (𝑘) , 𝑘 = 0, 1, 2, …
𝑚𝑘+1

Where 𝑚𝑘+1 is the largest absolute value component of 𝐴𝐯 (𝑘) .

𝑘 (𝐯 (𝑘) )𝑇 (𝐴𝐯 (𝑘) )𝑇 𝑚𝑘+1

0 0 1 0 2.00 3.00 1.00 3.00


1 0.67 1.00 0.33 2.67 4.67 1.33 4.67
2 0.57 1.00 0.29 2.57 4.43 1.28 4.43
3 0.58 1.00 0.29 2.58 4.45 1.29 4.45
4 0.58 1.00 0.29

Stop the iteration when |𝑚4 − 𝑚3 | = |4.45 − 4.43| = 0.02 < 𝜀 = 0.05
Therefore,
𝜆1 ≈ 𝑚4 = 4.45

𝐯1 ≈ 𝐯 (4) = (0.58 , 1.00 , 0.29)𝑇


MUHAMMAD MUSA BIN YUSOF
A17KA0105

1 2 3
5. 𝐴 = (2 1 3) , 𝐯 (0) = (1 , 1 , 0)𝑇
3 3 −1

The power method formula,

1
𝐯 (𝑘+1) = 𝐴𝐯 (𝑘) , 𝑘 = 0, 1, 2, …
𝑚𝑘+1

Where 𝑚𝑘+1 is the largest absolute value component of 𝐴𝐯 (𝑘) .

𝑘 (𝐯 (𝑘) )𝑇 (𝐴𝐯 (𝑘) )𝑇 𝑚𝑘+1

0 1 1 0 3.00 3.00 6.00 6.00


1 0.50 0.50 1.00 4.50 4.50 2.00 4.50
2 1.00 1.00 0.44 4.33 4.33 5.56 5.56
3 0.78 0.78 1.00 5.34 5.34 3.68 5.34
4 1.00 1.00 0.69 5.06 5.06 5.31 5.31
5 0.95 0.95 1.00

Stop the iteration when |𝑚5 − 𝑚4 | = |5.31 − 5.34| = 0.03 < 𝜀 = 0.05
Therefore,
𝜆1 ≈ 𝑚5 = 5.31

𝐯1 ≈ 𝐯 (5) = (0.95 , 0.95 , 1.00)𝑇


MUHAMMAD MUSA BIN YUSOF
A17KA0105

SHIFTED POWER METHOD


***Exercise 7.2

1. Find the dominant eigenvalue 𝜆1 and corresponding eigenvector 𝐯1 of the following matrix
𝐴 using shift power method with shifting factor 𝑝. Show the calculation in two decimal
places (2 DP) and use 𝜀 = 0.05.

3 0 1
(a) 𝐴 = (0 3 2) , 𝐯 (0) = (0 , 0 , 1)𝑇 , 𝑝=1
1 2 3

𝐵 = 𝐴 − 𝑝𝐼 = 𝐴 − (1.00)𝐼
3 0 1 1 0 0
= (0 3 2) − 1.00 (0 1 0)
1 2 3 0 0 1
2 0 1
= (0 2 2)
1 2 2

Let the dominant of eigenvalue of B is 𝜆𝐵

1
𝐯 (𝑘+1) = 𝐵𝐯 (𝑘) , 𝑘 = 0, 1, 2, …
𝑚𝑘+1

Where 𝑚𝑘+1 is the largest absolute value component of 𝐵𝐯 (𝑘) .

𝑘 (𝐯 (𝑘) )𝑇 (𝐵𝐯 (𝑘) )𝑇 𝑚𝑘+1

0 0 0 1 1.00 2.00 2.00 2.00


1 0.50 1.00 1.00 2.00 4.00 4.50 4.50
2 0.44 0.89 1.00 1.89 3.78 4.22 4.22
3 0.45 0.90 1.00 1.90 3.79 4.24 4.24
4 0.45 0.89 1.00

Stop the iteration when |𝑚4 − 𝑚3 | = |4.24 − 4.22| = 0.02 < 𝜀 = 0.05
Therefore,
𝜆1 = 𝜆𝐵 + 𝑝 = 4.24 + 1.00 = 5.24

𝐯1 ≈ 𝐯 (4) = (0.45 , 0.89 , 1.00)𝑇


MUHAMMAD MUSA BIN YUSOF
A17KA0105

3 −1 0
(b) 𝐴 = (−2 6 −2) , 𝐯 (0) = (0 , 1 , 0)𝑇 , 𝑝=2
0 −1 3

𝐵 = 𝐴 − 𝑝𝐼 = 𝐴 − (2.00)𝐼
3 −1 0 1 0 0
= (−2 6 −2) − 2.00 (0 1 0)
0 −1 3 0 0 1
1 −1 0
= (−2 4 −2)
0 −1 1

Let the dominant of eigenvalue of B is 𝜆𝐵

1
𝐯 (𝑘+1) = 𝐵𝐯 (𝑘) , 𝑘 = 0, 1, 2, …
𝑚𝑘+1

Where 𝑚𝑘+1 is the largest absolute value component of 𝐵𝐯 (𝑘) .

𝑘 (𝐯 (𝑘) )𝑇 (𝐵𝐯 (𝑘) )𝑇 𝑚𝑘+1

0 0 1 0 -1.00 4.00 -1.00 4.00


1 -0.25 1.00 -0.25 -1.25 5.00 -1.25 5.00
2 -0.25 1.00 -0.25 -1.25 5.00 -1.25 5.00
3 -0.25 1.00 -0.25

Stop the iteration when |𝑚3 − 𝑚2 | = |5.00 − 5.00| = 0.00 < 𝜀 = 0.05
Therefore,
𝜆1 = 𝜆𝐵 + 𝑝 = 5.00 + 2.00 = 7.00

𝐯1 ≈ 𝐯 (3) = (−0.25 , 1.00 , −0.25)𝑇


MUHAMMAD MUSA BIN YUSOF
A17KA0105

2. All the eigenvalues of the following matrix 𝐴 are in same sign with |𝜆1 | > |𝜆2 | > |𝜆3 |. Find
the smallest eigenvalue in modulus 𝜆3 and corresponding eigenvector 𝐯3 of the following
matrix 𝐴 by shifted power method starting with 𝐯 (0) and using shifting factor 𝑝 = 𝜆1.
Hence, find eigenvalue 𝜆2 . Show the calculation in two decimal places (2 DP) and use
𝜀 = 0.05.

2 1 1
(a) 𝐴 = (1 3 2) , 𝐯 (0) = (1 , 0 , 1)𝑇 , 𝜆1 = 6.63 let 𝑝 = 𝜆1 = 6.63
1 2 5

𝐵 = 𝐴 − 𝑝𝐼 = 𝐴 − (6.63)𝐼
2 1 1 1 0 0
= (1 3 2) − 6.63 (0 1 0)
1 2 5 0 0 1
−4.63 1 1
=( 1 −3.63 2 )
1 2 −1.63

Let the dominant of eigenvalue of B is 𝜆1𝐵

𝑘 (𝐯 (𝑘) )𝑇 (𝐵𝐯 (𝑘) )𝑇 𝑚𝑘+1

0 1 0 1 -3.63 3.00 -0.63 -3.63


1 1.00 -0.83 0.17 -5.28 4.35 -0.94 -5.28
2 1.00 -0.82 0.18 -5.28 4.34 -0.93 -5.28
3 1.00 -0.82 0.18

Stop the iteration when |𝑚3 − 𝑚2 | = |−5.28 + 5.28| = 0.00 < 𝜀 = 0.05
Therefore,
𝜆1𝐵 = 𝑚3 = −5.28
But 𝜆1𝐵 = 𝜆3 − 𝜆1 → 𝜆3 = 𝜆1 + 𝜆1𝐵
= 6.63 + (−5.28)
= 1.35

𝐯1 ≈ 𝐯 (3) = (1.00 , −0.82 , 0.18)𝑇

𝜆1 + 𝜆2 + 𝜆3 = trace(𝐴)
6.63 + 𝜆2 + 1.35 = 2 + 3 + 5
𝜆2 = 2.02
MUHAMMAD MUSA BIN YUSOF
A17KA0105

2 1 1
(b) 𝐴 = (1 6 4) , 𝐯 (0) = (0 , 1 , 1)𝑇 , 𝜆1 = 10.76 let 𝑝 = 𝜆1 = 10.76
1 4 7

𝐵 = 𝐴 − 𝑝𝐼 = 𝐴 − (10.76)𝐼
2 1 1 1 0 0
= (1 6 4) − 10.76 (0 1 0)
1 4 7 0 0 1
−8.76 1 1
=( 1 −4.76 4 )
1 4 −3.76

Let the dominant of eigenvalue of B is 𝜆1𝐵

𝑘 (𝐯 (𝑘) )𝑇 (𝐵𝐯 (𝑘) )𝑇 𝑚𝑘+1

0 0 1 1 2.00 -0.76 0.24 2.00


1 1.00 -0.38 0.12 -9.02 3.29 -0.97 -9.02
2 1.00 -0.36 0.11 -9.02 3.17 -0.86 -9.02
3 1.00 -0.35 0.10

Stop the iteration when |𝑚3 − 𝑚2 | = |−9.02 + 9.02| = 0.00 < 𝜀 = 0.05
Therefore,
𝜆1𝐵 = 𝑚3 = −9.02
But 𝜆1𝐵 = 𝜆3 − 𝜆1 → 𝜆3 = 𝜆1 + 𝜆1𝐵
= 10.76 + (−9.02)
= 1.74

𝐯1 ≈ 𝐯 (3) = (1.00 , −0.35 , 0.10)𝑇

𝜆1 + 𝜆2 + 𝜆3 = trace(𝐴)
10.76 + 𝜆2 + 1.74 = 2 + 6 + 7
𝜆2 = 2.50
MUHAMMAD MUSA BIN YUSOF
A17KA0105

4 2 −1
(c) 𝐴 = ( 2 3 1 ) , 𝐯 (0) = (0 , −1 , 1)𝑇 , 𝜆1 = 5.50 let 𝑝 = 𝜆1 = 5.50
−1 1 2

𝐵 = 𝐴 − 𝑝𝐼 = 𝐴 − (5.50)𝐼
4 2 −1 1 0 0
= ( 2 3 1 ) − 5.50 (0 1 0)
−1 1 2 0 0 1
−1.5 2 −1
=( 2 −2.5 1 )
−1 1 −3.5

Let the dominant of eigenvalue of B is 𝜆1𝐵

𝑘 (𝐯 (𝑘) )𝑇 (𝐵𝐯 (𝑘) )𝑇 𝑚𝑘+1

0 0 -1 1 -3.00 3.50 -4.50 -4.50


1 0.67 -0.78 1.00 -3.56 4.28 -4.94 -4.94
2 0.72 -0.87 1.00 -3.81 4.61 -5.09 -5.09
3 0.75 -0.90 1.00 -3.93 4.76 -5.15 -5.15
4 0.76 -0.92 1.00 -3.99 4.84 -5.19 -5.19
5 0.77 -0.93 1.00

Stop the iteration when |𝑚5 − 𝑚4 | = |−5.19 + 5.15| = 0.04 < 𝜀 = 0.05
Therefore,
𝜆1𝐵 = 𝑚5 = −5.19
But 𝜆1𝐵 = 𝜆3 − 𝜆1 → 𝜆3 = 𝜆1 + 𝜆1𝐵
= 5.50 + (−5.19)
= 0.31

𝐯1 ≈ 𝐯 (4) = (0.77 , −0.93 , 1.00)𝑇

𝜆1 + 𝜆2 + 𝜆3 = trace(𝐴)
5.50 + 𝜆2 + 0.31 = 4 + 3 + 2
𝜆2 = 3.19

You might also like