Skip to main content
Mathovia

Math / Algebra

Difference Quotient Calculator

Type a function and the calculator finds f(x + h), subtracts f(x), divides by h and simplifies, showing each line of working. Pick an x and an h to see the secant line whose slope the difference quotient measures.

Use ^ for powers (x^2), / for fractions and sqrt( ) or √ for square roots. Polynomials, rational functions and square roots of linear expressions are simplified exactly.

Difference quotient of f(x) = 3x² − x

[f(x + h) − f(x)] / h = 6x + 3h − 1

As h → 0 f′(x) = 6x − 1

01230102030xx + h

f(x) secant line tangent line

At x = 1 and h = 1, the difference quotient is 8. That's the slope of the orange secant line through (x, f(x)) and (x + h, f(x + h)).

Make h smaller and the secant swings toward the grey tangent line, whose slope is f′(1) ≈ 5.

  1. Replace every x with (x + h)f(x + h) = 3(x + h)² − (x + h)
  2. Expand f(x + h)f(x + h) = 3x² + 6xh + 3h² − x − h
  3. Subtract f(x). Every term without an h cancelsf(x + h) − f(x) = 6xh + 3h² − h
  4. Divide every term by h(6xh + 3h² − h) / h = 6x + 3h − 1
Written by
MPhil in Mathematics, Founder of Mathovia
Published

Mathematics verification: Mathematical formulas, calculations, worked examples and solutions are reviewed for accuracy before publication. How we check our work

The difference quotient is the first place most students meet the idea behind calculus, usually a few weeks before anyone says the word “derivative”. The algebra isn’t hard, but it’s long, and one dropped minus sign wrecks the whole thing. This difference quotient calculator does the expansion and cancelling for you, shows every line so you can compare it with your own working, and draws the secant line the answer describes.

Difference quotient: f of x plus h, minus f of x, all divided by h, with h not equal to zero
The difference quotient of a function f

How to use the difference quotient calculator

  1. Type the function. Write powers with ^, so 3x^2 - x for . Fractions such as 1/x or 3/(x - 2) and roots such as sqrt(x) or √(2x + 1) work too, and you can leave f(x) = at the front.
  2. Read the simplified answer in the dark panel, in terms of and , with the derivative underneath.
  3. Follow the steps below the graph: substitute, expand, subtract, divide.
  4. Move the secant. Change the x and h boxes to slide the orange line along the curve. Shrink h to something like 0.01 and watch it settle onto the grey tangent line.

The difference quotient formula

The top, , is the change in output, the rise. The bottom, , is the change in input, the run. So the whole thing is rise over run between two points on the graph: an ordinary slope, written in a way that still works when the function isn’t a straight line. The difference quotient lesson goes through where it comes from in more detail.

Worked example: f(x) = 3x² − x

This is the calculator’s opening example, and a typical homework problem.

Step 1 — find . Replace every with , brackets included:

Step 2 — expand. , so

Step 3 — subtract . The and the cancel, which is the check that you’re on track: every term left over should contain an .

Step 4 — divide by .

With x = 1 and h = 1, the calculator’s default secant, that’s . You can confirm it from the points themselves: and , and .

Fractions and square roots need a different trick

Expanding works for polynomials. For other functions, the job is the same, getting an into the numerator so it can cancel, but you need a different tool to do it.

Three cards: for the polynomial 3x² − x, expand f(x + h) to get 6xh + 3h² − h and the answer 6x + 3h − 1; for the rational function 1/x, use a common denominator to get −h over x(x + h) and the answer −1/(x(x + h)); for √x, multiply by the conjugate to get h over √(x + h) + √x and the answer 1/(√(x + h) + √x)
Each type of function has its own way of getting the h on top

A rational function: f(x) = 1/x

Subtract the two fractions over the common denominator :

Now dividing by just cancels it:

Leave the denominator factored. Multiplying it out to is correct but makes the next step, letting go to zero, harder to see.

A square root: f(x) = √x

Here there’s nothing to expand. Multiply the top and bottom by the conjugate, , and the difference of squares removes both roots from the numerator:

The same move is how you’d go about rationalizing a denominator, just applied to the top this time.

Evaluating the difference quotient at a point

Some problems give you numbers: “evaluate the difference quotient of at with .” You can do it two ways, and it’s worth doing both once to see that they agree.

From the points. and , so

From the formula. The simplified quotient is . Substituting gives .

The points method is quicker for a single pair of numbers. The formula pays off when you need several, say , and , because you simplify once and then just substitute. In the calculator, type the function, then put the numbers in the x and h boxes under the graph; the value appears beside it.

Difference quotients of common functions

Difference quotientAs

Notice the first row. For a straight line the vanishes completely, because a line has the same slope everywhere, so the interval you measure over doesn’t matter.

What the answer tells you

The difference quotient is the average rate of change of between and . Plug in numbers and you get the slope of one particular secant line, which is what the graph above the steps shows. If you only need that number for two specific inputs, the average rate of change calculator gets there quicker.

The real point of keeping as a letter is what happens when it gets small. Try x = 1 with h = 1, then 0.1, then 0.01 on : the slope goes 8, 5.3, 5.03, closing in on 5. That limit is the slope of the tangent line, . Every derivative rule you’ll learn in calculus is this process done once in general.

Common difference quotient mistakes

  • Writing instead of . For , , but . The goes inside, replacing every .
  • Dropping the brackets. is . Without the brackets you’d get , and the error carries all the way to the end.
  • Squaring term by term. is not ; the middle term is the one that matters most.
  • Dividing only one term by . Every term in the numerator gets divided, which is why the calculator shows the division as a whole fraction first.
  • Setting too early. Before simplifying, that gives . Simplify first, then let shrink.

When you’re ready to try some without help, the difference quotient practice problems check your simplified answers automatically, and they accept any equivalent form.

Frequently Asked Questions

How do you evaluate the difference quotient and simplify?+

Substitute x + h for every x to get f(x + h), subtract f(x), and simplify the numerator until every remaining term contains h. Then divide by h. For f(x) = x², that's (2xh + h²) ÷ h = 2x + h.

What does the difference quotient represent?+

It's the slope of the secant line through the points (x, f(x)) and (x + h, f(x + h)), which is the average rate of change of f over an interval of width h. As h shrinks to zero it becomes the slope of the tangent line, the derivative.

Why can't h be zero in the difference quotient?+

Because you would be dividing by zero. With h = 0 the two points on the graph are the same point, and one point doesn't define a slope. That's why you simplify first, so h no longer sits alone in the denominator, and only then think about h getting close to zero.

What is the difference quotient of 1/x?+

Over a common denominator, 1/(x + h) − 1/x = −h / [x(x + h)]. Dividing by h leaves −1/(x(x + h)). As h approaches 0 that becomes −1/x², the derivative of 1/x.

How do you find the difference quotient of a square root function?+

Multiply the top and bottom by the conjugate, √(x + h) + √x. The numerator becomes (x + h) − x = h, which cancels with the h underneath, leaving 1/(√(x + h) + √x).

Does the calculator give the derivative too?+

Yes. Under the main answer it sets h to 0 in the simplified quotient, which gives f′(x). For 3x² − x the quotient is 6x + 3h − 1 and the derivative is 6x − 1.

Learn and practice this topic

Related calculators