Intermediate Value Theorem Calculator
This intermediate value theorem calculator does 2 separate jobs. It first checks whether the theorem applies at all: it evaluates \(f(a)\) and \(f(b)\), confirms continuity as far as that can be done automatically, and states exactly what is guaranteed. Then, when a solution is guaranteed, it narrows one down with the bisection method until the bracket is as tight as you asked for.
Keeping those jobs separate matters, because the theorem itself never locates anything. It only promises that a solution exists. So every result below tells you which of the 2 you are looking at: a logical guarantee, or a numerical estimate built on top of one.
Enter a function, an interval [a, b], and a target value k. The calculator evaluates the endpoints, states exactly what the Intermediate Value Theorem guarantees, and narrows one solution by bisection.
Run the calculator to draw the graph of f on [a, b] with the target line y = k.
| x | f(x) |
|---|
The function box accepts standard calculator notation: x^3 – x – 2, sin(x), e^x, sqrt(x), ln(x), abs(x), pi, and implicit multiplication such as 2x or x sin(x). The endpoint and target boxes take numbers or simple constants like pi/2. Everything runs in your browser; nothing you type is sent anywhere.
The theorem proves existence. Bisection finds digits.
What the Intermediate Value Theorem says
Let \(f\) be continuous on the closed interval \([a, b]\), and let \(k\) satisfy $$\min\{f(a), f(b)\} \le k \le \max\{f(a), f(b)\}.$$ Then there is at least one \(c \in [a, b]\) with \(f(c) = k\). When the inequalities are strict, \(c\) can be chosen in the open interval \((a, b)\).
The placement of \(c\) is the detail most statements blur, and the one this page got wrong for years. When \(k\) lies strictly between \(f(a)\) and \(f(b)\), a solution exists in \((a, b)\). When \(k\) equals \(f(a)\) or \(f(b)\), the guarantee comes from the endpoint itself, and no interior point is promised. Take \(f(x) = x\) on \([0, 1]\) with \(k = 0\): the only solution is \(x = 0\), which no open-interval claim can deliver.
For the definitions underneath the hypotheses, see continuous functions and sets, functions, and real numbers.
The proof
The full proof is short once you see where the difficulty lives. It is not in the function; it is in the real numbers. The theorem is really a statement about completeness: every nonempty set of reals that is bounded above has a least upper bound. Continuity contributes exactly one fact, and completeness does the rest.
The one fact continuity contributes is sign preservation. If \(g\) is continuous at a point \(p\) and \(g(p) \neq 0\), then \(g\) keeps the sign of \(g(p)\) on some small interval around \(p\). The proof is one line from the definition: take \(\varepsilon = |g(p)|/2\) and get \(\delta > 0\) so that \(|g(x) – g(p)| < |g(p)|/2\) whenever \(|x - p| < \delta\). Values that close to \(g(p)\) cannot reach 0, let alone cross it.
Now the main argument, in the strict case \(f(a) < k < f(b)\); the mirrored case flips the inequalities, and the endpoint cases are immediate. Define $$g(x) = f(x) - k,$$ so \(g\) is continuous on \([a, b]\) with \(g(a) < 0 < g(b)\), and finding \(c\) with \(f(c) = k\) means finding a root of \(g\).
Collect everything still below the target: $$S = \{\, x \in [a, b] : g(x) < 0 \,\}.$$ The set \(S\) is nonempty, because \(a \in S\), and it is bounded above by \(b\). Completeness now produces \(c = \sup S\), the least upper bound of \(S\), with \(a \le c \le b\). This is the only step where the real numbers do real work, and the proof cannot start without it.
Suppose \(g(c) > 0\). Sign preservation gives a \(\delta > 0\) with \(g > 0\) on \((c – \delta, c]\). No point of \(S\) can sit in that interval, and no point of \(S\) exceeds \(c\), so \(c – \delta\) is an upper bound of \(S\) smaller than \(c\). That contradicts \(c\) being the least upper bound.
Suppose \(g(c) < 0\). Then \(c < b\), because \(g(b) > 0\). Sign preservation gives a \(\delta > 0\) with \(g < 0\) on \([c, c + \delta)\), so points just above \(c\) belong to \(S\). That contradicts \(c\) being an upper bound at all.
Both signs are impossible, so \(g(c) = 0\), which is \(f(c) = k\). And since \(g(a) < 0\) and \(g(b) > 0\) while \(g(c) = 0\), the point \(c\) is neither \(a\) nor \(b\), so \(c \in (a, b)\). That completes the proof.
Completeness is not decoration here. Work over the rational numbers instead and the theorem fails: \(f(x) = x^2 – 2\) is continuous on \([0, 2]\) with \(f(0) = -2\) and \(f(2) = 2\), yet no rational \(c\) gives \(f(c) = 0\), because the point the proof constructs is \(\sqrt{2}\) and the rationals do not contain it. Bolzano and Cauchy both proved the theorem before completeness was formalized, which is exactly why their proofs had gaps; the history section below picks up that story.
What the theorem promises
Read the theorem as a contract. It promises less than most students assume on first meeting, and everything it does promise is unconditional. 3 things are promised.
- Existence: at least one \(c \in [a, b]\) with \(f(c) = k\), and \(c \in (a, b)\) when \(k\) is strictly between the endpoint values.
- Every intermediate value at once: the image of \([a, b]\) under a continuous \(f\) covers the whole closed interval between \(f(a)\) and \(f(b)\), not just the one \(k\) you asked about.
- No smoothness required: continuity alone is enough; \(f\) never needs a derivative.
And 3 things are not.
- Uniqueness: \(\sin x\) on \([1, 10]\) with \(k = 0\) has 3 solutions, and the theorem is fully satisfied by any one of them.
- Location: the proof produces \(c\) as a supremum, which is not a computation. Extracting digits is bisection’s job, and the calculator above keeps that division of labor explicit.
- A converse: a function can take every intermediate value and still fail to be continuous. The classic example is \(f(x) = \sin(1/x)\) for \(x \neq 0\) with \(f(0) = 0\): it satisfies the conclusion of the theorem on every interval, yet it is not continuous at 0. Passing an intermediate-value test never proves continuity.
The 4 result states
Every run of the calculator ends in exactly 1 of 4 states, and each state has a different next move.
| Result | What it means | What to do next |
|---|---|---|
| Guaranteed | Continuity holds as far as the checks reach and \(k\) lies strictly between \(f(a)\) and \(f(b)\). At least 1 solution exists in \((a, b)\). | Read the bisection table under the verdict; it narrows 1 solution to your target width. |
| Endpoint value | \(k\) equals \(f(a)\) or \(f(b)\) exactly, so the solution is the endpoint itself. | No search needed. Widen the interval if you wanted an interior solution. |
| Inconclusive | \(k\) does not lie between \(f(a)\) and \(f(b)\). The theorem is silent, not negative. | Run the sign-change scan; solutions can exist that the endpoint values cannot see. |
| Cannot apply | \(f\) is undefined or non-real somewhere in \([a, b]\), so the continuity hypothesis fails. | Split the interval at the named problem point and test each piece separately. |
The state to internalize is Inconclusive. The theorem gives a sufficient condition, never a necessary one, so a failed endpoint test proves nothing about absence.
Worked examples
\(f(x) = x^3 – x – 2\) on \([1, 2]\), \(k = 0\). Here \(f(1) = -2\) and \(f(2) = 4\). A polynomial is continuous everywhere, and 0 lies strictly between \(-2\) and 4, so at least 1 root is guaranteed in \((1, 2)\). Bisection then narrows it to about 1.5214. This is the clean case the theorem was built for.
\(f(x) = x\) on \([0, 1]\), \(k = 0\). Nothing lies strictly between the endpoint values here, because \(k\) equals \(f(0)\). The strict form of the theorem has nothing to say, yet the answer sits at \(x = 0\). The calculator reports it as an endpoint value instead of pretending the theorem produced an interior point.
\(f(x) = x^2 – 1\) on \([-2, 2]\), \(k = 0\). Both endpoints give 3, so 0 does not lie between them and the check is inconclusive. The function still has 2 roots, at \(-1\) and 1, and the scan finds both. The pair crossed the target and came back, which is exactly the situation endpoint values are blind to.
\(f(x) = 1/x\) on \([-1, 1]\), \(k = 0\). The endpoint values are \(-1\) and 1, opposite signs, exactly what a sign-change test wants to see. But \(f\) is undefined at \(x = 0\), the continuity hypothesis fails, and the theorem cannot be applied. There is in fact no root at all. Every hypothesis matters, and continuity is the one that breaks silently.
Theorem first, bisection second
The theorem contributes 1 sentence to any computation: a solution exists in this bracket. Bisection does the rest. It evaluates \(f\) at the midpoint, keeps whichever half still carries the sign change, and repeats. The guarantee is what makes the halving safe; without it, a sign change near a discontinuity can point at nothing, as \(1/x\) shows.
Each row of the steps table shows the midpoint, its function value, and the half that was kept. After \(n\) steps the bracket has width $$\frac{b – a}{2^n},$$ so once the bracket is narrower than your target width \(w\), its midpoint sits within \(w/2\) of a true solution, no estimates required. That unconditional error bound is the reason bisection stays in textbooks. The default target width is 0.01, and the calculator caps the run at 80 steps, which already supports widths far below anything a plotted graph can distinguish.
The sign-change scan
The second button splits \([a, b]\) into 240 equal subintervals, evaluates \(f(x) – k\) at every gridpoint, and bisects each subinterval whose endpoints disagree in sign. It is the honest replacement for what this page used to call finding all roots, a promise no sampler can keep.
- It only detects solutions where \(f(x) – k\) changes sign. A root of even multiplicity, like \(x = 1\) for \(f(x) = (x – 1)^2\), touches the target without crossing it, so it stays invisible unless it happens to land exactly on a sample point.
- 2 solutions closer together than the grid spacing produce 2 sign changes inside 1 subinterval, which cancel and hide both.
- Near a discontinuity, a sign change does not imply a solution, so the scan repeats the continuity caveats of the main check.
Treat the scan as a search aid, not a census. When it matters whether you have found every solution, back the scan with monotonicity or derivative arguments.
Continuity checks
The calculator classifies your expression before it reasons with it, and it tells you which class you are in.
- Established: the expression uses only polynomials and everywhere-continuous functions such as sin, cos, and exp. Continuity holds by construction, and the verdict carries no caveat.
- Checked by sampling: the expression uses division, sqrt, ln, tan, or another function with a restricted domain. The calculator samples 2001 points across the interval; clean samples support continuity but cannot prove it.
- Unknown: the expression uses a step function such as floor or ceil. The endpoint arithmetic is still shown, but the IVT conclusion is withheld.
- Cannot apply: a sampled point comes back undefined or non-real. The point is named so you can split the interval there.
When a verdict carries a caveat, the caveat is load-bearing. A sampler cannot see a hole between its gridpoints, so a guarantee marked as sampled is a strong hint, not a proof.
How this calculator was tested
Every state this intermediate value theorem calculator can report was exercised against cases with known answers before this version went live. Each check takes seconds to reproduce by typing it in exactly as written.
- x^3 – x – 2 on [1, 2] with k = 0 must guarantee a root and bisect to about 1.5214
- x on [0, 1] with k = 0 must report an endpoint value, not an interior guarantee
- x^2 – 1 on [-2, 2] with k = 0 must come back inconclusive while the scan still finds -1 and 1
- 1/x on [-1, 1] with k = 0 must refuse to apply the theorem and name x = 0 as the problem point
- sin(x) on [1, 10] with k = 0 must scan out 3 roots, near 3.1416, 6.2832, and 9.4248
- (x – 1)^2 on [0, 2.2] with k = 0 must find no sign change and say why the touch root at x = 1 is invisible
- sqrt(x) on [-1, 4] must be rejected with the undefined region named
- malformed input such as sin( or foo(x) must produce a readable error, not a dead button
Where the theorem comes from
Bernard Bolzano published the first proof of the sign-change case in 1817, decades before anyone had a rigorous construction of the real numbers, and Augustin-Louis Cauchy stated the general form in his 1821 Cours d’Analyse. Fully rigorous proofs arrived in the 1870s, once the completeness of the reals was pinned down; the supremum step in the proof above is exactly the step their era could not yet justify. What textbooks call Bolzano’s theorem is the sign-change corollary this calculator leans on: continuous on \([a, b]\) with opposite-sign endpoint values means a root in \((a, b)\).
A different write-up of the proof is maintained by Oxford College of Emory University.
Related calculators
When the next step of a problem needs a different theorem, use the Rolle’s theorem calculator, the mean value theorem calculator, or the difference quotient calculator. The mean value theorem is the one students mix up with the IVT most; it speaks about slopes, not outputs.
Calculus books worth buying
A calculator verifies; a book builds the muscle. These are the 2 I recommend for the theory behind this page, tradeoffs included.
Calculus: Early Transcendentals by James Stewart
- The limits and continuity chapter builds the Intermediate Value Theorem from the definition up, with worked examples
- Thousands of graded exercises, with answers to odd-numbered problems for self-checking
- The default assigned text in US calculus sequences, so section numbering lines up with most courses
- Formal and heavy; better as a course companion and reference than a first casual read
Calculus: An Intuitive and Physical Approach by Morris Kline
- Teaches through physical meaning first and formal proof second, the right order when a theorem feels arbitrary
- Inexpensive Dover paperback that has stayed in print since 1967
- The best second angle when a standard textbook explanation stalls
- Stops short of a full modern syllabus, so pair it with a course text rather than replacing one
Need more options? See the full list of the best calculus books.
Frequently Asked Questions
What does the Intermediate Value Theorem state?
If \(f\) is continuous on the closed interval \([a, b]\) and \(k\) is any value between \(f(a)\) and \(f(b)\), endpoints included, then at least 1 point \(c \in [a, b]\) satisfies \(f(c) = k\). When \(k\) lies strictly between the endpoint values, \(c\) can be taken in the open interval \((a, b)\).
What is k in this calculator?
\(k\) is the target output you want \(f\) to reach. Older textbooks, and the previous version of this page, called it \(N\); most modern texts write \(k\). Set \(k = 0\) to look for roots.
Why does continuity matter?
Because a discontinuous function can jump over values. A step function moves from 0 to 1 without ever equaling \(1/2\). Continuity is the hypothesis that forbids skipping, and it is the one people forget to check.
How do I prove a root exists with the IVT?
Show \(f\) is continuous on \([a, b]\) and that \(f(a)\) and \(f(b)\) have opposite signs. Then \(f(c) = 0\) for at least 1 \(c \in (a, b)\). That argument is the foundation of the bisection method.
Does the IVT tell me where the solution is?
No. It proves existence only; the proof constructs \(c\) as a supremum, not as a number you can read off. Locating a solution takes a numerical method; this calculator uses bisection because its error bound is unconditional: after narrowing to a bracket of width \(w\), the midpoint sits within \(w/2\) of a true solution.
What if f(a) and f(b) have the same sign?
The test is inconclusive, not negative. \(x^2 – 1\) on \([-2, 2]\) gives 3 at both endpoints and still has roots at \(-1\) and 1. Use the sign-change scan to search inside the interval.
Can the solution be at an endpoint?
Yes, when \(k\) equals \(f(a)\) or \(f(b)\). The strict version of the theorem does not cover that case, which is why this calculator reports it separately as an endpoint value instead of claiming an interior solution.
Is the IVT the same as Bolzano’s theorem?
Bolzano’s theorem is the special case \(k = 0\): a continuous function with opposite-sign endpoint values has a root. The general theorem follows by applying that case to \(f(x) – k\).
Why does the proof need the real numbers?
Because its key step takes the set of points where \(f\) is still below \(k\) and extracts a least upper bound, which only completeness guarantees. Over the rationals that step fails: \(x^2 – 2\) on \([0, 2]\) is continuous and changes sign, but the root it needs is \(\sqrt{2}\), which is not rational.
How is the IVT different from the Mean Value Theorem?
The IVT is about outputs: a continuous function reaches every value between \(f(a)\) and \(f(b)\). The MVT is about derivatives: a differentiable function somewhere matches its average slope. They answer different questions and are proved differently.
Why did the scan miss a root I know exists?
The scan only detects solutions where \(f(x) – k\) changes sign. A root of even multiplicity, like \(x = 1\) for \((x – 1)^2\), touches the target without crossing it, so there is no sign change for any sampler to find. Roots closer together than the sampling grid can also cancel each other out.
The habit worth taking from this page is smaller than the calculator: state what is guaranteed before you compute. The theorem earns the existence claim, bisection earns the digits, and neither can do the other’s job. Keep those separate and most IVT problems reduce to bookkeeping.
Disclaimer: This site is reader-supported. If you buy through some links, I may earn a small commission at no extra cost to you. I only recommend tools I trust and would use myself. Your support helps keep gauravtiwari.org free and focused on real-world advice. Thanks. - Gaurav Tiwari

