Differentiation from first principles

Every curve has a slope that keeps changing as you move along it — unlike a straight line, there is no single number that describes it everywhere. Differentiation from first principles is the method that pins down the slope at one exact point: freeze that point, take a second point a tiny distance hh away, measure the slope of the chord joining them, and then watch what that chord-slope settles to as hh shrinks to zero. That settling value is the derivative, f′(x)f'(x), built directly from the limit definition rather than from any memorised rule. It underlies every rate of change you will meet later — velocity, growth rates, marginal cost — and every rule (power, product, quotient) you will soon be allowed to use as a shortcut is itself proved by this same limit process.

The core insight

The derivative f′(x)=lim⁡h→0f(x+h)−f(x)hf'(x)=\lim_{h\to 0}\dfrac{f(x+h)-f(x)}{h} is the limiting slope of the chord from xx to x+hx+h as h→0h\to 0, giving the tangent slope and the instantaneous rate of change at xx.

The core idea

Take a function y=f(x)y = f(x) and a fixed point xx on its graph. Step a small distance hh along the axis to the nearby point x+hx+h. The two points (x,f(x))(x, f(x)) and (x+h,f(x+h))(x+h, f(x+h)) determine a straight secant line (a chord), and the average rate of change of ff over that interval is simply its slope:

slope of chord=f(x+h)−f(x)h\text{slope of chord} = \frac{f(x+h)-f(x)}{h}

where: f(x+h)−f(x)f(x+h)-f(x) is the change in the function's value (rise) and hh is the change in xx (run). As hh shrinks toward zero, the second point slides back along the curve toward the first, and the chord rotates until it hugs the curve at xx — becoming the tangent line. The slope of that tangent is the derivative:

f′(x)=lim⁡h→0f(x+h)−f(x)hf'(x) = \lim_{h\to 0}\frac{f(x+h)-f(x)}{h}

where: f′(x)f'(x), also written dydx\dfrac{dy}{dx}, is the derivative of ff at xx, and the limit is taken as hh tends to 00 without ever equalling it. This one expression carries two readings used throughout the chapter. Geometrically, f′(x)f'(x) is the slope of the tangent to y=f(x)y=f(x) at xx. As a rate of change, if s(t)s(t) is distance travelled at time tt, then s′(t)s'(t) is instantaneous velocity — the limit of average velocity s(t+h)−s(t)h\dfrac{s(t+h)-s(t)}{h} as the time interval hh shrinks to zero.

Figure
A curve with a fixed point and a second point at h away joined by a chord that rotates to become the tangent line as h shrinks toward zero
Chord slope approaches tangent slope as h shrinks to zero x , f(x) x+h , f(x+h) — far x+h — near tangent as h to 0 Chord slope = f(x+h) - f(x) over h ; tangent slope = f prime of x

Finding f′(x)f'(x) "from first principles" always follows the same four-step routine: write f(x+h)f(x+h) by substituting (x+h)(x+h) for xx; form the difference quotient f(x+h)−f(x)h\dfrac{f(x+h)-f(x)}{h} and simplify its numerator; cancel the common factor of hh (this is what resolves the 00\tfrac{0}{0} form, since both the numerator and hh tend to zero together); then let h→0h\to 0 in the simplified expression. It helps to notice why the 00\tfrac{0}{0} form is unavoidable rather than a sign of a mistake. As h→0h\to 0, the second point x+hx+h slides back onto the first point xx, so the numerator f(x+h)−f(x)f(x+h)-f(x) shrinks to 00 at the same time as the denominator hh shrinks to 00 — direct substitution can never work here. The whole point of the algebra in Steps 1 and 2 is to rewrite the quotient in a form where the troublesome factor of hh is visibly cancelled before the limit is taken, leaving an expression that behaves well at h=0h=0. This is exactly the same idea used earlier in the chapter when evaluating other 00\tfrac{0}{0} limits by factorising or rationalising first; differentiation from first principles is simply that technique applied to one very specific, recurring limit.

Derivation ADerivative of x2+3xx^2 + 3x from the limit definition

Starting from the general definition f′(x)=lim⁡h→0f(x+h)−f(x)hf'(x)=\lim_{h\to 0}\dfrac{f(x+h)-f(x)}{h}, derive the derivative of the polynomial f(x)=x2+3xf(x) = x^2 + 3x by expanding, simplifying, cancelling hh, and taking the limit, ending with the closed-form result f′(x)=2x+3f'(x) = 2x + 3.

Step 1. Write f(x+h)f(x+h) by replacing every xx in f(x)=x2+3xf(x)=x^2+3x with (x+h)(x+h):

f(x+h)=(x+h)2+3(x+h)=x2+2xh+h2+3x+3hf(x+h) = (x+h)^2 + 3(x+h) = x^2 + 2xh + h^2 + 3x + 3h

Step 2. Form the difference f(x+h)−f(x)f(x+h) - f(x) and simplify — the x2x^2 and 3x3x terms cancel between the two brackets:

f(x+h)−f(x)=(x2+2xh+h2+3x+3h)−(x2+3x)=2xh+h2+3hf(x+h)-f(x) = \left(x^2+2xh+h^2+3x+3h\right) - \left(x^2+3x\right) = 2xh+h^2+3h

Step 3. Divide by hh to form the difference quotient, then factor hh out of the numerator and cancel it, valid because h≠0h\neq 0 while the limit is being approached:

f(x+h)−f(x)h=2xh+h2+3hh=h(2x+h+3)h=2x+h+3\frac{f(x+h)-f(x)}{h} = \frac{2xh+h^2+3h}{h} = \frac{h(2x+h+3)}{h} = 2x+h+3

Step 4. Let h→0h\to 0 in the simplified expression, which is now a plain polynomial in hh with no division left, so the limit is found by direct substitution:

f′(x)=lim⁡h→0(2x+h+3)=2x+3f'(x) = \lim_{h\to 0}(2x+h+3) = 2x+3

The result f′(x)=2x+3f'(x) = 2x+3 matches what the power and sum shortcut rules give directly (ddxx2=2x\frac{d}{dx}x^2=2x, ddx(3x)=3\frac{d}{dx}(3x)=3), confirming that first-principles differentiation and the later shortcut rules always agree.

Worked example

Find the derivative of f(x)=sin⁡xf(x) = \sin x from first principles.

Step 1. Form the difference quotient directly from the definition:

f(x+h)−f(x)h=sin⁡(x+h)−sin⁡xh\frac{f(x+h)-f(x)}{h} = \frac{\sin(x+h)-\sin x}{h}

Step 2. Simplify the numerator using the sum-to-product identity sin⁡A−sin⁡B=2cos⁡ ⁣(A+B2)sin⁡ ⁣(A−B2)\sin A - \sin B = 2\cos\!\left(\dfrac{A+B}{2}\right)\sin\!\left(\dfrac{A-B}{2}\right) with A=x+hA = x+h, B=xB = x:

sin⁡(x+h)−sin⁡x=2cos⁡ ⁣(x+h2)sin⁡ ⁣(h2)\sin(x+h)-\sin x = 2\cos\!\left(x+\frac{h}{2}\right)\sin\!\left(\frac{h}{2}\right)

So the quotient becomes, after dividing numerator and denominator by 22 to match the standard limit shape:

f(x+h)−f(x)h=cos⁡ ⁣(x+h2)⋅sin⁡(h/2)h/2\frac{f(x+h)-f(x)}{h} = \cos\!\left(x+\frac{h}{2}\right)\cdot\frac{\sin(h/2)}{h/2}

Step 3. Let h→0h\to 0, using the standard trigonometric limit lim⁡h→0sin⁡(h/2)h/2=1\lim_{h\to 0}\dfrac{\sin(h/2)}{h/2}=1 and cos⁡ ⁣(x+h2)→cos⁡x\cos\!\left(x+\dfrac{h}{2}\right)\to\cos x:

f′(x)=cos⁡x⋅1=cos⁡xf'(x) = \cos x \cdot 1 = \cos x

So ddx(sin⁡x)=cos⁡x\dfrac{d}{dx}(\sin x) = \cos x, obtained purely from the limit definition, with no shortcut rule used at any step. The final answer is f′(x)=cos⁡x\boxed{f'(x) = \cos x}.

Competitive stretch

The same sum-to-product route, applied to g(x)=cos⁡xg(x) = \cos x, gives g(x+h)−g(x)=−2sin⁡ ⁣(x+h2)sin⁡ ⁣(h2)g(x+h)-g(x) = -2\sin\!\left(x+\dfrac{h}{2}\right)\sin\!\left(\dfrac{h}{2}\right), and dividing by hh and letting h→0h\to 0 produces g′(x)=−sin⁡xg'(x) = -\sin x. Recognising this mirror pattern — sine differentiates to cosine, cosine differentiates to negative sine — saves time in multi-part exam questions that ask for both from first principles. The minus sign is easy to lose under exam pressure, so it is worth double-checking the sum-to-product identity for cosine, cos⁡A−cos⁡B=−2sin⁡ ⁣(A+B2)sin⁡ ⁣(A−B2)\cos A-\cos B = -2\sin\!\left(\dfrac{A+B}{2}\right)\sin\!\left(\dfrac{A-B}{2}\right), term by term before dividing through by hh.

Common traps

  • Substituting h=0h=0 straight into f(x+h)−f(x)h\dfrac{f(x+h)-f(x)}{h} before simplifying — this always gives 00\tfrac{0}{0}, since f(x+h)−f(x)→0f(x+h)-f(x)\to 0 and h→0h\to 0 together; the algebra must simplify the quotient first.
  • Expanding (x+h)2(x+h)^2 or sin⁡(x+h)\sin(x+h) incorrectly at Step 1 — a single sign or term error there propagates through every later step, so each expansion should be checked term by term.
  • Treating hh as though it equals zero during the cancellation step — hh is never actually zero while the quotient is being formed; it only tends to zero in the final limit taken afterward.
  • Jumping straight to a memorised shortcut (writing ddxx2=2x\frac{d}{dx}x^2=2x with no limit work shown) when a question explicitly asks "from first principles" — full marks require every one of the four steps to appear.

Ask the tutor: want to work through the first-principles derivative of f(x)=x3f(x)=x^3 or f(x)=cos⁡xf(x)=\cos x step by step with your AI tutor?

Why do we need first principles at all once we have the power rule and other shortcuts?

The shortcut rules are themselves proved using the first-principles limit — someone has to justify why ddxxn=nxn−1\frac{d}{dx}x^n = nx^{n-1} works, and that justification is exactly this four-step process. Exam questions that say "from first principles" are testing whether you understand the definition behind the shortcuts, not just whether you can apply them, so the full limit argument must be shown even though the shortcut would give the same answer instantly.

What if the h in the denominator does not cancel out cleanly?

For every polynomial and the standard trigonometric functions on this syllabus, the numerator f(x+h)−f(x)f(x+h)-f(x) always contains a common factor of hh once fully expanded and simplified, precisely because f(x+h)−f(x)→0f(x+h)-f(x)\to 0 as h→0h\to 0. If your working leaves an hh stuck in the denominator with no cancellation, go back and recheck the expansion in Step 1 or the algebra in Step 2 — a term has usually been dropped or mis-expanded.

Is the derivative the same thing as the tangent line itself?

No — the derivative f′(x)f'(x) is a single number (the slope) at a chosen point xx, not the whole line. The tangent line itself is built from that slope together with the point (x,f(x))(x, f(x)) it passes through, using the point-slope form y−f(x)=f′(x)(x0−x)y - f(x) = f'(x)(x_0 - x). First-principles differentiation gives you the slope; forming the tangent line is a separate, later step.

Before this

Where this leads