Calculus · average rate of change

Difference Quotient Calculator

Substitute x + h, simplify the quotient, and see how a secant slope approaches the derivative. Enter a function using the math keyboard or your regular keyboard.

CALCULATOR

Find a difference quotient

Type or insert powers, fractions, parentheses, constants, and common functions such as sin, cos, tan, ln, log, exp, and √.

Try an example
RESULT

Difference quotient

x = 1 · h = 0.5

For the entered polynomial, substitute x + h and simplify:

f(x)=x2+3x+5,f(x+h)−f(x)h=2x+h+3f(x)=x^{2} + 3x + 5,\qquad \frac{f(x+h)-f(x)}{h}=2x + h + 3
Average rate of change5.5Secant slope across the interval
Derivative at x5f′(1) · instantaneous slope
WORKED SOLUTION

How the quotient is formed

  1. 1

    Substitute x + h into the function

    f(x+h)=x2+2xh+h2+3x+3h+5f(x+h)=x^{2} + 2xh + h^{2} + 3x + 3h + 5
  2. 2

    Find the change in the function

    f(x+h)−f(x)=11.75−9=2.75f(x+h)-f(x)=11.75-9=2.75
  3. 3

    Divide by the input change h

    f(x+h)−f(x)h=2.750.5=5.5\frac{f(x+h)-f(x)}{h}=\frac{2.75}{0.5}=5.5
LIMIT EXPLORER

What happens as h gets smaller?

Each row halves the step while approaching the same starting x from the same side.

Step hx + hf(x + h)Quotient
0.51.511.755.5
0.251.2510.31255.25
0.1251.1259.6406255.125
0.06251.06259.316406255.0625

For this differentiable function, the quotient values approach f′(1) = 5 as h approaches zero. A difference quotient uses a nonzero h; the derivative is the limit, not the quotient evaluated at h = 0.

The quotient is the slope of the secant line through (1, f(1)) and (1.5, f(1.5)). It measures average change over that interval.

Definition and formula

What is a difference quotient?

A difference quotient measures the average rate of change of a function between two inputs. Start at x, move by a nonzero amount h, and compare the function values at the endpoints x and x + h. The change in output is divided by the change in input:

Qf(x,h)=f(x+h)−f(x)h,h≠0Q_f(x,h)=\frac{f(x+h)-f(x)}{h},\qquad h\ne0

On a graph, this value is the slope of the secant line through the points (x, f(x)) and (x + h, f(x + h)). If the quotient is positive, the function rises on that interval; if it is negative, the function falls. A value near zero means the endpoint function values are close, although the curve may still change substantially elsewhere in the interval.

The increment h is a signed horizontal change. A positive h measures forward from x; a negative h measures backward. Both are valid whenever the function is defined at both endpoints and h is not zero.

Using the calculator

How to find a difference quotient

  1. Enter the function f(x). Use the editable math field for polynomials, fractions, powers, roots, constants, and supported trigonometric or logarithmic functions.
  2. Set the starting input x. This determines the first point on the function.
  3. Choose a nonzero step h. The second point is x + h. A smaller magnitude gives a shorter interval; h = 0 is not allowed in the quotient.
  4. Calculate and read the result. For polynomials, the calculator expands and simplifies the symbolic quotient. It also evaluates the selected values and shows the secant slope.
  5. Compare the h table. The table halves h repeatedly so you can observe the finite average rates moving toward the derivative, when the derivative exists.

Use the keyboard button to open the on-screen math keys. You can also type ordinary notation such as x^2 + 3x + 5, sin(x), or sqrt(x). Parentheses make the intended order of operations clear.

Worked example

Example: f(x) = x² + 3x + 5

Find the difference quotient for the function at x = 1 with h = 0.5. First substitute x + h for every occurrence of x:

f(x+h)=(x+h)2+3(x+h)+5=x2+2xh+h2+3x+3h+5f(x+h)=(x+h)^2+3(x+h)+5=x^2+2xh+h^2+3x+3h+5

Subtract the original function, then divide the entire difference by h. The x², 3x, and constant terms cancel:

f(x+h)−f(x)h=(x2+2xh+h2+3x+3h+5)−(x2+3x+5)h=2xh+h2+3hh=2x+h+3.\begin{aligned}\frac{f(x+h)-f(x)}{h}&=\frac{(x^2+2xh+h^2+3x+3h+5)-(x^2+3x+5)}{h}\\&=\frac{2xh+h^2+3h}{h}=2x+h+3.\end{aligned}

At x = 1 and h = 0.5, the result is 2(1) + 0.5 + 3 = 5.5. The derivative is f′(x) = 2x + 3, so f′(1) = 5. The secant slope is not yet the tangent slope because the interval has positive length. As h approaches zero, the quotient 2x + h + 3 approaches 2x + 3.

More examples

Difference quotient examples for common functions

For a cubic function

For f(x) = x³, expanding (x + h)³ gives:

(x+h)3−x3h=3x2+3xh+h2\frac{(x+h)^3-x^3}{h}=3x^2+3xh+h^2

As h tends to zero, the terms containing h disappear and the quotient approaches 3x², the derivative of x³.

For a reciprocal function

For f(x) = 1/x, the endpoint values must both be defined. Simplifying the quotient gives:

1x+h−1xh=−1x(x+h),x≠0,  x+h≠0,  h≠0\frac{\frac{1}{x+h}-\frac{1}{x}}{h}=-\frac{1}{x(x+h)},\qquad x\ne0,\;x+h\ne0,\;h\ne0

The restrictions matter: neither endpoint may be zero, and h itself cannot be zero. These domain conditions remain important even after algebraic cancellation.

For a square-root function

For f(x) = √x, rationalizing the numerator produces a useful simplified form:

x+h−xh=1x+h+x\frac{\sqrt{x+h}-\sqrt{x}}{h}=\frac{1}{\sqrt{x+h}+\sqrt{x}}

For real outputs, both x and x + h must be nonnegative. The simplified expression also shows why the derivative at x = 0 needs separate care: the denominator tends to zero as the interval approaches the endpoint.

Connection to calculus

How the difference quotient becomes a derivative

The derivative is the limit of the difference quotient as the interval length approaches zero:

f′(x)=lim⁡h→0f(x+h)−f(x)hf'(x)=\lim_{h\to0}\frac{f(x+h)-f(x)}{h}

The quotient is undefined at h = 0 because it divides by zero. Instead, simplify the expression while h is nonzero, then take the limit. For f(x) = x², the quotient simplifies to 2x + h. Its limit is 2x. This is the derivative defined from first principles.

A two-sided derivative requires the left-hand and right-hand limits to agree. At a corner, cusp, jump, or vertical tangent, the limit may fail to exist or may be infinite. For example, f(x) = |x| has different one-sided slopes at x = 0, so it has no ordinary derivative there even though its difference quotient can be calculated for every nonzero h.

The displayed h table is a numerical illustration, not a proof of a limit. Floating-point rounding and domain restrictions can affect the last digits, especially when h is very small. The exact symbolic simplification for supported polynomials is often the clearest way to see the limiting behavior.

Reading the result

Average rate of change versus instantaneous rate

The calculated difference quotient is an average rate across an interval. The derivative is an instantaneous rate at one input. In geometry, the first is the slope of a secant line through two curve points; the second is the slope of the tangent line as the secant’s endpoints come together.

This distinction also appears in applications. Average velocity over a time interval is total displacement divided by elapsed time. Instantaneous velocity is the limit of that average as the time interval shrinks. Likewise, an average cost change compares two production levels, while a marginal cost describes the local rate of change at one level.

Changing the sign of h changes which side of x the second point lies on. For a smooth function, the left and right secant slopes approach the same derivative. If they approach different values, the derivative does not exist at that point.

Accuracy notes

Common difference quotient mistakes

  • Substituting x + h incorrectly: replace every x in f(x), and preserve grouping with parentheses. For example, x² becomes (x + h)², not x² + h.
  • Subtracting only part of f(x): use parentheses around the entire original function before distributing the minus sign.
  • Setting h to zero too early: the quotient is undefined at h = 0. Simplify first, then evaluate the limit.
  • Dropping domain restrictions: canceled factors do not make a function defined at excluded inputs.
  • Calling the finite quotient a derivative: it is an average rate for nonzero h. The derivative is the limit as h approaches zero.
  • Rounding too soon: retain enough precision during numeric evaluation and round only when reporting the final approximation.
Quick answers

Difference quotient calculator FAQ

What does a difference quotient calculate?

It calculates the average rate of change of f over the interval from x to x + h. Geometrically, that is the slope of the secant line connecting the two corresponding points on the graph.

Can h equal zero?

No. The quotient divides by h, so h must be nonzero. To find a derivative, simplify the quotient and take its limit as h approaches zero.

Does this calculator simplify the answer algebraically?

Yes, for supported polynomial expressions in x with nonnegative integer powers. Other supported functions, including trigonometric and logarithmic functions, can be evaluated numerically at x and x + h; a general symbolic simplifier for every function form is not claimed.

Why can the quotient differ from f′(x)?

The quotient measures change over a finite interval. f′(x) is the limiting slope at the starting point. Their values become closer as h approaches zero when the function is differentiable there.

Can I use a negative h?

Yes. A negative h places x + h to the left of x. The quotient remains valid if h is nonzero and the function is defined at both inputs.

What if the function is undefined at x or x + h?

The quotient cannot be evaluated for that pair of inputs. Check the function’s domain and choose values for which both endpoint function values exist.