Learning Objectives
By the end of this section, you will be able to:
- Visualize and interpret the area between two curves as a geometric quantity
- Set up definite integrals to compute areas between curves, identifying the correct bounds and integrand
- Handle curves that intersect within the integration interval by splitting the integral appropriately
- Choose between vertical and horizontal integration based on the geometry of the problem
- Apply these techniques to real-world problems in physics, economics, and engineering
- Connect these ideas to probability distributions and machine learning metrics
Why This Matters: Computing the area between curves is one of the most practical applications of integration. It appears everywhere: in calculating consumer surplus in economics, work done by variable forces in physics, probabilities in statistics, and evaluation metrics in machine learning. Mastering this technique opens doors to understanding how calculus models the real world.
The Big Picture
In Chapter 8, we learned that the definite integral computes the signed area between a curve and the x-axis. But what if we want to find the area trapped between two curves? This is not just an abstract mathematical exercise—it's a question that arises naturally in many contexts.
Historical Context
The problem of finding areas between curves was central to the development of calculus in the 17th century. Isaac Newton and Gottfried Wilhelm Leibniz independently developed techniques to solve such problems. Earlier, mathematicians like Bonaventura Cavalieri (1598–1647) had used the method of indivisibles—thinking of areas as composed of infinitely thin strips—which directly anticipates our modern approach.
The applications were immediately practical. Newton himself used these techniques to analyze planetary orbits, where the area swept out by a planet relates to its speed (Kepler's second law). Economists later adopted the same mathematics to compute consumer and producer surplus, and statisticians used it to work with probability distributions.
The Core Insight
The key insight is simple: the area between two curves equals the integral of the vertical distance between them. If on an interval , then at each x-value, the vertical distance between the curves is . Summing these infinitesimally thin vertical strips from to gives the total area.
From a Single Curve to Two Curves
Let's build intuition by connecting what we already know about definite integrals to this new problem.
Area Under a Single Curve
Recall that computes the signed area between and the x-axis (where ). We can think of this as the area between two curves:
- The top curve:
- The bottom curve: (the x-axis)
The integrand is precisely the vertical distance between these two curves: .
Generalizing to Two Curves
Now suppose we have two functions and where for all in . The vertical distance between the curves at any point is:
Think of the region between the curves as being filled with infinitely many thin vertical rectangles. Each rectangle has:
- Width: (an infinitesimally small change in x)
- Height: (the vertical distance between the curves)
- Area:
Summing all these infinitesimal rectangles from to gives the total area.
The Mathematical Framework
Area Between Two Curves (Vertical Rectangles): If for all in , then the area of the region bounded above by , below by , and on the sides by and is:
Understanding Each Component
| Component | Meaning | How to Find It |
|---|---|---|
| a and b (bounds) | The x-values where the region starts and ends | Often the intersection points of the curves |
| f(x) (top curve) | The function that lies above in the region | Compare function values at a test point |
| g(x) (bottom curve) | The function that lies below in the region | The other function at the same test point |
| f(x) - g(x) (integrand) | The height of each vertical strip | Top minus bottom (always positive) |
| dx | Infinitesimal width of each strip | Indicates integration with respect to x |
Why Subtract (and Why Order Matters)
The formula requires that throughout the interval. This ensures that , so we're integrating a non-negative function and getting a positive area.
If the curves switch positions (one goes above the other at some point), we need to handle this carefully—a topic we'll address in the "When Curves Cross" section below.
Finding Intersection Points
Often, the integration bounds and are the x-coordinates where the two curves intersect. Finding these points is a crucial first step.
The Algebraic Approach
Two curves and intersect where they have the same y-value for the same x-value. This means:
Solving this equation gives the x-coordinates of intersection. Let's see some examples:
Example: Parabola and Line
Find where and intersect.
Solution: Set . Rearranging: . Factoring: . So or .
The curves intersect at (where ) and (where ).
Example: Two Parabolas
Find where and intersect.
Solution: Set . Rearranging: , so . Thus or .
Interactive: Area Between Curves Explorer
Use this interactive visualization to explore how the area between curves is computed. You can:
- Select different pairs of functions to see various curve shapes
- Adjust the number of rectangles in the Riemann sum approximation
- See how the approximation improves as you add more rectangles
- Identify intersection points where the curves meet
Interactive: Area Between Curves Explorer
A downward parabola intersecting a line
How to read this visualization:
- The purple shaded region shows the area between the two curves
- The blue rectangles approximate this area using a Riemann sum
- Yellow dots mark where the curves intersect
- Red dashed lines show the integration bounds [a, b]
- Increase the number of rectangles to see the approximation improve!
Worked Examples
Example 1: Parabola and Line
Problem: Find the area of the region bounded by and .
Step 1: Find intersection points. We already found these: and .
Step 2: Determine which curve is on top. Pick a test point in the interval, say :
- gives
- gives
Since , the line is on top in this interval.
Step 3: Set up and evaluate the integral.
Find the antiderivative:
Evaluate at the bounds:
Answer: The area is or square units.
Example 2: Trigonometric Curves
Problem: Find the area between and from to .
Step 1: Find where they intersect. Set , which gives , so in this interval.
Step 2: Determine which is on top in each region.
- On : At , , so cosine is on top
- On : At , , so sine is on top
Step 3: Split and evaluate.
Answer: The area is square units.
When Curves Cross
When two curves intersect within your integration interval, you cannot simply use one integral. The "top" and "bottom" curves switch at each intersection point.
The General Strategy
- Find all intersection points within your interval of interest
- Split the interval at each intersection point
- Determine which curve is on top in each subinterval (use a test point)
- Set up separate integrals for each subinterval
- Add the results
Alternative: Using Absolute Value
If you don't want to split the integral, you can use:
This automatically handles sign changes. However, to evaluate this integral by hand, you'll typically still need to split at the points where . The absolute value approach is particularly useful for numerical computation.
Integrating with Respect to y
Sometimes it's easier (or necessary) to integrate horizontally rather than vertically. This is especially true when:
- The curves are more naturally expressed as rather than
- The "top" and "bottom" would switch many times with vertical rectangles
- The region's left and right boundaries are simpler than top and bottom
Area Between Two Curves (Horizontal Rectangles): If lies to the right of for all in , then:Here, is the "right curve" and is the "left curve."
Example: Horizontal Integration
Problem: Find the area enclosed by and .
Step 1: Find intersections. Set , giving , so . Thus or .
Step 2: Determine right vs. left. At : the parabola gives , the line gives . So the line is on the right.
Step 3: Set up and evaluate.
This is the same integral as Example 1! The answer is .
Practice: Setting Up Integrals
Practice identifying the correct bounds, which curve is on top, and setting up the integral correctly. Try to solve each problem before revealing the solution.
Practice: Setting Up Area Integrals
Find the area between:
- f(x) = 4 - x² (green)
- g(x) = 0 (x-axis) (orange)
Real-World Applications
1. Consumer and Producer Surplus (Economics)
In microeconomics, the demand curve shows how much consumers are willing to pay for quantity , and the supply curve shows what producers need. At market equilibrium :
- Consumer Surplus = Area between demand curve and price line =
- Producer Surplus = Area between price line and supply curve =
These surpluses measure the total benefit to consumers and producers from participating in the market.
2. Work Done by Variable Forces (Physics)
If two forces and act on an object, the net work done as the object moves from to is:
This is exactly the area between the force curves!
3. Gini Coefficient (Inequality Measurement)
The Lorenz curve shows the proportion of total income earned by the bottom proportion of the population. Perfect equality would give (the line of equality). The Gini coefficient is:
This is twice the area between the line of equality and the Lorenz curve. Values range from 0 (perfect equality) to 1 (maximum inequality).
4. Probability Between Distributions (Statistics)
Given two probability density functions and , the area between them (the total variation distance) measures how different the distributions are:
Connection to Machine Learning
The concept of area between curves appears in several important machine learning contexts:
1. ROC-AUC (Receiver Operating Characteristic - Area Under Curve)
The ROC curve plots True Positive Rate vs. False Positive Rate for a binary classifier at different thresholds. The AUC (Area Under the ROC Curve) measures the classifier's performance. An AUC of 1.0 is perfect; 0.5 is random guessing. Computing AUC is essentially computing the area between the ROC curve and the x-axis!
2. Precision-Recall Curves
Similar to ROC, the Precision-Recall curve shows the tradeoff between precision and recall. The area under this curve (AUC-PR) is particularly useful for imbalanced datasets.
3. Probability Calibration
A calibration curve plots predicted probability vs. actual frequency. The area between a model's calibration curve and the perfect diagonal line measures calibration error.
4. KL Divergence and Cross-Entropy
The Kullback-Leibler divergence measures how one probability distribution differs from another. For continuous distributions:
While not a simple area between curves, KL divergence involves integration over the ratio of two density functions—a related concept.
Python Implementation
Here's how to compute and visualize the area between curves using Python:
Common Pitfalls
| Pitfall | What Goes Wrong | How to Avoid It |
|---|---|---|
| Wrong order of subtraction | Getting a negative area | Always subtract bottom from top: f(x) - g(x) where f ≥ g |
| Ignoring curve crossings | Under- or over-counting area | Find ALL intersection points and split the integral |
| Using wrong bounds | Including or excluding regions | Double-check that bounds match the problem statement |
| Forgetting absolute value | Cancellation when curves cross | Use |f(x) - g(x)| or split the integral correctly |
| Not testing which is on top | Subtracting in the wrong order | Pick a test point in each subinterval to verify |
| Mixing up x and y integration | Wrong setup entirely | Match your rectangles (vertical or horizontal) to your variable |
Pro Tip: Always sketch the curves first! A quick sketch helps you identify intersection points, see which curve is on top, and catch errors before they happen.
Summary
In this section, we learned how to compute the area between two curves using definite integrals.
Key Formulas
| Situation | Formula |
|---|---|
| Vertical rectangles (integrate w.r.t. x) | A = ∫[a to b] [f(x) - g(x)] dx where f(x) ≥ g(x) |
| Horizontal rectangles (integrate w.r.t. y) | A = ∫[c to d] [f(y) - g(y)] dy where f(y) ≥ g(y) (right vs left) |
| When curves cross | Split at intersection points and handle each piece separately |
| General formula | A = ∫[a to b] |f(x) - g(x)| dx |
Problem-Solving Strategy
- Sketch the curves to visualize the region
- Find intersection points by setting f(x) = g(x)
- Determine top/bottom (or right/left) in each subinterval
- Set up the integral(s) with correct bounds and integrand
- Evaluate using antiderivatives or numerical methods
- Check your answer makes sense (positive area, reasonable magnitude)
Knowledge Check
Test your understanding of area between curves with this quiz:
Knowledge Check
Question 1 of 8When finding the area between two curves f(x) and g(x) where f(x) ≥ g(x) on [a,b], which integral gives the area?