Skip to Content
PrepPath logoPrepPath

Answers

Comprehensive answers and worked solutions for Numerical Analysis with MATLAB.

1. Graphical Method

Given

f(x)=x3−2x−5f(x)=x^3-2x-5

a) Equation is nonlinear because highest power of xx is 33.

b) Sign-change intervals:

f(2)=8−4−5=−1f(2) = 8-4-5 = -1 f(3)=27−6−5=16f(3) = 27-6-5 = 16

So root lies in [2,3][2,3].

Again,

f(2.09)=2.093−2(2.09)−5≈−0.050671f(2.09) = 2.09^3-2(2.09)-5 \approx -0.050671 f(2.10)=2.103−2(2.10)−5≈0.061f(2.10) = 2.10^3-2(2.10)-5 \approx 0.061

So narrower interval is [2.09,2.10][2.09,2.10].

c) Graph of cubic crosses xx-axis near

x≈2.09x \approx 2.09

2. Bisection Method

Given

f(x)=x3−7f(x)=x^3-7

a)

f(1)=1−7=−6,f(2)=8−7=1f(1)=1-7=-6,\qquad f(2)=8-7=1

Since f(1)f(2)<0f(1)f(2)<0, root exists in [1,2][1,2].

b) Interval is suitable because f(x)f(x) is continuous and signs at endpoints are opposite.

c) Bisection table with TOL=0.005\mathrm{TOL}=0.005:

Iterationaabbc=a+b2c=\frac{a+b}{2}f(c)f(c)
01.0000002.0000001.500000-3.625000
11.5000002.0000001.750000-1.640625
21.7500002.0000001.875000-0.408203
31.8750002.0000001.9375000.273193
41.8750001.9375001.906250-0.073090
51.9062501.9375001.9218750.098644
61.9062501.9218751.9140620.012427

Final interval:

[1.90625, 1.9140625][1.90625,\ 1.9140625]

Approximate root:

x≈1.90625+1.91406252=1.91015625≈1.910x \approx \frac{1.90625+1.9140625}{2}=1.91015625 \approx 1.910

3. Fixed Point Iteration Method

Given

x3+x−6=0x^3+x-6=0

a) Two possible fixed-point forms:

x=6−x3x=\sqrt[3]{6-x} x=6−x3x=6-x^3

Use

xn+1=6−xn3x_{n+1}=\sqrt[3]{6-x_n}

because it converges near root.

b) Suitable initial guess:

x0=1.5x_0=1.5

c) Iteration table:

Iterationxnx_nxn+1x_{n+1}Error ∣xn+1−xn∣\lvert x_{n+1}-x_n \rvert
01.5000001.6509640.150964
11.6509641.6322910.018672
21.6322911.6346240.002333

Since error <0.005<0.005, stop.

Approximate root:

x≈1.6346x \approx 1.6346

4. Secant Method

Given

f(x)=x3−4x−9f(x)=x^3-4x-9

a)

f(2)=8−8−9=−9f(2)=8-8-9=-9 f(3)=27−12−9=6f(3)=27-12-9=6

So root lies in (2,3)(2,3).

b) Choose

x0=2,x1=3x_0=2,\qquad x_1=3

c) Secant formula:

xn+1=xn−f(xn)(xn−xn−1)f(xn)−f(xn−1)x_{n+1}=x_n-\frac{f(x_n)(x_n-x_{n-1})}{f(x_n)-f(x_{n-1})}

Five iterations:

Iterationxn−1x_{n-1}xnx_nxn+1x_{n+1}f(xn+1)f(x_{n+1})
12.0000003.0000002.600000-1.824000
23.0000002.6000002.693252-0.237227
32.6000002.6932522.7071930.011956
42.6932522.7071932.706524-0.000072
52.7071932.7065242.706528-0.000000

Approximate root:

x≈2.706528x \approx 2.706528

5. Newton-Raphson Method

Given

f(x)=x3−2x2+3f(x)=x^3-2x^2+3

a) Stopping criterion:

∣xn+1−xn∣<εor∣f(xn+1)∣<ε|x_{n+1}-x_n|<\varepsilon \quad \text{or} \quad |f(x_{n+1})|<\varepsilon

b)

f′(x)=3x2−4xf'(x)=3x^2-4x

Newton-Raphson formula:

xn+1=xn−xn3−2xn2+33xn2−4xnx_{n+1}=x_n-\frac{x_n^3-2x_n^2+3}{3x_n^2-4x_n}

c) Take x0=−1.5x_0=-1.5.

Iterationxnx_nf(xn)f(x_n)f′(xn)f'(x_n)xn+1x_{n+1}
0-1.500000-4.87500012.750000-1.117647
1-1.117647-0.8943628.217993-1.008817
2-1.008817-0.0621117.088407-1.000055
3-1.000055-0.0003857.000550-1.000000
4-1.000000-0.0000007.000000-1.000000
5-1.0000000.0000007.000000-1.000000

Root after six iterations:

x≈−1x \approx -1

6. Gaussian Elimination Method

System:

3x+y−z=43x+y-z=4 2x−4y+5z=−32x-4y+5z=-3 x+2y+3z=10x+2y+3z=10

a) Augmented matrix:

[31−142−45−312310]\left[\begin{array}{ccc|c} 3 & 1 & -1 & 4 \\ 2 & -4 & 5 & -3 \\ 1 & 2 & 3 & 10 \end{array}\right]

b) Upper triangular form:

R2←R2−23R1,R3←R3−13R1R_2 \leftarrow R_2-\frac23R_1,\qquad R_3 \leftarrow R_3-\frac13R_1 [31−140−143173−173053103263]\left[\begin{array}{ccc|c} 3 & 1 & -1 & 4 \\ 0 & -\frac{14}{3} & \frac{17}{3} & -\frac{17}{3} \\ 0 & \frac{5}{3} & \frac{10}{3} & \frac{26}{3} \end{array}\right] R3←R3+514R2R_3 \leftarrow R_3+\frac{5}{14}R_2 [31−140−143173−1730075149314]\left[\begin{array}{ccc|c} 3 & 1 & -1 & 4 \\ 0 & -\frac{14}{3} & \frac{17}{3} & -\frac{17}{3} \\ 0 & 0 & \frac{75}{14} & \frac{93}{14} \end{array}\right]

c) Back substitution:

z=93/1475/14=3125=1.24z=\frac{93/14}{75/14}=\frac{31}{25}=1.24 y=6825=2.72y=\frac{68}{25}=2.72 x=2125=0.84x=\frac{21}{25}=0.84

So

x=0.84,y=2.72,z=1.24x=0.84,\qquad y=2.72,\qquad z=1.24

7. Gaussian Elimination with Partial Pivoting

System:

0.2x+3y+z=80.2x+3y+z=8 4x+y−z=74x+y-z=7 2x+5y+2z=102x+5y+2z=10

a) Partial pivoting is required because first pivot 0.20.2 is very small. Dividing by it may cause large round-off error.

b) Row interchange:

R1↔R2R_1 \leftrightarrow R_2

Largest absolute value in first column becomes pivot.

c) Start:

[0.231841−1725210]→R1↔R2[41−170.231825210]\left[\begin{array}{ccc|c} 0.2 & 3 & 1 & 8 \\ 4 & 1 & -1 & 7 \\ 2 & 5 & 2 & 10 \end{array}\right] \xrightarrow{R_1 \leftrightarrow R_2} \left[\begin{array}{ccc|c} 4 & 1 & -1 & 7 \\ 0.2 & 3 & 1 & 8 \\ 2 & 5 & 2 & 10 \end{array}\right]

Eliminate first column:

R2←R2−120R1,R3←R3−12R1R_2 \leftarrow R_2-\frac{1}{20}R_1,\qquad R_3 \leftarrow R_3-\frac12R_1 [41−170592021201532009252132]\left[\begin{array}{ccc|c} 4 & 1 & -1 & 7 \\ 0 & \frac{59}{20} & \frac{21}{20} & \frac{153}{20} \\ 0 & \frac{9}{2} & \frac{5}{2} & \frac{13}{2} \end{array}\right]

Second pivot: ∣92∣>∣5920∣\left|\frac92\right|>\left|\frac{59}{20}\right|, so swap

R2↔R3R_2 \leftrightarrow R_3

Then

R3←R3−5990R2R_3 \leftarrow R_3-\frac{59}{90}R_2 [41−170925213200−53906118]\left[\begin{array}{ccc|c} 4 & 1 & -1 & 7 \\ 0 & \frac{9}{2} & \frac{5}{2} & \frac{13}{2} \\ 0 & 0 & -\frac{53}{90} & \frac{61}{18} \end{array}\right]

Back substitution gives

z=−30553≈−5.7547z=-\frac{305}{53}\approx -5.7547 y=24653≈4.6415y=\frac{246}{53}\approx 4.6415 x=−4553≈−0.8491x=-\frac{45}{53}\approx -0.8491

8. Gauss-Seidel Method

Given

10x+y−z=1110x+y-z=11 2x+10y+z=122x+10y+z=12 −2x+3y+10z=14-2x+3y+10z=14

a) Iterative form:

x=11−y+z10x=\frac{11-y+z}{10} y=12−2x−z10y=\frac{12-2x-z}{10} z=14+2x−3y10z=\frac{14+2x-3y}{10}

b) Diagonal dominance:

∣10∣>∣1∣+∣−1∣=2|10|>|1|+|{-1}|=2 ∣10∣>∣2∣+∣1∣=3|10|>|2|+|1|=3 ∣10∣>∣−2∣+∣3∣=5|10|>|{-2}|+|3|=5

So system is diagonally dominant. Gauss-Seidel will converge.

c) With x0=y0=z0=0x_0=y_0=z_0=0:

Iterationxxyyzz
00.0000000.0000000.000000
11.1000000.9800001.326000
21.1346000.8404801.374776
31.1534300.8318361.381135
41.1549300.8309011.381716

After four iterations:

x≈1.15493,y≈0.83090,z≈1.38172x \approx 1.15493,\qquad y \approx 0.83090,\qquad z \approx 1.38172

IUS Preps - Your Academic Success Partner

On this page