Trapezoidal Rule Calculator
Pick a function, set the limits a and b and the number of intervals to estimate the integral.
Result
How it is calculated
You choose one of four built-in functions (x², sin x, eˣ or √x), the limits a and b, and the number of intervals n. The tool computes the step h = (b − a) / n and then T = h × [ (f(a) + f(b)) / 2 + f(a+h) + f(a+2h) + … + f(a+(n−1)h) ]. Interior points count fully, the two end points count half. The sine is evaluated in radians. The upper limit must be larger than the lower limit, n is rounded to a whole number (2.5 becomes 3) and must be between 1 and 1,000,000, and √x needs a ≥ 0. You cannot enter your own formula or data points. The integral and the step are shown to 6 decimals.
Worked example
Take sin x from 0 to 3.14159 (about π) with n = 4. The step is h = 3.14159 / 4 = 0.785398. The end points give (0 + 0.000003) / 2, close to 0. The three inner points are sin(0.7854) = 0.7071, sin(1.5708) = 1 and sin(2.3562) = 0.7071, which sum to 2.4142. Multiplying 0.785398 × 2.4142 gives an integral of 1.896119. The exact area is 2, so four strips are about 5% low; n = 100 gives 1.999836.
Common mistakes
- Typing the limits in degrees for sin x. The function works in radians, so 0 to 180 is not a half-wave; use 0 to 3.14159.
- Entering n as the number of points. n is the number of intervals, and there are n + 1 points including both ends.
- Putting the larger limit in a. If b is not greater than a the tool returns nothing, so swap them and change the sign of the answer yourself if you need the reverse direction.
- Trusting a small n for a curved function. With n = 4 the sine area above is about 5% low; double n until the first digits stop changing.
- Expecting a negative start for √x to work. The square root needs a ≥ 0, otherwise there is no result.
About this calculator
The composite trapezoidal rule approximates a definite integral by splitting the interval [a, b] into n equal-width strips of width h = (b−a)/n, treating each strip as a trapezoid under the curve, and summing their areas: ∫f(x)dx ≈ (h/2)[f(a) + 2f(x₁) + 2f(x₂) + ... + f(b)]. More strips means smaller trapezoids and a closer approximation to the true area.
It's one of the first numerical integration methods taught in calculus and numerical methods courses, and remains useful when a function has no closed-form antiderivative, or when you only have discrete data points (like sensor readings) rather than a formula. This calculator works on one of four built-in functions — x², sin(x), eˣ or √(x) — over your interval; it does not take your own formula or data points, so for measured data apply the formula by hand.
Was this helpful?
You can pick up to 3 reactions.
Popular calculators
Loan Calculator
Monthly payment, total interest and full amortization schedule.
Percentage Calculator
Percent change, percent of, and ratio calculations.
Discount Calculator
Calculate final price, savings, and discount amount.
BMI Calculator
Body mass index from height and weight (metric or imperial).
Age Calculator
Compute your exact age in years, months and days from a birth date.
Compound Interest Calculator
Calculate the final amount and interest earned with compounding.
All Calculators
- Loan Calculator
- Profit Calculator
- Discount Calculator
- BMI Calculator
- Percentage Calculator
- Ideal Weight Calculator
- Age Calculator
- Pregnancy Due Date Calculator
- Compound Interest Calculator
- BMR Calculator (Basal Metabolic Rate)
- Tip Calculator
- Fuel Cost Calculator
- Date Difference Calculator
- Sleep Cycle Calculator
- Daily Water Intake Calculator
- Simple Interest Calculator
- Heart Rate Zones Calculator
- Running Pace Calculator
- Pet Age Calculator
- Calories Burned Calculator
- Macro Calculator
- TDEE Calculator (Total Daily Energy Expenditure)
- Waist-to-Hip Ratio Calculator
- Honor Roll Calculator
- One Rep Max (1RM) Calculator
- Ovulation Calculator
- Electricity Cost Calculator
- Unit Price Calculator
- Savings Goal Calculator
- Break-Even Point Calculator
- Paint Calculator
- Course Grade Average Calculator
- Business Days Calculator
- Time Duration Calculator
- Fuel Economy Calculator
- Temperature Converter
- Tile Calculator
- Aspect Ratio Calculator
- Roman Numeral Converter
- Goal Weight Timeline Calculator
- Salary Converter (Hourly to Annual)
- Credit Card Validator (Luhn)
- Body Surface Area (BSA) Calculator
- Feels-Like Temperature Calculator
- Ohm’s Law Calculator
- PPI (Pixel Density) Calculator
- Molar Mass Calculator
- Zodiac Sign Calculator (Western + Chinese)
- IBAN Validator
- Shoe Size Converter
- Country Info & Dialing Code Lookup
- Time Zone Difference (World Clock)
- CAGR (Compound Annual Growth Rate) Calculator
- Rule of 72 Calculator
- Blood Alcohol Content (BAC) Calculator
- Lean Body Mass (LBM) Calculator
- Pythagorean Theorem Calculator
- Speed Converter
- Download Time Calculator
- Date Calculator (Add/Subtract)
No calculators found
Comments (1)
Not every function converges at the same pace. For the square root on 0 to 1, ten strips give 0.660509 and a thousand give 0.666660, so the error is still visible at 1,000 because the curve is steep at zero. Smooth curves such as e to the x settle far faster. A good habit is to double n and see which digits move. Which function would you like to be able to integrate here?