# Nakafa Framework: LLM URL: /en/subject/high-school/12/mathematics/integral/riemann-sum Source: https://raw.githubusercontent.com/nakafaai/nakafa.com/refs/heads/main/packages/contents/subject/high-school/12/mathematics/integral/riemann-sum/en.mdx Output docs content for large language models. --- import { LineEquation } from "@repo/design-system/components/contents/line-equation"; import { getColor } from "@repo/design-system/lib/color"; export const metadata = { title: "Riemann Sum", description: "Approximate areas under curves using rectangles with Riemann sums. Learn partitions, sample points, and visual calculations with detailed examples.", authors: [{ name: "Nabil Akbarazzima Fatih" }], date: "05/26/2025", subject: "Integrals", }; ## The Basic Idea of Riemann Sums Imagine you have a plot of land with one side that is an irregular curve. How would you calculate its area? One of the most practical ways is to divide the land into several rectangular pieces of the same width, calculate the area of each piece, and then add them all up. That's the basic idea behind a **Riemann Sum**. It is a method to **approximate the area of a region under a curve** by dividing it into multiple rectangles and summing up their areas. The more rectangles we use, the more accurate our area approximation becomes. ## Key Components To perform a Riemann Sum, we need to understand its main components: - **Interval **: This is the left and right boundary of the region whose area we want to calculate. - **Partitions ()**: This is the number of rectangles we will use to divide the region. - **Subinterval Width ()**: This is the width of each rectangle. If we divide the interval evenly, its width is calculated by the formula: - **Sample Point ()**: This is a point in each subinterval whose height we will use to determine the height of the rectangle (). There are several common ways to choose a sample point, such as the left endpoint, right endpoint, or midpoint. ## The Riemann Sum Formula If we combine all these components, we get the general formula for a Riemann Sum: The sigma notation () simply means "sum up all the areas of the rectangles," where the area of each rectangle is its **height** () times its **width** (). ## Visual Calculation Example Let's apply this concept to an example. **Problem:** Determine the Riemann Sum for the function on the interval by dividing it into 7 subintervals of equal length and using the **left endpoint** as the sample point. Graph of the function with 7 rectangular partitions using the left endpoint.} showZAxis={false} data={[ { points: Array.from({ length: 8 }).map((_, i) => ({ x: i, y: i, z: 0 })), color: getColor("PURPLE"), showPoints: false, labels: [{ text: "f(x) = x", at: 4, offset: [-1, 0.5, 0] }], }, ...Array.from({ length: 7 }).map((_, i) => { const x_left = i; const x_right = i + 1; const y_height = x_left; // f(x) = x, so height is taken from x_left return { points: [ {x: x_left, y: 0, z: 0}, {x: x_right, y: 0, z: 0}, {x: x_right, y: y_height, z: 0}, {x: x_left, y: y_height, z: 0}, {x: x_left, y: 0, z: 0}, ], color: getColor("SKY"), smooth: false, showPoints: false, } }) ]} /> **Solution:** 1. **Identify Components:** - Function: - Interval: - Number of partitions: 2. **Calculate Subinterval Width ():** Each rectangle will have a width of 1. 3. **Determine the Sample Points (Left Endpoint):** Our subintervals are: For the left-endpoint method, we take the x-value from the left side of each subinterval as the sample point: 4. **Calculate the Height of Each Rectangle:** The height of each rectangle is determined by the function's value at the chosen sample points:
5. **Calculate the Riemann Sum:** Now we can calculate the total area by summing the areas of all rectangles. Remember that the area of each rectangle is height times width:
Thus, the estimated area under the curve from 0 to 7 is **21**. > Note that because the function is always increasing (monotonically increasing), using the left endpoint will always produce rectangles that are under the curve, resulting in an area approximation that is smaller than the actual area (an underestimate). Conversely, if we use the right endpoint on a monotonically increasing function, the result will always be an overestimate. ## Exercises 1. Calculate the Riemann Sum for the function on the interval using 4 subintervals of equal width and the **right endpoint** as the sample point. ### Answer Key 1. We will calculate the Riemann Sum for on with . Graph of the function with 4 rectangular partitions using the right endpoint.} cameraPosition={[10, 10, 10]} showZAxis={false} data={[ { points: Array.from({ length: 41 }).map((_, i) => { const x = i * 0.1; const y = x * x + 1; return { x, y, z: 0 }; }), color: getColor("AMBER"), showPoints: false, labels: [{ text: "f(x) = x² + 1", at: 20, offset: [2, -1, 0] }], }, ...Array.from({ length: 4 }).map((_, i) => { const x_left = i; const x_right = i + 1; const y_height = x_right * x_right + 1; // f(x) = x² + 1, right endpoint return { points: [ {x: x_left, y: 0, z: 0}, {x: x_right, y: 0, z: 0}, {x: x_right, y: y_height, z: 0}, {x: x_left, y: y_height, z: 0}, {x: x_left, y: 0, z: 0}, ], color: getColor("CYAN"), smooth: false, showPoints: false, } }) ]} /> **Step 1: Determine the main components.** - Function: - Interval: - Number of partitions: - Sample point: Right endpoint **Step 2: Calculate the subinterval width.** **Step 3: Determine the right endpoint sample points.** The subintervals are: For the right-endpoint method, we take the x-value from the right side of each subinterval: **Step 4: Calculate the height of each rectangle.** The height of each rectangle is determined by the function's value at the right endpoint sample points:
**Step 5: Calculate the total Riemann Sum.** Now we sum the areas of all rectangles (height × width):
Thus, the Riemann Sum for the function is **34**.