Starlight Tools

Optimization Calculator: Find Maximum and Minimum Values

Enter a function to find maximum and minimum values and where they occur; choose a closed interval, an optional open or infinite domain, or a guided applied problem. See expression-specific steps, exact expressions where supported, decimal approximations, derivative analysis, and an interactive graph.

Enter the optimization problem

Full-domain mode requests all real x by default. Restrict it for open or infinite intervals. Unsupported expressions receive a finite numerical exploration, with global extrema marked “Not certified.”

Try 2x, (x+1)(x−1), e^x, π, 1/3, or |x|. Use ^ for powers. Functions include sin, cos, tan, exp, ln, log, sqrt, and abs.

Domain bounds

Bounds accept pi, 2pi, e, sqrt(2), and fractions. Full-domain mode also accepts -infinity and infinity; infinite endpoints are always excluded.

Try an example

Keyboard shortcut: Ctrl/⌘ + Enter. Trigonometric inputs use radians.

Optimization result

Absolute minimum

—
Calculate to see the result.

Absolute maximum

—
Calculate to see the result.

The derivative and interval summary will appear here.

Critical points and endpoint comparison
Candidatexf(x)Derivative tests
Calculate a function to list its candidates.
Step-by-step solution
  1. Enter a function and closed interval to see the optimization steps.
Derivative signs, monotonicity, and concavity

Intervalf′ signBehaviorf″ signConcavity

Function graph and extrema

Calculate a function to draw it. Gaps represent undefined or non-real values.

Methods, accuracy, and supported domains

Maintained by Starlight Robotics. Updated . A named mathematical reviewer and qualification have not been documented; no independent review is claimed.

Symbolic differentiation
The local expression tree applies power, product, quotient, and chain rules. Both derivatives and the rules used appear in the solution.
Algebraic root analysis
Numeric literals first parse at browser floating-point precision; subsequent rational polynomial coefficient operations use exact fraction arithmetic. Repeated factors are removed before derivative-based root isolation and bisection. Supported root polynomials have degree at most eight. Rational roots with denominator up to 1,000 and quadratic radicals receive exact labels.
Supported global analysis
Rational functions on a continuous domain; abs or sqrt of supported polynomials on a valid domain; exp, ln, and log of an affine expression; sin and cos of an affine expression on finite intervals with at most 180 periods of π. Open or infinite boundaries use analytic limits for these families. Domains containing denominator gaps are not certified.
Numerical fallback
Other expressions use 1,600 sampled subintervals with bisection and Newton refinement. Their results are exploratory: roots, cusps, discontinuities, and narrow or rapid oscillations may be missed. An infinite domain is explored through a finite graph window, never treated as a global search.
Tolerances and rounding
Algebraic bisection stops at about 10⁻¹³(1+|x|); numerical locations within 10⁻⁹(1+|x|) merge. Value ties use relative tolerance 10⁻⁹ with a 10⁻¹² scale floor. Decimal precision affects display only; very small nonzero values use scientific notation. Extreme scales and closely spaced roots may be unresolved.
Privacy and limits
Calculations run in your browser. Use one variable and expressions up to 300 characters. Finite bounds must lie within ±10 billion. Exact substituted expressions may remain unsimplified; ≈ always marks numerical values.

Validation cases cover polynomial endpoint winners, equal extrema, repeated roots, flat minima, stationary inflections, sine, exponential limits, absolute-value cusps, denominator discontinuities, open domains, and applied constraints. See the examples below for reproducible inputs.

What optimization means in calculus

Optimization finds the largest or smallest output allowed by a domain or constraint. The extremum value is f(x); the argmax or argmin is the set of x-values where that maximum or minimum occurs.

A critical number is an interior domain value where f′ is zero or does not exist while f is defined. A stationary point has f′=0 and may be an extremum or neither. This page calls interior extrema local and labels endpoint behavior separately as one-sided.

The Extreme Value Theorem says a continuous real function on a finite closed interval attains both an absolute maximum and an absolute minimum. Open or infinite domains need additional limit analysis; a limiting value may never be attained.

Common optimization mistakes

  • Forgetting included endpoints: they can beat every stationary point.
  • Comparing x-values instead of f(x): a larger location need not produce a larger value.
  • Treating every stationary point as an extremum: x³ has a stationary inflection at zero.
  • Ignoring the domain: denominator zeros, negative square-root arguments, and excluded endpoints are not candidates.
  • Assuming f″(c)=0 proves an extremum: the second-derivative test is inconclusive; use the sign change of f′.
  • Confusing local and absolute: a local peak can lie below an endpoint elsewhere.

Worked examples — load any problem

Full solution: cubic with endpoint winners

On [−3,3], f(x)=x³−3x. The power and difference rules give f′(x)=3x²−3 and f″(x)=6x.

Solve 3x²−3=0 ⇒ x²=1 ⇒ x=−1 or 1. Both are inside the interval. Evaluate f(−3)=−18, f(−1)=2, f(1)=−2, f(3)=18.

Since f″(−1)=−6<0, (−1,2) is a local maximum; f″(1)=6>0 makes (1,−2) a local minimum. Comparing all four values gives absolute minimum −18 at x=−3 and absolute maximum 18 at x=3. The endpoints win.

Tied extrema

For x² on [−2,2], f′=2x=0 gives x=0. Values are 4, 0, 4: minimum 0 at x=0; maximum 4 at both x=−2 and x=2.

A cusp: |x|

On [−2,3], f′=−1 left of zero and +1 right of zero. The derivative is undefined at zero, where f is defined. Minimum 0 occurs at the cusp x=0; maximum 3 at x=3.

A trigonometric interval

For sin(x) on [0,2π], f′=cos(x)=0 gives π/2 and 3π/2. The endpoint values are zero; maximum 1 occurs at π/2 and minimum −1 at 3π/2.

Open domain, no attained extrema

For f(x)=x on (0,1), f′=1>0. The infimum 0 and supremum 1 are approached at the excluded endpoints. Neither a minimum nor a maximum exists.

Applied: a 20 m fence

A rectangular garden uses 20 m of fencing. From 2x+2y=20, y=10−x and A=x(10−x), with 0<x<10. A′=10−2x=0 gives x=5; A″=−2<0. A 5 m × 5 m garden has maximum area 25 m².

Optimization calculator FAQs

What is optimization in calculus?

It is the process of finding the largest or smallest function value allowed by a domain or constraint. Derivatives identify candidates; evaluating them and analyzing boundaries determines which values win.

What is a critical point?

A critical number is an interior x-value where f is defined and f′ is zero or undefined. The corresponding point is (x,f(x)). A cusp such as |x| at zero is critical even though its derivative does not exist.

When does the second derivative test fail?

At a stationary point, f″=0 or an undefined f″ makes the test inconclusive. The calculator checks whether f′ changes from positive to negative (maximum) or negative to positive (minimum). No sign change means the point is not a strict local extremum.

Can I enter pi or infinity?

Yes. Bounds accept pi, π, 2pi, e, sqrt(2), and fractions. Select Full-domain extrema for open endpoints or ±infinity. Without a custom domain, that mode requests all real x; if the natural domain cannot be resolved, the result is explicitly not certified.

Why is there no absolute maximum?

The function may be unbounded above, or its greatest limiting value may occur only at an excluded boundary. For x on (0,1), the supremum is 1 but no input attains it. “Not certified” instead means this solver cannot establish the global answer.

Can several x-values share one extremum?

Yes. For x² on [−2,2], both endpoints share maximum value 4. Every detected tied location is listed. A constant function has both its maximum and minimum at every domain point, including non-strict local extrema throughout the interior.

Are answers exact or approximate?

Symbolic derivatives, verified rational roots, quadratic radical roots, supported trigonometric locations, and exact substitutions are shown before approximations. Other roots are numerical and marked ≈. You choose 4, 6, or 10 decimal places; display rounding does not change internal calculations.

Can this solve word problems or multivariable constraints?

Applied mode guides rectangle area, cut-box volume, square-base box material, ax+b/x cost, and point-to-axis distance problems. It derives a one-variable objective and feasible domain from the measurements. It does not parse arbitrary word problems or solve general multivariable constraints or Lagrange multipliers.

Can the numerical search miss critical points?

Yes. Unsupported compositions use a sampled search, which can miss rapid oscillations, narrow features, cusps, or nearby roots. Such results do not certify absolute extrema. Even algebraic analysis has floating-point limits for root isolation and value comparisons.

Does my function leave the browser?

No solving API receives the function. Parsing, differentiation, root analysis, graphing, and report generation run locally in your browser.

Explore more mathematical tools

Explore more tools