acalculator

What is the difference quotient of f?

Type a function of x. The page writes f(x + h), forms the difference quotient (f(x + h) − f(x))/h, simplifies it so the h in the bottom cancels, and gives its limit f′(x).

Your numbers

Use x, + - * / ^, pi, e, sqrt, ln, sin, cos, tan.
(f(x + h) − f(x))/h =
h + 2x + 3

The difference quotient of x^2 + 3x - 4 is h + 2x + 3.

f(x + h) =
(x + h)^2 + 3 (x + h) - 4
f′(x) =
2x + 3

(f(x + h) − f(x))/h =: h + 2x + 3. The difference quotient of x^2 + 3x - 4 is h + 2x + 3.

How to calculate

Finds and simplifies the difference quotient (f(x + h) − f(x))/h of a function, and its limit f′(x) as h → 0.

Example with the default inputs (Function f(x) x^2 + 3x - 4): The difference quotient of x^2 + 3x - 4 is h + 2x + 3.

Method: (f(x + h) − f(x))/h, with f(x + h) − f(x) written as one fraction and its top expanded so the h cancels.

  • h ≠ 0. The variable is x; angles in radians.
  • An answer that fails its check is not shown.

Machine-readable copies: Markdown, JSON.

Worked examples

Each example is checked against the calculator on every build.

  1. Function f(x) x^2 + 3x - 4 gives (f(x + h) − f(x))/h = h + 2x + 3, f′(x) = 2x + 3.Source: https://openstax.org/books/college-algebra-2e/pages/3-1-functions-and-function-notation
  2. Function f(x) 1/x gives (f(x + h) − f(x))/h = -1/(x (h + x)), f′(x) = -1/x^2.
  3. Function f(x) 3x^2 - 4x + 1 gives (f(x + h) − f(x))/h = 3h + 6x - 4, f′(x) = 6x - 4.

How it works

For f(x), the page computes:

  1. f(x + h): every x in f replaced by (x + h).
  2. f(x + h) − f(x) written as one fraction p/q: each sum of fractions is put over the product of the denominators, and a whole-number power of a fraction is the power of its top over the power of its bottom. Other functions (sqrt, ln, sin) are kept whole.
  3. p/h expanded by a computer algebra system (nerdamer, open source) in h, with x held constant. When every term of p has a factor h, it cancels.
  4. The quotient is that expansion over q. It is shown only when it equals (f(x + h) − f(x))/h at 15 test points in x and h (to 10⁻⁹), and has a value at h = 0 wherever f has one at the test points (so the h really cancelled). Otherwise the page shows (f(x + h) − f(x))/h as written.
  5. f′(x), the limit as h → 0, from the algebra’s derivative, checked against a numeric difference quotient.

Terms are written with powers of the letters first, highest total degree first, then by powers of h and x in that order; a constant comes last. h ≠ 0 throughout. Angles are in radians.

Worked examples by hand

f(x) = x² + 3x − 4 (OpenStax College Algebra 2e, Example 6(d), with a for x). f(x + h) − f(x) = (x² + 2xh + h² + 3x + 3h − 4) − (x² + 3x − 4) = 2xh + h² + 3h. Dividing by h gives h + 2x + 3, and f′(x) = 2x + 3.

f(x) = 1/x (OpenStax Calculus Volume 1, Example 3.3). 1/(x + h) − 1/x = −h/(x(x + h)), so the quotient is −1/(x (h + x)) and f′(x) = −1/x² (at x = 2, −1/4).

f(x) = 3x² − 4x + 1 (Examples 3.5 and 3.6). f(x + h) − f(x) = 6xh + 3h² − 4h, so the quotient is 3h + 6x − 4 and f′(x) = 6x − 4 (at x = 2, 8).

Other questions people ask

What is the difference quotient?

For a function f and a step h ≠ 0, the difference quotient is (f(x + h) − f(x))/h. It is the slope of the secant line through (x, f(x)) and (x + h, f(x + h)), the average rate of change of f over that step.

How do I simplify a difference quotient?

Write f(x + h), subtract f(x), combine everything over one denominator, expand the top, and cancel the factor h. For f(x) = x² + 3x − 4: f(x + h) − f(x) = 2xh + h² + 3h = h(2x + h + 3), so the quotient is 2x + h + 3.

How is the difference quotient related to the derivative?

The derivative is its limit: f′(x) = lim_{h→0} (f(x + h) − f(x))/h. Once the h has cancelled, put h = 0: 2x + h + 3 gives f′(x) = 2x + 3.

How do I handle a fraction such as 1/x?

Put the two fractions over a common denominator: 1/(x + h) − 1/x = (x − (x + h))/(x(x + h)) = −h/(x(x + h)). Dividing by h gives −1/(x(x + h)), whose limit as h → 0 is −1/x².

Why does the page not simplify the quotient of sqrt(x)?

The top √(x + h) − √x has no factor h after expanding; a textbook multiplies by the conjugate √(x + h) + √x to get 1/(√(x + h) + √x). The page shows the quotient as written in such cases, and still gives f′(x) from the algebra.

What is the difference quotient with a in place of x?

It is the same expression at a fixed point a: (f(a + h) − f(a))/h. Put a in place of x in the answer: for x² + 3x − 4 it is 2a + h + 3.