Difference Quotient Calculator
Type a polynomial in one variable, such as x^2 + 3x + 5, and the calculator substitutes x + h into it exactly as you typed it, expands each power with its binomial coefficients, cancels f(x), divides every remaining term by h and states that h ≠ 0. Fractions and decimals in the coefficients stay exact. Switch h to a number to substitute it from the first step, or give a value of x to evaluate the quotient; with both, you also get the two points, the secant slope worked out again from f at each end, the same slope from the swapped endpoints and a secant diagram. The steps copy as plain text or LaTeX, and the diagram downloads as an SVG.
Your input
Example input
Step h
Use numbers, x, + - * / ^ and brackets: 2x means 2 times x, and x² or x^2 both work. Division is by numbers only. Up to 2000 characters in f, h and x, and 100 digits in each number. h and x take whole numbers, decimals or fractions such as 1/3.
Result
[f(x + h) - f(x)]/h
2x + h + 3, h ≠ 0
At x = 1, h = 2: 7
Text equivalent: Secant diagram for f(x) = x² + 3x + 5 with x = 1 and h = 2: points (1, 9) and (3, 23) joined by a secant of slope 7. The run is h = 2 and the rise f(x + h) - f(x) is 14.
The fields hold a worked example. Type your own polynomial in f to replace it.
- f(x + h)
- x² + 2xh + h² + 3x + 3h + 5
- f(x + h) - f(x)
- 2xh + h² + 3h
- Quotient
- 2x + h + 3, h ≠ 0
- At x = 1, h = 2
- 7
Step by step
Each line follows from the one before it with exact fractions. The two-point check and the swap appear when both a value of x and a numeric h are given.
| Step | Working |
|---|---|
| Function | f(x) = x² + 3x + 5 |
| Substitute x + h for x | f(x + h) = (x + h)² + 3(x + h) + 5 |
| Expand (x + h)² | (x + h)² = x² + 2xh + h² |
| Multiply out and collect like terms | f(x + h) = x² + 2xh + h² + 3x + 3h + 5 |
| Subtract f(x) | f(x + h) - f(x) = (x² + 2xh + h² + 3x + 3h + 5) - (x² + 3x + 5) |
| Cancel the terms without h, which are f(x) | f(x + h) - f(x) = 2xh + h² + 3h |
| Divide each term by h | (2xh + h² + 3h)/h = 2xh/h + h²/h + 3h/h = 2x + h + 3 |
| Restriction | h ≠ 0: at h = 0 the quotient is 0/0 and undefined, even though 2x + h + 3 has a value there |
| Evaluate at x = 1, h = 2 | 2(1) + (2) + 3 = 7 |
| Check with the two points | (f(3) - f(1))/2 = (23 - 9)/2 = 7 |
| Swap the endpoints | x = 3, h = -2: (f(1) - f(3))/(-2) = (9 - 23)/(-2) = 7, the same secant slope |
Worked examples
Common questions
- What is the difference quotient?
- (f(x + h) - f(x))/h is the slope of the secant line through the points (x, f(x)) and (x + h, f(x + h)). For a polynomial, f(x) cancels out of f(x + h) - f(x), every remaining term contains h, and dividing by h leaves a polynomial in x and h. For f(x) = x² + 3x + 5 the result is 2x + h + 3, and for f(x) = x³ it is 3x² + 3xh + h².
- Why does the answer say h ≠ 0?
- The quotient divides by h, so at h = 0 it becomes 0/0 and has no value. The simplified polynomial, such as 2x + h + 3, does have a value at h = 0, but that value belongs to the polynomial, not to the quotient. That is why typing 0 for h is refused. Letting h approach 0 is a limit, which this calculator does not take or prove.
- How do I type the function?
- Use numbers, the variable letter, + - * / ^ and brackets. 2x means 2 times x, x^2 and x² both work, and a pasted f(x) = naming the variable in use, or y =, is ignored. Coefficients can be fractions such as (1/2)x^2 or decimals such as 0.5x^2, and division must be by a number. Products and powers such as (x + 1)^3 or x(x - 2) are multiplied out, and when the typed form differs from the standard form the steps show both. The degree can be 0 to 20, the variable is a single letter other than h, the f, h and x fields each hold up to 2000 characters, and each typed number and each coefficient once multiplied out can have up to 100 digits.
- What is the difference between symbolic h and numeric h?
- Symbolic h keeps h as a letter, so the quotient is a polynomial in x and h. Numeric h substitutes your value, such as 2 or -1/2, from the first step: f(x + 2) is expanded, the like terms are subtracted, and the quotient is a polynomial in x alone. In symbolic mode you can still type a number for h to evaluate the quotient, and together with a value of x it draws the diagram.
- What do the check and swap lines show?
- With a value of x and a numeric h, the calculator works out f at both ends, the slope (f(x + h) - f(x))/h from those two values, and the same slope from the other end, starting at x + h with step -h. For f(x) = x² at x = 1 and h = -2 both give 0. The Swap endpoints button rewrites the x and h fields to that other end, and the slope stays the same.
- Are the results exact?
- The algebra is exact: every coefficient and value is a fraction of whole numbers and is never rounded. A value that is not a whole number is shown as a fraction followed by its decimal: after = when the decimal is exact, or after ≈ when it is rounded to 10 significant digits. Only the diagram uses floating point, to place the points on screen; values too large to plot, such as x^20 at x = 10^40, get no diagram while the exact figures stay in the steps.
- What can I copy or download?
- Copy LaTeX gives an aligned block from f(x) through the quotient, plus its value when you give one. Copy steps gives the result and every step as plain text. Download SVG saves the secant diagram with its text description inside the file. A draft you edit is remembered in this browser, and loading an example does not overwrite it.
Polynomial algebra only: no general transcendental simplification or automatic limit proof. h = 0 is undefined for the quotient even when its cancelled polynomial has a continuous extension. Numeric evaluation uses exact fractions before displayed rounding.