Skip to content

Difference Quotient Calculator

Compute [f(a+h) – f(a)]/h for any function with this live difference quotient calculator. Includes the formula, worked examples, and derivative approximation.

[f(a+h) − f(a)] / hLive as you typeCompares with f′(a)AI step-by-step

Difference Quotient Calculator

\( \dfrac{f(a+h) – f(a)}{h} \)

Enter a function of x, a point a, and a step size h. The calculator returns the difference quotient and an approximation of \( f'(a) \).

Use x, + - * /, ^ for powers, and sqrt(x), sin(x), cos(x), ln(x), exp(x), abs(x).
Where to evaluate the difference quotient.
Smaller h gives a closer approximation to f′(a).

Explain the steps

Run the calculator, then get the full working behind your result: each step, why it works, and an independent check.

The difference quotient measures how a function changes between two points. It’s the formula \( \dfrac{f(a+h) – f(a)}{h} \), and it sits between algebra and calculus — once you understand it, derivatives stop feeling mysterious.

The formula

Given a function \( f \) and a point \( a \), the difference quotient with step \( h \) is:

$$DQ(a, h) = \dfrac{f(a + h) – f(a)}{h}$$

Geometrically, this is the slope of the secant line connecting two points on the graph of \( f \): the point \( (a, f(a)) \) and the point \( (a+h, f(a+h)) \). The numerator is the rise. The denominator is the run. Dividing them gives the average rate of change of \( f \) over the interval from \( a \) to \( a+h \).

As \( h \) shrinks toward zero, the secant line rotates and approaches the tangent line at \( a \), and the difference quotient approaches the derivative \( f'(a) \). That limit is the definition of the derivative:

$$f'(a) = \lim_{h \to 0} \dfrac{f(a + h) – f(a)}{h}$$

How to compute the difference quotient by hand

The mechanical steps work for any function, but the algebra is cleanest on polynomials.

  • Substitute a + h into f. Wherever you see x in the function, replace it with the expression a + h.
  • Subtract f(a). Compute f(a) and subtract it from f(a + h). Most algebraic terms cancel for polynomials.
  • Divide by h. Factor h out of every remaining term in the numerator, then cancel against the denominator. If you can’t factor h cleanly, you’ve made an algebra mistake earlier.
  • Simplify what’s left. The result should be an expression in a and h. As h goes to 0, only terms without h survive — those terms equal f′(a).

Worked example: \( f(x) = x^2 \)

Substitute: \( f(a + h) = (a + h)^2 = a^2 + 2ah + h^2 \). Subtract \( f(a) = a^2 \). Numerator: \( 2ah + h^2 \). Factor \( h \): \( h(2a + h) \). Divide by \( h \): \( 2a + h \). As \( h \to 0 \), the result is \( 2a \), which matches the standard derivative \( f'(x) = 2x \).

Worked example: \( f(x) = 1/x \)

Substitute: \( f(a + h) = \dfrac{1}{a + h} \). Subtract \( f(a) = \dfrac{1}{a} \). Common denominator: \( \dfrac{a – (a + h)}{a(a + h)} = \dfrac{-h}{a(a + h)} \). Divide by \( h \): \( \dfrac{-1}{a(a + h)} \). As \( h \to 0 \), the denominator becomes \( a^2 \), so \( f'(a) = -\dfrac{1}{a^2} \). Matches the derivative of \( 1/x \).

Worked examples table

Numerical results from the calculator above for common functions, paired with the symbolic derivative each one converges to.

FunctionInputsDifference quotientTrue \( f'(a) \)
\( f(x) = x^2 \)\( a = 2,\ h = 0.001 \)\( \frac{2.001^2 – 2^2}{0.001} = 4.001 \)\( 4 \) (= \( 2a \))
\( f(x) = 3x + 5 \)\( a = 7,\ h = 0.5 \)\( \frac{(3 \cdot 7.5 + 5) – (3 \cdot 7 + 5)}{0.5} = 3 \)\( 3 \) (constant slope)
\( f(x) = x^3 \)\( a = 1,\ h = 0.0001 \)\( \frac{1.0001^3 – 1^3}{0.0001} \approx 3.00030001 \)\( 3 \) (= \( 3a^2 \))
\( f(x) = \sqrt{x} \)\( a = 4,\ h = 0.0001 \)\( \frac{\sqrt{4.0001} – \sqrt{4}}{0.0001} \approx 0.249998 \)\( 0.25 \) (= \( 1/(2\sqrt{a}) \))
\( f(x) = \sin x \)\( a = 0,\ h = 0.0001 \)\( \frac{\sin(0.0001) – 0}{0.0001} \approx 0.999999998 \)\( 1 \) (= \( \cos 0 \))
Difference quotient for common functions. As \( h \) shrinks, the result approaches \( f'(a) \).

Difference quotient vs. derivative

They’re closely related, but not the same.

  • The difference quotient is a number for any specific h > 0. It’s defined for any two points on f and represents the average rate of change.
  • The derivative is the limit of the difference quotient as h goes to zero. It exists only when that limit exists (most smooth functions, but not at corners or cusps).
  • Numerical use: if you can’t differentiate f symbolically (an experimental dataset, a black-box function), the difference quotient with small h gives a usable derivative estimate.
  • Symbolic use: the difference quotient is the algebraic ladder you climb to derive f′(x) from first principles in calculus.

Forward, backward, and central difference quotients

The standard formula \( \dfrac{f(a+h) – f(a)}{h} \) is the forward difference quotient. Two close cousins show up in numerical methods:

  • Backward difference: \( \dfrac{f(a) – f(a – h)}{h} \). Same accuracy as forward; useful when \( f \) is only defined for \( x \leq a \).
  • Central difference: \( \dfrac{f(a + h) – f(a – h)}{2h} \). Uses points on both sides of \( a \). Significantly more accurate than forward or backward at the same \( h \). The calculator above reports this as the \( f'(a) \) approximation.

If you need a derivative estimate from data, prefer the central difference. Its error decreases as \( h^2 \) (instead of \( h \)), so a step of \( 0.001 \) gives derivative accuracy comparable to a forward step of \( 0.000001 \).

Common mistakes

Forgetting parentheses around \( (a + h) \). Writing \( f(a + h) = a^2 + h^2 \) for \( f(x) = x^2 \) is wrong because \( (a + h)^2 = a^2 + 2ah + h^2 \). Always wrap \( a + h \) in parentheses before substituting.
Cancelling \( h \) before factoring. The \( h \) in the denominator can only cancel after you’ve factored \( h \) out of every term in the numerator. Cancel only with the factored expression, never term-by-term.
Setting \( h = 0 \) too early. The difference quotient is undefined at \( h = 0 \) (division by zero). The derivative is the limit as \( h \to 0 \), which is something you take after you’ve simplified.
Using \( h \) that’s too small in numerical work. For floating-point arithmetic, \( h \) below \( \sim 10^{-8} \) amplifies round-off error and makes the estimate worse, not better. The sweet spot is around \( 10^{-4} \) to \( 10^{-6} \).

Useful calculus books and tools

For a difference quotient, simplify symbolically before substituting a small value for the increment. Calculus answers are easier to trust when you can connect the symbolic work to a graph, an estimate, and the theorem behind the method.

As an Amazon Associate, I earn from qualifying purchases.

Frequently asked questions

The difference quotient is the formula \( \dfrac{f(a+h) – f(a)}{h} \). It measures the average rate of change of a function \( f \) over an interval of length \( h \) starting at the point \( a \). As \( h \) shrinks toward zero, the difference quotient becomes the derivative \( f'(a) \).

The derivative is the limit of the difference quotient as \( h \to 0 \): \( f'(a) = \lim_{h \to 0} \dfrac{f(a+h) – f(a)}{h} \). The difference quotient is the geometric secant-line slope between two points on \( f \); the derivative is the tangent-line slope at a single point.

For a polynomial like \( f(x) = x^2 \), expand \( f(a+h) = (a+h)^2 = a^2 + 2ah + h^2 \). Subtract \( f(a) = a^2 \) to get \( 2ah + h^2 \). Divide by \( h \) to get \( 2a + h \). The \( h \) cancels cleanly, leaving an expression you can evaluate at any \( a \).

For \( f(x) = x^2 \), the difference quotient is \( \dfrac{(a+h)^2 – a^2}{h} = \dfrac{2ah + h^2}{h} = 2a + h \). As \( h \to 0 \), this becomes \( 2a \), which is the well-known derivative \( f'(x) = 2x \).

For \( f(x) = x^3 \), the difference quotient simplifies to \( 3a^2 + 3ah + h^2 \). As \( h \to 0 \), the \( 3ah \) and \( h^2 \) terms vanish, leaving \( 3a^2 \). That matches \( f'(x) = 3x^2 \) for the cubic.

The difference quotient is the slope of a secant line through \( (a, f(a)) \) and \( (a+h, f(a+h)) \). As \( h \) shrinks, the second point slides toward the first, and the secant rotates into the tangent. In floating-point, however, \( h \) that is too small (below \( \sim 10^{-8} \)) introduces round-off error and the estimate gets worse, not better.

Yes. A negative difference quotient means \( f \) is decreasing over the interval \( [a, a+h] \). The sign of the difference quotient at a point matches the sign of \( f'(a) \) for a smooth function: positive means rising, negative means falling, zero means a local flat point.

For numerical estimates, \( h = 0.001 \) or \( h = 0.0001 \) is a good default — small enough to closely approximate \( f'(a) \), large enough to avoid floating-point round-off. The calculator on this page also returns a central-difference estimate, which uses \( h \) on both sides of \( a \) and is typically two orders of magnitude more accurate than the forward difference.