Skip to content

Numerical Differentiation and Integration

What Are These Methods and Why Do We Need Them?

Section titled “What Are These Methods and Why Do We Need Them?”

In math and engineering, we often need to find slopes (derivatives) and areas under curves (integrals). Sometimes the math is too complicated to do by hand, or we only have data points instead of exact equations. That’s where numerical methods come in - they give us good approximations using simple calculations.

Think of it like this:

  • Numerical differentiation = Finding the slope when you can’t use calculus rules
  • numerical integration = Finding the area under a curve when you can’t integrate normally

Part 1: Finding Slopes (Numerical Differentiation)

Section titled “Part 1: Finding Slopes (Numerical Differentiation)”

The Basic Idea: What is a Derivative Really?

Section titled “The Basic Idea: What is a Derivative Really?”

A derivative is just the slope of a curve at a point. Remember from basic calculus:

For a function, this becomes: when is very small.

Method 1: Forward Difference - “Look Ahead”

Section titled “Method 1: Forward Difference - “Look Ahead””

The idea: Use the current point and the next point to estimate slope.

Think of it as: If you’re walking up a hill, look at where you are now and where you’ll be after one step forward.

Example: If you want the slope at , use points at and (if ).

Method 2: Backward Difference - “Look Behind”

Section titled “Method 2: Backward Difference - “Look Behind””

The idea: Use the previous point and the current point.

Think of it as: Look at where you just came from and where you are now.

Example: For slope at , use points at and .

Method 3: Centered Difference - “Look Both Ways”

Section titled “Method 3: Centered Difference - “Look Both Ways””

The idea: Use points on both sides of where you want the slope.

Why this is better: It’s like getting a second opinion - you look both ways and average out the errors!

Example: For slope at , use points at and .

alt text

alt text

Always use centered difference when possible! Here’s why:

  • Forward/backward difference: errors decrease like (if you halve the step size, error halves)
  • Centered difference: errors decrease like (if you halve the step size, error becomes 1/4!)

Finding Second Derivatives (Acceleration, Curvature)

Section titled “Finding Second Derivatives (Acceleration, Curvature)”

Sometimes you need the derivative of the derivative. The most common formula is:

What this means: It measures how much the slope is changing.

If you need super-high accuracy, you can use more points:

This uses three points and is much more accurate than the basic forward difference.


For the bell curve , find the derivative at several points using .

Try all three methods and see how centered difference gives the best results!

Radar gives you position data every second. To find velocity and acceleration, you need to take derivatives of position data using these formulas.

alt text


Part 2: Finding Areas Under Curves (Numerical Integration)

Section titled “Part 2: Finding Areas Under Curves (Numerical Integration)”

The Basic Idea: What is Integration Really?

Section titled “The Basic Idea: What is Integration Really?”

Integration finds the area under a curve. When we can’t integrate by hand, we approximate the curved area using simple shapes like rectangles or triangles.

Method 1: Trapezoidal Rule - “Connect the Dots”

Section titled “Method 1: Trapezoidal Rule - “Connect the Dots””

The idea: Connect your data points with straight lines and find the area of the resulting trapezoids.

where .

Visual: Imagine the area under the curve as a trapezoid. The area = width × average height.

alt text

Easy to remember: Just average the two heights and multiply by the width!

Method 2: Simpson’s Rule - “Use Curved Lines”

Section titled “Method 2: Simpson’s Rule - “Use Curved Lines””

The idea: Instead of straight lines, fit parabolas (curved lines) through your points. This captures curves much better!

where the middle point is at and .

The magic 1-4-1 pattern: Notice the coefficients are 1, 4, 1. This is the key to Simpson’s rule!

alt text

Why is this better? Parabolas fit curves much better than straight lines, so you get way more accuracy.

Method 3: Simpson’s 3/8 Rule - “For Four Points”

Section titled “Method 3: Simpson’s 3/8 Rule - “For Four Points””

When you have four points, you can use:

The pattern: 1-3-3-1 coefficients. Use this when you can’t apply the regular Simpson’s rule.


Find the probability that a normally distributed value falls within one standard deviation of the mean. This requires integrating the bell curve!


Handling Larger Intervals: Composite Methods

Section titled “Handling Larger Intervals: Composite Methods”

These basic rules only work well on small intervals. For larger intervals, the approximation gets worse.

Composite Trapezoidal Rule:

  1. Divide your interval into many small pieces
  2. Apply the trapezoidal rule to each piece
  3. Add up all the areas

Easy pattern to remember:

  • First and last points: multiply by 1
  • All middle points: multiply by 2
  • Then multiply everything by

alt text

Composite Simpson’s Rule: Similar idea, but you need an even number of intervals:

The pattern:

  • Endpoints: coefficient 1
  • Even-indexed middle points: coefficient 2
  • Odd-indexed middle points: coefficient 4
  • Multiply by

alt text


A capacitor’s voltage depends on the integral of current over time:

Given current measurements every 0.2 seconds, use numerical integration to find how voltage changes.

alt text


Most accurate formula:

For second derivatives:

Quick and easy (Trapezoidal):

More accurate (Simpson’s):

For larger intervals: Use composite methods (divide the interval into smaller pieces)

  1. Smaller step size usually means better accuracy
  2. Centered methods are almost always more accurate than forward/backward
  3. Simpson’s rule is usually much better than trapezoidal for integration
  4. When in doubt, try different step sizes and see if your answer stabilizes
  • Don’t forget to divide by (not ) in centered difference
  • In Simpson’s rule, make sure your middle point is exactly halfway
  • For composite methods, keep track of your coefficients (1-2-2-…-2-1 for trapezoidal, 1-4-2-4-…-4-1 for Simpson’s)
  • Always check: does your answer make sense?