acalculator

Which c fits the mean value theorem?

Type a function and an interval [a, b]. The page checks that f is continuous on [a, b] and differentiable on (a, b), then finds every c where the tangent is parallel to the secant.

Your numbers

Values of c
9/4

For sqrt(x) on [0, 9], c = 9/4.

Slope of the secant
1/3

Values of c: 9/4. For sqrt(x) on [0, 9], c = 9/4.

How to calculate

Finds every c in (a, b) where f′(c) = (f(b) − f(a))/(b − a).

Example with the default inputs (Function f(x) sqrt(x), From a 0, To b 9): For sqrt(x) on [0, 9], c = 9/4.

Method: f′(c) = (f(b) − f(a))/(b − a) for some c in (a, b).

  • Angles in radians.

Machine-readable copies: Markdown, JSON.

Worked examples

Each example is checked against the calculator on every build.

  1. Function f(x) sqrt(x), From a 0, To b 9 gives Values of c 9/4, Slope of the secant 1/3.Source: OpenStax (Strang and Herman, 2016), Calculus Volume 1, section 4.4 The Mean Value Theorem, Example 4.15
  2. Function f(x) x^3 - 4x, From a -2, To b 2 gives Values of c -2 sqrt(3)/3, 2 sqrt(3)/3, Slope of the secant 0.Source: OpenStax (Strang and Herman, 2016), Calculus Volume 1, section 4.4 The Mean Value Theorem, Example 4.14(b)

How it works

The mean value theorem: if f is continuous on [a, b] and differentiable on (a, b), then f′(c) = (f(b) − f(a))/(b − a) for at least one c in (a, b).

  1. a must be less than b.
  2. Continuity on [a, b]: f(a) and f(b) must be real numbers, and f must have no break strictly between a and b (breaks are found as described below, on the grid only). Otherwise the page says the theorem does not apply because f is not continuous on [a, b].
  3. Differentiability on (a, b): a computer algebra system (nerdamer, open source) finds f′, checked against a numeric difference quotient at 20 points (to 1 part in a million). f′ must have no break strictly between a and b (on the grid only; a point where f′ jumps, goes to ±∞, or stops being a real number). Otherwise the page says the theorem does not apply and names the first such x. The algebra runs in the background after you start typing.
  4. The slope m = (f(b) − f(a))/(b − a), written with f(a) and f(b) exactly (a and b put into f), is simplified by the algebra when the simplified form checks and stays exact; otherwise it is shown as written ((ln(3) − ln(0.5))/(3 − 0.5)), or not at all when that holds a rounded number.
  5. The values of c are the zeros of g(x) = f′(x) − m (with m as written) strictly between a and b, found by the algebra and on the grid as described below (breaks are not values of c).

The page shows Values of c in increasing order, separated by commas, and Slope of the secant exactly.

How the points are found

The zeros and breaks of a function g (a zero: g passes through or touches 0; a break: g jumps, goes to ±∞, or stops being a real number) are found between two ends a and b (each end clipped to ±10⁶) in two ways at once.

By the algebra (for the values of c; the continuity checks use the grid alone and skip touches). The computer algebra system solves g(x) = 0. A solution is an exact candidate when it is a number strictly between the ends, is not a rounded number (a whole number past 2⁵³; a fraction p/q, p and q being the numbers that multiply its top and its bottom, such as 288557167/(342919925e), when q after removing its factors 2 and 5 is over 1,000,000, or is over 1 while |p| times it is over 10¹²; or a decimal with more than 12 significant digits), and g is 0 there up to rounding: |g(c)| is at most 10⁻¹² times the sum of the sizes of the terms of g at c (the parts of g joined by + and −). So x² + 10⁻²⁰ has no zero at 0, though the algebra gives one.

On a grid. g is worked out at 8,001 points x₀ to x₈₀₀₀, evenly spaced in asinh x (so they reach ±10⁶ when an end is infinite and bunch up near 0): xᵢ = sinh(u₀ + (u₁ − u₀)(i + 0.3183)/8001), with u₀ = asinh(a) and u₁ = asinh(b). For each step from xᵢ to xᵢ₊₁:

  • If g is a number at one end of the step and not a number at the other (as ln or √ of a negative number is not), the point where it stops being one is found by halving the step 80 times: a break. A value past the largest computer number, about 1.8 × 10³⁰⁸, still counts as a number with its sign (x e^(−x) and its derivatives for x below about −703), so an overflow is not a break. But when |g| is over 10³⁰⁰ at the end where g is a number (e^x − e^(2x) near x = 355, where e^(2x) overflows and the difference is not a number), the page cannot tell an overflow from the end of the domain and gives no answer (a value is too large).
  • If g has opposite signs at the two ends, the sign change is found by halving 80 times. It is a zero if |g| there is at most 10⁻⁶ of the larger of |g(xᵢ)| and |g(xᵢ₊₁)|, and a break otherwise (g jumps or goes through ±∞). If g is past the largest computer number at either end, the page gives no answer (a value is too large).
  • If g has one sign at xᵢ, xᵢ₊₁ and xᵢ₊₂ and turns at xᵢ₊₁ (a peak or a dip), the turning point r is found by halving (on the sign of g(x + h) − g(x − h), h = 10⁻⁷ × max(1, |x|)). If g(r) has the other sign, g dips through 0 and back between xᵢ and xᵢ₊₂: two zeros too close together for the grid. Unless the algebra gives at least two exact candidates strictly between xᵢ and xᵢ₊₂ (then they are the zeros), the page gives no answer (two points are too close together). If |g(r)| is at most 10⁻⁹ of the larger of |g(xᵢ)| and |g(xᵢ₊₂)|, g touches 0 there: that is a zero when an exact candidate lies within 10⁻⁶ × max(1, |candidate|) of r, and otherwise the page says a zero could not be confirmed and gives no answer. If |g(r)| is over 10⁶ times that size (or not a number), g peaks through ±∞: a break. A reason to give no answer that turns up on the way (a dip, a touch the algebra does not confirm) is given only after the whole grid, so a function with more than 30 points (sin x) gets "too many points to check".

A zero found on the grid within 10⁻⁶ × max(1, |c|) of an exact candidate c takes its exact value and text; otherwise, when it is within 10⁻⁹ × max(1, |x|) of a fraction p/q with q = 1, 2, 3, 4, 6, 8 or 12 (the first that fits) where g is 0 up to rounding (the rule above), it is shown as p/q; otherwise as ≈ and a decimal to 10 significant figures (rounded half up). A break is shown exactly as p/q when x is within 10⁻⁹ × max(1, |x|) of p/q for q = 1, 2, 3, 4, 6, 8 or 12 (the first that fits) and g is not a real number at p/q or at p/q ± 10⁻⁹ × max(1, |x|) (a pole, a jump, or an end of the domain); otherwise as ≈ and a decimal. An exact candidate that the grid did not find (two zeros inside one step) is added. A zero right next to a pole, inside the same grid step, is found only when the algebra gives it. The same point found twice counts once (a zero before a break). Two different points within 10⁻⁶ × max(1, |x|) of each other give no answer (two points are too close together), and so do two exact candidates that close: x²(x − 10⁻⁷)² has critical numbers at 0, 5 × 10⁻⁸ and 10⁻⁷, which the page does not merge into one. More than 30 points gives no answer (too many points to check).

What you can type

  • A number has at most 15 digits in a row. A computer number keeps only about 16 digits, so a longer one (9007199254740993) would stand for a nearby number (9007199254740992), and the page asks for fewer digits instead. Write very large or very small numbers with a power of ten (1e-20).
  • The function f uses the variable x. Numbers can have decimals (2.5) and powers of ten (1e-3).
  • Operations: + − * / and ^ for powers. Brackets group. A number or bracket next to a letter multiplies: 2x, 3(x + 1), x sin(x).
  • Constants: pi (or π) and e.
  • Functions: sqrt, cbrt, ln (and log, the same natural logarithm), log10, exp, abs (or |x|), sin, cos, tan, sec, csc, cot, asin, acos, atan (arcsin, arccos, arctan also work), sinh, cosh, tanh and their inverses. Angles are in radians. sin x without brackets means sin(x); sin x^2 means sin(x²).
  • a and b are numbers or constant expressions: 0, 9, −2, pi, e, 5/2.

What gets no answer

  • f not continuous on [a, b] or not differentiable on (a, b) (the page says which).
  • No c found (the theorem says there is one, so this means a check failed), more than 30 values of c, or a turn of g that touches 0 without the algebra confirming it.
  • f′ with no x in it (a line such as 3x + 1): f′ equals the slope at every c, so the page says every c in (a, b) works instead of listing them.
  • A step that fails its check, finds no formula, or takes over 3 seconds.

Worked examples by hand

√x on [0, 9] (OpenStax Calculus Volume 1, section 4.4, Example 4.15). f(0) = 0 and f(9) = 3, so m = (3 − 0)/(9 − 0) = 1/3. f′(x) = 1/(2√x), and 1/(2√c) = 1/3 gives √c = 3/2, so c = 9/4. (f′ is not defined at 0, but 0 is an end, not inside (0, 9).)

x³ − 4x on [−2, 2] (OpenStax Calculus Volume 1, section 4.4, Example 4.14(b)). f(−2) = f(2) = 0, so m = 0. f′(c) = 3c² − 4 = 0 gives c = ±2/√3 = ±2√3/3, written -2 sqrt(3)/3, 2 sqrt(3)/3.

Other questions people ask

What does the mean value theorem say?

If f is continuous on [a, b] and differentiable on (a, b), there is at least one c in (a, b) with f′(c) = (f(b) − f(a))/(b − a). Somewhere between a and b, the instantaneous rate of change equals the average rate of change.

What is Rolle's theorem?

The special case f(a) = f(b): then the secant is horizontal and some c in (a, b) has f′(c) = 0. For x³ − 4x on [−2, 2], f(−2) = f(2) = 0, and f′(c) = 3c² − 4 = 0 at c = ±2/√3.

How do I find the value of c?

Work out the secant slope m = (f(b) − f(a))/(b − a), then solve f′(c) = m for c and keep the solutions strictly between a and b. For √x on [0, 9]: m = (3 − 0)/9 = 1/3, and 1/(2√c) = 1/3 gives c = 9/4.

What if the theorem does not apply?

If f has a jump or a pole in [a, b], or a corner in (a, b), there may be no such c. For |x| on [−1, 1] the secant slope is 0 but f′ is ±1 everywhere except 0, where it does not exist. The page names what fails instead of looking for c.

Can there be more than one c?

Yes: the theorem promises at least one. For sin(x) on [0, 2π] the secant slope is 0 and cos(c) = 0 at both π/2 and 3π/2. The page lists them all.

How is the answer checked?

The derivative from the computer algebra system is compared with a numeric difference quotient at 20 points. Each c is found both by the algebra and by a sign scan on a fine grid of (a, b), and each c the algebra gives is checked by putting it back into f′(x) − m.