Browse papers
A

Section A: Long Answer Questions

Attempt any TWO questions.

3 questions·10 marks each
1long10 marks

What is curve fitting? Explain the least squares method to fit a straight line y = a + bx to a given set of data points.

Curve Fitting

Curve fitting is the process of constructing a curve (a mathematical function) that has the best fit to a series of observed data points (xi,yi)(x_i, y_i). The goal is to find a smooth functional relationship y=f(x)y = f(x) that approximately represents the trend of the data, so it can be used for interpolation, extrapolation, and prediction.

Least Squares Method for a Straight Line

We wish to fit the line

y=a+bxy = a + bx

to nn data points (xi,yi), i=1,2,,n(x_i, y_i),\ i = 1, 2, \dots, n.

For each point the residual (error) is

ei=yi(a+bxi)e_i = y_i - (a + b x_i)

The least squares principle requires choosing aa and bb so that the sum of the squares of the residuals is minimum:

S=i=1nei2=i=1n(yiabxi)2S = \sum_{i=1}^{n} e_i^2 = \sum_{i=1}^{n}\big(y_i - a - b x_i\big)^2

Deriving the Normal Equations

SS is minimum when its partial derivatives with respect to aa and bb vanish:

Sa=2(yiabxi)=0\frac{\partial S}{\partial a} = -2\sum (y_i - a - b x_i) = 0 Sb=2xi(yiabxi)=0\frac{\partial S}{\partial b} = -2\sum x_i (y_i - a - b x_i) = 0

Simplifying gives the two normal equations:

yi=na+bxi\sum y_i = n a + b \sum x_i xiyi=axi+bxi2\sum x_i y_i = a \sum x_i + b \sum x_i^2

Solving for the Coefficients

Solving these simultaneous equations:

b=nxiyixiyinxi2(xi)2,a=yˉbxˉb = \frac{n\sum x_i y_i - \sum x_i \sum y_i}{n\sum x_i^2 - \left(\sum x_i\right)^2}, \qquad a = \bar{y} - b\,\bar{x}

where xˉ=1nxi\bar{x} = \frac{1}{n}\sum x_i and yˉ=1nyi\bar{y} = \frac{1}{n}\sum y_i.

Procedure

  1. Form a table of xi, yi, xi2, xiyix_i,\ y_i,\ x_i^2,\ x_i y_i and compute xi, yi, xi2, xiyi\sum x_i,\ \sum y_i,\ \sum x_i^2,\ \sum x_i y_i.
  2. Substitute into the normal equations.
  3. Solve for aa and bb.
  4. The required fitted line is y=a+bxy = a + bx.

The resulting line passes through the centroid (xˉ,yˉ)(\bar{x}, \bar{y}) and gives the best straight-line approximation in the least-squares sense.

regression
2long10 marks

Explain the finite difference method for solving partial differential equations. Derive the standard five-point formula for Laplace's equation.

Finite Difference Method (FDM) for PDEs

The finite difference method solves a partial differential equation by replacing the continuous derivatives with difference approximations evaluated on a discrete grid (mesh) of points covering the solution domain.

Steps:

  1. Cover the region with a rectangular grid of mesh size hh in xx and kk in yy, giving nodes (xi,yj)(x_i, y_j).
  2. Replace each partial derivative in the PDE by a finite-difference approximation at the interior nodes.
  3. This converts the PDE into a system of algebraic equations relating the nodal values ui,ju_{i,j}.
  4. Impose the boundary conditions, then solve the system (directly or by iteration such as Gauss-Seidel / Liebmann's method).

Standard central-difference approximations (mesh size hh):

2ux2i,jui+1,j2ui,j+ui1,jh2\frac{\partial^2 u}{\partial x^2}\Big|_{i,j} \approx \frac{u_{i+1,j} - 2u_{i,j} + u_{i-1,j}}{h^2} 2uy2i,jui,j+12ui,j+ui,j1h2\frac{\partial^2 u}{\partial y^2}\Big|_{i,j} \approx \frac{u_{i,j+1} - 2u_{i,j} + u_{i,j-1}}{h^2}

Five-Point Formula for Laplace's Equation

Laplace's equation in two dimensions is

2u=2ux2+2uy2=0\nabla^2 u = \frac{\partial^2 u}{\partial x^2} + \frac{\partial^2 u}{\partial y^2} = 0

Using a square grid (h=kh = k) and substituting the central-difference approximations above:

ui+1,j2ui,j+ui1,jh2+ui,j+12ui,j+ui,j1h2=0\frac{u_{i+1,j} - 2u_{i,j} + u_{i-1,j}}{h^2} + \frac{u_{i,j+1} - 2u_{i,j} + u_{i,j-1}}{h^2} = 0

Multiplying through by h2h^2:

ui+1,j+ui1,j+ui,j+1+ui,j14ui,j=0u_{i+1,j} + u_{i-1,j} + u_{i,j+1} + u_{i,j-1} - 4u_{i,j} = 0

Solving for the central value gives the standard five-point (diagonal) formula:

ui,j=14(ui+1,j+ui1,j+ui,j+1+ui,j1)\boxed{\,u_{i,j} = \frac{1}{4}\left(u_{i+1,j} + u_{i-1,j} + u_{i,j+1} + u_{i,j-1}\right)\,}

Interpretation: the value of uu at any interior node equals the average of the values at its four neighbouring nodes (left, right, above, below). The system formed at all interior nodes is solved together with the prescribed boundary values, usually iteratively by Liebmann's (Gauss-Seidel) method.

pde
3long10 marks

Explain the bisection method for finding the root of a non-linear equation. Find a real root of the equation x^3 - x - 1 = 0 correct to three decimal places using the bisection method.

Bisection Method

The bisection method is a bracketing (interval-halving) technique to find a real root of f(x)=0f(x) = 0 where ff is continuous.

Principle (Intermediate Value Theorem): If f(a)f(b)<0f(a)\cdot f(b) < 0, then a root lies between aa and bb.

Algorithm:

  1. Choose a,ba, b such that f(a)f(b)<0f(a)\,f(b) < 0.
  2. Compute the midpoint c=a+b2c = \dfrac{a+b}{2}.
  3. If f(c)=0f(c) = 0 (or f(c)|f(c)| is within tolerance), cc is the root.
  4. If f(a)f(c)<0f(a)\,f(c) < 0, the root lies in [a,c][a, c], so set b=cb = c; otherwise set a=ca = c.
  5. Repeat until ba|b - a| (or f(c)|f(c)|) is less than the required accuracy.

The method always converges (linearly) since the interval halves each step.

Root of x3x1=0x^3 - x - 1 = 0

Let f(x)=x3x1f(x) = x^3 - x - 1.

f(1)=111=1<0f(1) = 1 - 1 - 1 = -1 < 0 and f(2)=821=5>0f(2) = 8 - 2 - 1 = 5 > 0, so a root lies in [1,2][1, 2].

nabc=(a+b)/2f(c)New interval
11.00002.00001.5000+0.8750[1, 1.5]
21.00001.50001.2500-0.2969[1.25, 1.5]
31.25001.50001.3750+0.2246[1.25, 1.375]
41.25001.37501.3125-0.0515[1.3125, 1.375]
51.31251.37501.3438+0.0826[1.3125, 1.3438]
61.31251.34381.3281+0.0146[1.3125, 1.3281]
71.31251.32811.3203-0.0187[1.3203, 1.3281]
81.32031.32811.3242-0.0021[1.3242, 1.3281]
91.32421.32811.3262+0.0062[1.3242, 1.3262]
101.32421.32621.3252+0.0020[1.3242, 1.3252]
111.32421.32521.3247-0.0001[1.3247, 1.3252]
121.32471.32521.3249+0.0009[1.3247, 1.3249]

The successive midpoints converge to 1.32471.3247.

x1.325 (to three decimal places)\boxed{x \approx 1.325 \ (\text{to three decimal places})}

(The exact root is 1.324721.32472\ldots.)

nonlinearbisection
B

Section B: Short Answer Questions

Attempt any EIGHT questions.

9 questions·5 marks each
4short5 marks

Explain Newton's divided difference interpolation formula.

Newton's Divided Difference Interpolation

This formula constructs an interpolating polynomial through data points (x0,y0),(x1,y1),,(xn,yn)(x_0, y_0), (x_1, y_1), \dots, (x_n, y_n) with unequally spaced xx-values.

Divided differences are defined recursively:

  • First order: f[x0,x1]=f(x1)f(x0)x1x0f[x_0, x_1] = \dfrac{f(x_1) - f(x_0)}{x_1 - x_0}
  • Second order: f[x0,x1,x2]=f[x1,x2]f[x0,x1]x2x0f[x_0, x_1, x_2] = \dfrac{f[x_1, x_2] - f[x_0, x_1]}{x_2 - x_0}
  • In general: f[x0,,xk]=f[x1,,xk]f[x0,,xk1]xkx0f[x_0, \dots, x_k] = \dfrac{f[x_1, \dots, x_k] - f[x_0, \dots, x_{k-1}]}{x_k - x_0}

Newton's divided difference formula:

f(x)=f(x0)+(xx0)f[x0,x1]+(xx0)(xx1)f[x0,x1,x2]+f(x) = f(x_0) + (x - x_0)f[x_0, x_1] + (x - x_0)(x - x_1)f[x_0, x_1, x_2] + \cdots +(xx0)(xx1)(xxn1)f[x0,x1,,xn]+ (x - x_0)(x - x_1)\cdots(x - x_{n-1})\,f[x_0, x_1, \dots, x_n]

Procedure: Build a divided-difference table, take the leading (top) divided differences as coefficients, and substitute the value of xx at which the function is required.

Advantages: Works for unequal spacing; new data points can be added without recomputing earlier terms (unlike Lagrange's method).

interpolationdivided-difference
5short5 marks

Explain the power method for finding the largest eigenvalue of a matrix.

Power Method

The power method is an iterative technique to find the dominant (largest in magnitude) eigenvalue λ1\lambda_1 and its corresponding eigenvector of a square matrix AA.

Principle: If AA has a unique dominant eigenvalue λ1\lambda_1 (λ1>λ2|\lambda_1| > |\lambda_2| \ge \cdots), then repeatedly multiplying an arbitrary starting vector by AA makes it converge to the eigenvector of λ1\lambda_1.

Algorithm:

  1. Choose an initial nonzero vector x0x_0 (e.g. [1,1,,1]T[1, 1, \dots, 1]^T).
  2. Compute yk+1=Axky_{k+1} = A x_k.
  3. Let λ(k+1)=\lambda^{(k+1)} = the largest-magnitude component of yk+1y_{k+1}.
  4. Normalize: xk+1=1λ(k+1)yk+1x_{k+1} = \dfrac{1}{\lambda^{(k+1)}}\, y_{k+1}.
  5. Repeat steps 2-4 until successive λ\lambda values (and vectors) agree to the desired accuracy.

At convergence, λ(k)λ1\lambda^{(k)} \to \lambda_1 (the largest eigenvalue) and xkx_k is the corresponding eigenvector.

Notes: Convergence is linear and faster when λ2/λ1|\lambda_2/\lambda_1| is small. The inverse power method (applied to A1A^{-1}) gives the smallest eigenvalue.

eigenvalue
6short5 marks

Fit a second-degree parabola y = a + bx + cx^2 to a set of data using the least squares principle.

Fitting a Second-Degree Parabola (Least Squares)

We fit

y=a+bx+cx2y = a + bx + cx^2

to nn data points (xi,yi)(x_i, y_i). The residual for each point is ei=yi(a+bxi+cxi2)e_i = y_i - (a + bx_i + cx_i^2), and we minimize

S=i=1n(yiabxicxi2)2S = \sum_{i=1}^{n}\big(y_i - a - bx_i - cx_i^2\big)^2

Normal Equations

Setting Sa=Sb=Sc=0\dfrac{\partial S}{\partial a} = \dfrac{\partial S}{\partial b} = \dfrac{\partial S}{\partial c} = 0 gives three normal equations:

y=na+bx+cx2\sum y = n a + b\sum x + c\sum x^2 xy=ax+bx2+cx3\sum xy = a\sum x + b\sum x^2 + c\sum x^3 x2y=ax2+bx3+cx4\sum x^2 y = a\sum x^2 + b\sum x^3 + c\sum x^4

Procedure

  1. Tabulate x,y,x2,x3,x4,xy,x2yx, y, x^2, x^3, x^4, xy, x^2y and compute the required sums.
  2. Substitute the sums into the three normal equations.
  3. Solve the simultaneous linear equations (e.g. by elimination) for a,b,ca, b, c.
  4. The fitted parabola is y=a+bx+cx2y = a + bx + cx^2.

This yields the best second-degree polynomial fit in the least-squares sense.

regression
7short5 marks

Define absolute, relative and percentage errors. Explain the sources of errors in numerical computation.

Types of Error

Let XX be the true value and XX' the approximate (computed) value.

  • Absolute error: the magnitude of the difference,
Ea=XXE_a = |X - X'|
  • Relative error: absolute error per unit true value,
Er=XXXE_r = \frac{|X - X'|}{|X|}
  • Percentage error: relative error expressed as a percentage,
Ep=XXX×100%E_p = \frac{|X - X'|}{|X|}\times 100\%

Sources of Errors in Numerical Computation

  1. Inherent (input/data) errors – errors already present in the data due to limitations of measuring instruments or imperfect physical assumptions.
  2. Round-off errors – caused by representing numbers with a finite number of digits (finite word length of the computer), e.g. retaining only a few decimal places.
  3. Truncation errors – caused by approximating an infinite process by a finite one, e.g. terminating a Taylor/infinite series after a few terms.
  4. Modelling / formulation errors – arise when the mathematical model is a simplification of the real problem.
  5. Human/blunders – mistakes in coding, data entry, or arithmetic.

Round-off and truncation errors are the two principal sources controllable in numerical methods.

errors
8short5 marks

Explain the secant method for finding the root of an equation and compare it with the Newton-Raphson method.

Secant Method

The secant method finds a root of f(x)=0f(x)=0 using two previous approximations. The next estimate is the xx-intercept of the secant line joining (xn1,f(xn1))(x_{n-1}, f(x_{n-1})) and (xn,f(xn))(x_n, f(x_n)):

xn+1=xnf(xn)xnxn1f(xn)f(xn1)x_{n+1} = x_n - f(x_n)\,\frac{x_n - x_{n-1}}{f(x_n) - f(x_{n-1})}

Algorithm:

  1. Choose two initial guesses x0,x1x_0, x_1.
  2. Compute x2x_2 using the formula above.
  3. Replace (x0,x1)(x1,x2)(x_0, x_1) \to (x_1, x_2) and repeat until xn+1xn|x_{n+1} - x_n| is within tolerance.

This is essentially the Newton-Raphson method with the derivative f(xn)f'(x_n) replaced by the difference quotient f(xn)f(xn1)xnxn1\dfrac{f(x_n)-f(x_{n-1})}{x_n - x_{n-1}}.

Comparison with Newton-Raphson

FeatureSecant methodNewton-Raphson
Initial guessesNeeds two (x0,x1x_0, x_1)Needs one (x0x_0)
DerivativeNot requiredRequires f(x)f'(x)
Iteration formulaxn+1=xnf(xn)xnxn1f(xn)f(xn1)x_{n+1}=x_n - f(x_n)\frac{x_n-x_{n-1}}{f(x_n)-f(x_{n-1})}xn+1=xnf(xn)f(xn)x_{n+1}=x_n-\frac{f(x_n)}{f'(x_n)}
Order of convergence1.618\approx 1.618 (superlinear)22 (quadratic)
Cost per stepOne function evaluationTwo evaluations (ff and ff')

Summary: The secant method avoids computing derivatives and is cheaper per iteration, but converges a little slower than the faster (quadratic) Newton-Raphson method.

nonlinearsecant
9short5 marks

Describe the false position (regula falsi) method with its geometric interpretation.

False Position (Regula Falsi) Method

The false position method is a bracketing method that, like bisection, requires two points a,ba, b with f(a)f(b)<0f(a)\,f(b) < 0 so that a root lies between them. Instead of taking the midpoint, it takes the point where the chord (straight line) joining (a,f(a))(a, f(a)) and (b,f(b))(b, f(b)) crosses the x-axis.

Iteration formula:

x=af(a)baf(b)f(a)=af(b)bf(a)f(b)f(a)x = a - f(a)\,\frac{b - a}{f(b) - f(a)} = \frac{a\,f(b) - b\,f(a)}{f(b) - f(a)}

Algorithm:

  1. Choose a,ba, b with f(a)f(b)<0f(a)\,f(b) < 0.
  2. Compute xx from the formula above.
  3. If f(a)f(x)<0f(a)\,f(x) < 0, set b=xb = x; else set a=xa = x (keep the sub-interval that still brackets the root).
  4. Repeat until f(x)|f(x)| (or successive xx values) is within the desired accuracy.

Geometric Interpretation

The two points (a,f(a))(a, f(a)) and (b,f(b))(b, f(b)) lie on opposite sides of the x-axis. The straight chord connecting them intersects the x-axis at xx. This intersection xx is taken as the improved approximation to the root. Replacing the curve y=f(x)y=f(x) locally by this chord (a linear interpolation) is why it is called the method of false position: as iterations proceed, the chord's intercept approaches the actual root where the curve cuts the x-axis.

Convergence is always guaranteed (the root stays bracketed) and is usually faster than bisection, though one endpoint may remain fixed.

nonlinearfalse-position
10short5 marks

State and explain Lagrange's interpolation formula with a suitable example.

Lagrange's Interpolation Formula

For n+1n+1 data points (x0,y0),(x1,y1),,(xn,yn)(x_0, y_0), (x_1, y_1), \dots, (x_n, y_n) with unequally (or equally) spaced abscissae, the interpolating polynomial is

y=f(x)=i=0nLi(x)yiy = f(x) = \sum_{i=0}^{n} L_i(x)\, y_i

where the Lagrange basis polynomials are

Li(x)=j=0jinxxjxixjL_i(x) = \prod_{\substack{j=0 \\ j \ne i}}^{n} \frac{x - x_j}{x_i - x_j}

For three points the formula is

f(x)=(xx1)(xx2)(x0x1)(x0x2)y0+(xx0)(xx2)(x1x0)(x1x2)y1+(xx0)(xx1)(x2x0)(x2x1)y2f(x) = \frac{(x-x_1)(x-x_2)}{(x_0-x_1)(x_0-x_2)}y_0 + \frac{(x-x_0)(x-x_2)}{(x_1-x_0)(x_1-x_2)}y_1 + \frac{(x-x_0)(x-x_1)}{(x_2-x_0)(x_2-x_1)}y_2

Each Li(x)=1L_i(x) = 1 at x=xix = x_i and 00 at every other node, so the polynomial passes exactly through all the data points.

Example

Given (0,1),(1,3),(2,7)(0, 1), (1, 3), (2, 7), find yy at x=1.5x = 1.5.

y=(1.51)(1.52)(01)(02)(1)+(1.50)(1.52)(10)(12)(3)+(1.50)(1.51)(20)(21)(7)y = \frac{(1.5-1)(1.5-2)}{(0-1)(0-2)}(1) + \frac{(1.5-0)(1.5-2)}{(1-0)(1-2)}(3) + \frac{(1.5-0)(1.5-1)}{(2-0)(2-1)}(7) =(0.5)(0.5)2(1)+(1.5)(0.5)1(3)+(1.5)(0.5)2(7)= \frac{(0.5)(-0.5)}{2}(1) + \frac{(1.5)(-0.5)}{-1}(3) + \frac{(1.5)(0.5)}{2}(7) =0.125+2.25+2.625=4.75= -0.125 + 2.25 + 2.625 = 4.75

So y(1.5)4.75y(1.5) \approx 4.75.

interpolationlagrange
11short5 marks

Derive the trapezoidal rule for numerical integration and state its error term.

Trapezoidal Rule — Derivation

To evaluate I=abf(x)dx\displaystyle I = \int_{a}^{b} f(x)\,dx, divide [a,b][a, b] into nn equal sub-intervals of width h=banh = \dfrac{b-a}{n}, with nodes x0=a,x1,,xn=bx_0=a, x_1, \dots, x_n=b and ordinates yi=f(xi)y_i = f(x_i).

Single strip: Over each sub-interval the curve is approximated by a straight line, so the area of the strip [xi,xi+1][x_i, x_{i+1}] is that of a trapezium:

xixi+1f(x)dxh2(yi+yi+1)\int_{x_i}^{x_{i+1}} f(x)\,dx \approx \frac{h}{2}\big(y_i + y_{i+1}\big)

Composite rule: Summing over all nn strips:

Ih2[(y0+yn)+2(y1+y2++yn1)]I \approx \frac{h}{2}\Big[(y_0 + y_n) + 2(y_1 + y_2 + \cdots + y_{n-1})\Big]

That is: (end ordinates) + 2 × (sum of remaining ordinates), all multiplied by h/2h/2.

Error Term

The error in the composite trapezoidal rule is

E=(ba)12h2f(ξ)=nh312f(ξ),a<ξ<bE = -\frac{(b-a)}{12}h^2\, f''(\xi) = -\frac{nh^3}{12} f''(\xi), \qquad a < \xi < b

Since the error is proportional to h2h^2, the trapezoidal rule is a second-order method and is exact for polynomials of degree 1\le 1 (straight lines).

integrationtrapezoidal
12short5 marks

Explain the Gauss-Seidel iterative method to solve a system of linear equations.

Gauss-Seidel Iterative Method

The Gauss-Seidel method is an iterative technique for solving a system of nn linear equations AX=BAX = B. It refines an initial guess of the unknowns until convergence.

Consider the system:

a11x1+a12x2+a13x3=b1a_{11}x_1 + a_{12}x_2 + a_{13}x_3 = b_1 a21x1+a22x2+a23x3=b2a_{21}x_1 + a_{22}x_2 + a_{23}x_3 = b_2 a31x1+a32x2+a33x3=b3a_{31}x_1 + a_{32}x_2 + a_{33}x_3 = b_3

Step 1 — Rearrange each equation to make one variable the subject (solve the ii-th equation for xix_i using the diagonal element):

x1=1a11(b1a12x2a13x3)x_1 = \frac{1}{a_{11}}\big(b_1 - a_{12}x_2 - a_{13}x_3\big) x2=1a22(b2a21x1a23x3)x_2 = \frac{1}{a_{22}}\big(b_2 - a_{21}x_1 - a_{23}x_3\big) x3=1a33(b3a31x1a32x2)x_3 = \frac{1}{a_{33}}\big(b_3 - a_{31}x_1 - a_{32}x_2\big)

Step 2 — Iterate: Start with an initial guess (e.g. x1=x2=x3=0x_1=x_2=x_3=0). In each sweep, compute x1x_1, then immediately use the new x1x_1 when computing x2x_2, and use the new x1,x2x_1, x_2 when computing x3x_3. This use of the most recently updated values distinguishes it from the Jacobi method and speeds up convergence.

Step 3 — Stop when the values stop changing within the required tolerance, i.e. xi(k+1)xi(k)<ε|x_i^{(k+1)} - x_i^{(k)}| < \varepsilon for all ii.

Convergence condition: The method is guaranteed to converge if the coefficient matrix is diagonally dominant, i.e.

aiijiaijfor each i|a_{ii}| \ge \sum_{j \ne i} |a_{ij}| \quad \text{for each } i

so the equations should be arranged to make the largest coefficients lie on the diagonal before iterating.

linear-systemsiterative

Frequently asked questions

Where can I find the BSc CSIT (TU) Numerical Method (BSc CSIT, CSC207) question paper 2078?
The full BSc CSIT (TU) Numerical Method (BSc CSIT, CSC207) 2078 (regular) question paper is available free on Kekkei. You can read every question online and attempt the paper under timed exam conditions.
Does the Numerical Method (BSc CSIT, CSC207) 2078 paper come with solutions?
Yes. Every question on this Numerical Method (BSc CSIT, CSC207) past paper includes a step-by-step solution, plus instant AI feedback when you attempt it on Kekkei.
How many marks is the BSc CSIT (TU) Numerical Method (BSc CSIT, CSC207) 2078 paper?
The BSc CSIT (TU) Numerical Method (BSc CSIT, CSC207) 2078 paper carries 60 full marks and is meant to be completed in 180 minutes, across 12 questions.
Is practising this Numerical Method (BSc CSIT, CSC207) past paper free?
Yes — reading and attempting this Numerical Method (BSc CSIT, CSC207) past paper on Kekkei is completely free.