Skip to content
Calc.
calculusBy Emil BjörkMarch 21, 2026

Derivatives: How to Calculate the Slope of a Function at a Point

The derivative of a function at a point is its rate of change there: the slope of the tangent line. For a single power term f(x) = c·xⁿ + k the power rule gives it exactly, f'(x) = c·n·xⁿ⁻¹, and a finite-difference approximation gets close by measuring the slope across a tiny interval. This guide works both methods for f(x) = 3x² + 5 at x = 4, where each returns 24.

What a Derivative Is

Zoom in far enough on any smooth curve and it looks like a straight line; the steepness of that line is the derivative. A positive derivative means the function is rising, a negative one means it is falling, and zero marks a peak, a valley or a momentary flat spot.

Almost every applied model is a statement about rates. Velocity is the derivative of position and acceleration the derivative of velocity. Marginal cost is the derivative of total cost. An engineer sets a derivative to zero to find the design with the least material or the most strength. The derivative says not just where you are but where you are headed and how fast.

The Power Rule and the Numerical Alternative

For f(x) = c·xⁿ + k, the power rule gives the derivative exactly:

f'(x) = c · n · xⁿ⁻¹

Multiply the coefficient by the exponent, then reduce the exponent by one. The constant k disappears because a constant has zero rate of change. The rule holds for any real exponent, including negative and fractional powers.

When differentiating by hand is inconvenient, approximate the slope with a finite difference: take two points close together on the curve and compute the slope of the line between them. The forward difference uses the point and a neighbor a small step h ahead:

f'(x) ≈ [f(x + h) − f(x)] ÷ h

The central difference straddles the point and is usually more accurate:

f'(x) ≈ [f(x + h) − f(x − h)] ÷ (2h)

The forward difference has an error proportional to h; the central difference has an error proportional to h², so halving the step cuts its error by about four times.

A Worked Example

Find the derivative of f(x) = 3x² + 5 at x = 4.

Analytical (power rule). Here c = 3, n = 2 and k = 5.

1. Multiply coefficient by exponent: 3 × 2 = 6

2. Reduce the exponent by one: x² becomes x¹

3. So f'(x) = 6x, and at x = 4 that is 6 × 4 = 24

Numerical (central difference) with h = 0.001.

1. f(4.001) = 3 × 4.001² + 5 = 3 × 16.008001 + 5 = 53.024003

2. f(3.999) = 3 × 3.999² + 5 = 3 × 15.992001 + 5 = 52.976003

3. Slope ≈ (53.024003 − 52.976003) ÷ (2 × 0.001) = 0.048 ÷ 0.002 = 24

The central difference is exact here because the function is a parabola; its h² error term vanishes for quadratics. The forward difference with the same step gives (53.024003 − 53) ÷ 0.001 = 24.003, showing the first-order error.

The Derivative Calculator takes the coefficient, power, constant and evaluation point and returns the derivative by the method you choose: analytical (power rule), forward difference or central difference, both with a fixed step of h = 0.001. Its defaults are this example (3, 2, 5 and 4), so it opens on 24.

The derivative also gives the tangent line itself: through the point (4, f(4)) = (4, 53) with slope 24, it is y − 53 = 24(x − 4), or y = 24x − 43.

Using Derivatives, and Common Mistakes

Setting f'(x) = 0 locates turning points, which is how you find the price that maximizes profit or the angle that minimizes drag. Comparing the analytical and numerical results is also a quick check on hand work: if they disagree badly, there is an algebra slip somewhere.

Forgetting to drop the exponent. Writing the derivative of x² as 2x² instead of 2x is the most common error.

Mishandling constants. The additive constant k vanishes; a coefficient multiplying the variable does not.

Choosing h badly. Too large a step gives a crude approximation; an absurdly small one lets floating-point rounding dominate. A step around 0.001 is a reasonable default for everyday work.

Applying the rule beyond its scope. The power rule as shown covers a single power term. Sums of terms are differentiated term by term; products and compositions need the product and chain rules.

Differentiation has an inverse, integration, which can be approximated numerically in the same spirit by adding up thin strips under the curve. The Rectangular Rule Strip Area Calculator works out the area of one such strip, and the Rectangular Rule Integration guide explains the method.

Sources

Related articles

Looking for a calculator?

Calculator Collection has 1,550+ free calculators. Browse all calculators →