- Derive Numerical Differentiation formulas for first and second derivatives from Newton's forward and backward differences.
- Derive the General Quadrature Formula for equidistant ordinates from first principles.
- Deduce the Trapezoidal Rule ($n=1$), Simpson's 1/3rd Rule ($n=2$), and Simpson's 3/8th Rule ($n=3$) from the General Quadrature formula.
- Evaluate the mandatory subinterval constraints for each numerical integration rule.
- Compare truncation error bounds and degrees of precision across rules.
- Solve university numerical integrals (e.g. $\int_0^6 \frac{dx}{1+x^2}$) using all rules and compute error relative to exact calculus values.
In analytical calculus, we learn integration tricks (substitution, integration by parts, partial fractions). But many real-world functions have no elementary anti-derivative: $$\int e^{-x^2}\,dx \quad \text{or} \quad \int \frac{\sin x}{x}\,dx \quad \text{or} \quad \int \sqrt{1 + x^4}\,dx$$ Furthermore, in engineering experiments, we often don't have a mathematical function at all—we only have a table of discrete sensor readings (e.g. velocity over time)!
**Numerical Integration (Quadrature)** solves this by calculating the **definite area under the curve** by slicing the area into simple geometric strips (trapezoids or parabolas) whose areas can be added with basic arithmetic!
Numerical differentiation is the process of computing the value of the derivative $\frac{dy}{dx}$ of a function at a given point using a discrete table of values.
Newton's forward formula states: $y(x) = y_0 + p \Delta y_0 + \frac{p(p-1)}{2} \Delta^2 y_0 + \frac{p(p-1)(p-2)}{6} \Delta^3 y_0 + \dots$ where $p = \frac{x - x_0}{h} \implies \frac{dp}{dx} = \frac{1}{h}$.
By the chain rule of differentiation: $$\frac{dy}{dx} = \frac{dy}{dp} \cdot \frac{dp}{dx} = \frac{1}{h} \left[\frac{d}{dp} y(x)\right]$$ Differentiating term-by-term with respect to $p$: $$\mathbf{\left(\frac{dy}{dx}\right)_{x = x_0} = \frac{1}{h}\left[\Delta y_0 - \frac{1}{2}\Delta^2 y_0 + \frac{1}{3}\Delta^3 y_0 - \frac{1}{4}\Delta^4 y_0 + \dots\right]}$$ Differentiating a second time yields the second derivative: $$\mathbf{\left(\frac{d^2y}{dx^2}\right)_{x = x_0} = \frac{1}{h^2}\left[\Delta^2 y_0 - \Delta^3 y_0 + \frac{11}{12}\Delta^4 y_0 - \frac{5}{6}\Delta^5 y_0 + \dots\right]}$$
Derivatives Near the End of Table (Using Newton's Backward Formula):
$$\mathbf{\left(\frac{dy}{dx}\right)_{x = x_n} = \frac{1}{h}\left[\nabla y_n + \frac{1}{2}\nabla^2 y_n + \frac{1}{3}\nabla^3 y_n + \frac{1}{4}\nabla^4 y_n + \dots\right]}$$ $$\mathbf{\left(\frac{d^2y}{dx^2}\right)_{x = x_n} = \frac{1}{h^2}\left[\nabla^2 y_n + \nabla^3 y_n + \frac{11}{12}\nabla^4 y_n + \dots\right]}$$Step-by-Step Solved Numerical: Derivative from Tabulated Data
Problem (CSJMU 2024–25): From the table below, find $\left(\frac{dy}{dx}\right)$ and $\left(\frac{d^2y}{dx^2}\right)$ at $x = 1.2$ ($h = 0.2$):
| $x$ | 1.0 | 1.2 | 1.4 | 1.6 | 1.8 | 2.0 |
|---|---|---|---|---|---|---|
| $y$ | 2.718 | 3.320 | 4.055 | 4.953 | 6.050 | 7.389 |
Constructing the forward differences taking $x_0 = 1.2$ as origin:
$\Delta y_0 = 4.055 - 3.320 = 0.735$
$\Delta^2 y_0 = (4.953 - 4.055) - 0.735 = 0.898 - 0.735 = 0.163$
$\Delta^3 y_0 = (6.050 - 4.953) - 0.898 - 0.163 = 1.097 - 0.898 - 0.163 = 0.036$.
Substitute into the first derivative formula ($h = 0.2$):
$$\left(\frac{dy}{dx}\right)_{x = 1.2} = \frac{1}{0.2}\left[0.735 - \frac{1}{2}(0.163) + \frac{1}{3}(0.036)\right] = 5 \times [0.735 - 0.0815 + 0.0120] = 5 \times 0.6655 = \mathbf{3.3275}$$Substitute into the second derivative formula:
$$\left(\frac{d^2y}{dx^2}\right)_{x = 1.2} = \frac{1}{(0.2)^2}\left[0.163 - 0.036\right] = \frac{1}{0.04}[0.127] = \mathbf{3.175}$$Analytical check: Since $y = e^x$, at $x = 1.2$, $y' = y'' = e^{1.2} \approx 3.3201$. The numerical approximation is remarkably accurate!
Maxima and Minima of a Tabulated Function
1. Write Newton's Forward formula in terms of $p$: $y(p) = y_0 + p \Delta y_0 + \frac{p(p-1)}{2} \Delta^2 y_0 + \dots$
2. Differentiate with respect to $p$ and set $\frac{dy}{dx} = 0 \implies \Delta y_0 + \frac{2p - 1}{2}\Delta^2 y_0 + \frac{3p^2 - 6p + 2}{6}\Delta^3 y_0 = 0$.
3. Solve this polynomial equation for $p$.
4. The location of the extremum is $x = x_0 + ph$, and the extreme value is found by substituting $p$ into $y(p)$!
5. Check the second derivative: if $\frac{d^2y}{dx^2} < 0 \implies$ Maximum; if $> 0 \implies$ Minimum.
Let $I = \int_a^b f(x)\,dx$. Divide the interval $[a, b]$ into $n$ equal subintervals of width $h = \frac{b - a}{n}$ with abscissas $x_0 = a, x_1 = x_0 + h, \dots, x_n = x_0 + nh = b$.
Substitute $x = x_0 + uh \implies dx = h\,du$. When $x = x_0, u = 0$; when $x = x_n, u = n$.
Replacing $f(x)$ with Newton's forward difference interpolating polynomial: $$I = \int_{x_0}^{x_0 + nh} f(x)\,dx = \int_0^n \left[y_0 + u \Delta y_0 + \frac{u(u-1)}{2!} \Delta^2 y_0 + \frac{u(u-1)(u-2)}{3!} \Delta^3 y_0 + \dots\right] h\,du$$ Evaluating the definite integrals with respect to $u$: $$\int_0^n du = n, \quad \int_0^n u\,du = \frac{n^2}{2}, \quad \int_0^n \frac{u^2-u}{2}\,du = \frac{n^3}{6} - \frac{n^2}{4} = \frac{n^2(2n-3)}{12}$$ Factoring out $nh$, we obtain the **General Quadrature Formula**: $$\mathbf{\int_{x_0}^{x_0+nh} f(x)\,dx = nh\left[y_0 + \frac{n}{2}\Delta y_0 + \frac{n(2n-3)}{12}\Delta^2 y_0 + \frac{n(n-2)^2}{24}\Delta^3 y_0 + \dots\right]}$$
1. Trapezoidal Rule (Put $n = 1$)
Putting $n = 1$ in the General Quadrature formula and neglecting 2nd and higher differences ($\Delta^2 y_0 \approx 0$):
$$\int_{x_0}^{x_1} f(x)\,dx = h\left[y_0 + \frac{1}{2}\Delta y_0\right] = h\left[y_0 + \frac{1}{2}(y_1 - y_0)\right] = \frac{h}{2}(y_0 + y_1)$$Summing across all $n$ subintervals gives the **Composite Trapezoidal Rule**:
• Constraint: $n$ can be ANY positive integer ($n \ge 1$).
• Geometric shape: Slices area into straight trapezoids.
• Truncation Error: $E_T = -\frac{(b-a)h^2}{12} f''(\xi)$. Degree of precision = 1.
2. Simpson's 1/3rd Rule (Put $n = 2$)
Putting $n = 2$ in the General Quadrature formula and neglecting 3rd and higher differences ($\Delta^3 y_0 \approx 0$):
$$\int_{x_0}^{x_2} f(x)\,dx = 2h\left[y_0 + \frac{2}{2}\Delta y_0 + \frac{2(4-3)}{12}\Delta^2 y_0\right] = 2h\left[y_0 + (y_1 - y_0) + \frac{1}{6}(y_2 - 2y_1 + y_0)\right] = \frac{h}{3}(y_0 + 4y_1 + y_2)$$Summing across all pairs of subintervals gives the **Composite Simpson's 1/3rd Rule**:
• MANDATORY CONSTRAINT: The number of subintervals $n$ MUST BE AN **EVEN NUMBER** ($n = 2, 4, 6, 8, \dots$).
• Geometric shape: Replaces the curve with second-degree parabolas through sets of 3 points.
• Truncation Error: $E_{S1/3} = -\frac{(b-a)h^4}{180} f^{(4)}(\xi)$. Degree of precision = 3! (Exact for polynomials up to degree 3).
3. Simpson's 3/8th Rule (Put $n = 3$)
Putting $n = 3$ in the General Quadrature formula and neglecting 4th and higher differences:
• MANDATORY CONSTRAINT: The number of subintervals $n$ MUST BE A **MULTIPLE OF 3** ($n = 3, 6, 9, 12, \dots$).
• Geometric shape: Fits third-degree cubic polynomials through sets of 4 points.
• Truncation Error: $E_{S3/8} = -\frac{(b-a)h^4}{80} f^{(4)}(\xi)$.
4. Weddle's Rule (Put $n = 6$) — Extremely High CSJMU PYQ Frequency
Putting $n = 6$ in the General Quadrature formula and neglecting 7th and higher differences ($\Delta^7 y_0 \approx 0$):
• Constraint: Number of subintervals $n$ must be a **multiple of 6** ($n = 6, 12, 18, \dots$).
• Truncation Error: $E_W = -\frac{(b-a)h^6}{140} f^{(6)}(\xi)$. Degree of precision = 5! Offers extraordinary accuracy for 6 intervals.
5. Boole's Rule (Put $n = 4$) & Romberg's Integration
$$\mathbf{\int_{x_0}^{x_0+4h} f(x)\,dx = \frac{2h}{45}\left[7y_0 + 32y_1 + 12y_2 + 32y_3 + 7y_4\right]}$$ Coefficients pattern: `7 - 32 - 12 - 32 - 7`. Constraint: $n$ must be a multiple of 4.
Romberg's Integration (Richardson Extrapolation):
If $I_1$ is the Trapezoidal estimate with step $h$, and $I_2$ is with step $h/2$, the higher-order Romberg estimate is: $$\mathbf{I = I_2 + \frac{I_2 - I_1}{3} = \frac{4I_2 - I_1}{3}}$$
Problem: Evaluate $I = \int_0^6 \frac{dx}{1 + x^2}$ by dividing the range $[0, 6]$ into $n = 6$ equal subintervals using:
(i) Trapezoidal Rule
(ii) Simpson's 1/3rd Rule
(iii) Simpson's 3/8th Rule
(iv) Weddle's Rule
Compare your answers with the exact analytical value.
Step 1: Compute Step Size $h$ and Table of Ordinates:
$$h = \frac{b - a}{n} = \frac{6 - 0}{6} = \mathbf{1}$$Compute $y = f(x) = \frac{1}{1 + x^2}$ for $x = 0, 1, 2, 3, 4, 5, 6$:
| Ordinate | $x$ | $y = f(x) = \frac{1}{1 + x^2}$ | Decimal Value (to 4 places) |
|---|---|---|---|
| $y_0$ (First) | $0$ | $\frac{1}{1 + 0} = 1.0000$ | $1.0000$ |
| $y_1$ (Odd) | $1$ | $\frac{1}{1 + 1} = 0.5000$ | $0.5000$ |
| $y_2$ (Even) | $2$ | $\frac{1}{1 + 4} = 0.2000$ | $0.2000$ |
| $y_3$ (Odd/Mult of 3) | $3$ | $\frac{1}{1 + 9} = 0.1000$ | $0.1000$ |
| $y_4$ (Even) | $4$ | $\frac{1}{1 + 16} = 0.0588$ | $0.0588$ |
| $y_5$ (Odd) | $5$ | $\frac{1}{1 + 25} = 0.0385$ | $0.0385$ |
| $y_6$ (Last) | $6$ | $\frac{1}{1 + 36} = 0.0270$ | $0.0270$ |
Part (i): By Trapezoidal Rule ($h = 1$)
$$I_{Trap} = \frac{h}{2}\left[(y_0 + y_6) + 2(y_1 + y_2 + y_3 + y_4 + y_5)\right]$$ $$I_{Trap} = \frac{1}{2}\left[(1.0000 + 0.0270) + 2(0.5000 + 0.2000 + 0.1000 + 0.0588 + 0.0385)\right]$$ $$I_{Trap} = \frac{1}{2}\left[1.0270 + 2(0.8973)\right] = \frac{1}{2}[1.0270 + 1.7946] = \frac{2.8216}{2} = \mathbf{1.4108}$$Part (ii): By Simpson's 1/3rd Rule ($n = 6$ is even!)
$$I_{S1/3} = \frac{h}{3}\left[(y_0 + y_6) + 4(y_1 + y_3 + y_5) + 2(y_2 + y_4)\right]$$ $$I_{S1/3} = \frac{1}{3}\left[(1.0000 + 0.0270) + 4(0.5000 + 0.1000 + 0.0385) + 2(0.2000 + 0.0588)\right]$$ $$I_{S1/3} = \frac{1}{3}\left[1.0270 + 4(0.6385) + 2(0.2588)\right] = \frac{1}{3}[1.0270 + 2.5540 + 0.5176] = \frac{4.0986}{3} = \mathbf{1.3662}$$Part (iii): By Simpson's 3/8th Rule ($n = 6$ is a multiple of 3!)
$$I_{S3/8} = \frac{3h}{8}\left[(y_0 + y_6) + 3(y_1 + y_2 + y_4 + y_5) + 2(y_3)\right]$$ $$I_{S3/8} = \frac{3(1)}{8}\left[(1.0000 + 0.0270) + 3(0.5000 + 0.2000 + 0.0588 + 0.0385) + 2(0.1000)\right]$$ $$I_{S3/8} = \frac{3}{8}\left[1.0270 + 3(0.7973) + 0.2000\right] = \frac{3}{8}[1.0270 + 2.3919 + 0.2000] = \frac{3(3.6189)}{8} = \mathbf{1.3571}$$Part (iv): By Weddle's Rule ($n = 6$)
$$I_{Weddle} = \frac{3h}{10}\left[y_0 + 5y_1 + y_2 + 6y_3 + y_4 + 5y_5 + y_6\right]$$ $$I_{Weddle} = \frac{3(1)}{10}\left[1.0000 + 5(0.5000) + 0.2000 + 6(0.1000) + 0.0588 + 5(0.0385) + 0.0270\right]$$ $$I_{Weddle} = \frac{3}{10}\left[1.0000 + 2.5000 + 0.2000 + 0.6000 + 0.0588 + 0.1925 + 0.0270\right] = \frac{3}{10}[4.5783] = \mathbf{1.3735}$$Exact Analytical Comparison:
$$\int_0^6 \frac{dx}{1 + x^2} = [\arctan(x)]_0^6 = \arctan(6) - \arctan(0) \approx \mathbf{1.4056}$$Weddle's rule and Simpson's rules give exceptional accuracy without needing continuous calculus!
- General Quadrature (4 Marks): Integrate Newton's forward difference series $I = \int_0^n [\dots] h\,du$ to derive the master formula $nh[y_0 + \frac{n}{2}\Delta y_0 + \dots]$.
- Deduce Trapezoidal (2 Marks): Substitute $n = 1$, neglect $\Delta^2$, show single strip $\frac{h}{2}(y_0+y_1)$, then write composite formula.
- Deduce Simpson's 1/3 (3 Marks): Substitute $n = 2$, keep up to $\Delta^2$, show double strip $\frac{h}{3}(y_0+4y_1+y_2)$, then write composite formula. Emphasize that $n$ must be EVEN!
- Error Comparison (1 Mark): State that Trapezoidal error is $O(h^2)$ while Simpson's 1/3 is $O(h^4)$.
• Violating Parity Constraints: Applying Simpson's 1/3rd rule when $n$ is ODD (e.g. $n = 5$) is mathematically invalid and receives 0 marks! Simpson's 1/3rd strictly requires $n$ to be EVEN.
• Multipliers in Simpson's 1/3: Remember: 4 multiplies ODD ordinates ($y_1, y_3, y_5$) and 2 multiplies EVEN ordinates ($y_2, y_4, y_6$). Don't invert them!
Verify your conceptual grasp across numerical differentiation, general quadrature, Trapezoidal, Simpson 1/3, and Simpson 3/8 with this 10-question quiz.