Differentiating From First Principles With Worked Examples
Follow a reliable four-step method for finding derivatives from the limit definition, worked through powers, fractions, roots and sine.
Key takeaways
- The definition is f′(x) = lim [f(x + h) − f(x)]/h as h → 0, when that limit exists.
- Substituting h = 0 at the start gives 0/0, so algebra must remove the factor of h first.
- Polynomials need expansion, fractions need a common denominator and square roots need a conjugate.
- Trigonometric and exponential functions rely on standard limits that are established separately.
- State any restrictions, such as x ≠ 0 or x > 0, alongside the result.
Differentiating from first principles means finding a derivative directly from its definition, without using any shortcut rule. You form the difference quotient, simplify it until the troublesome h cancels, and then take the limit as h approaches 0.
The method is slower than applying rules, but it is where the rules come from. Working a few examples shows you what a derivative is and gives you something to fall back on when a function fits no formula.
The four steps
For a function f and an input x in its domain:
- Write f(x + h). Replace every x in the formula with the whole expression x + h.
- Subtract f(x). Simplify. Terms without h should cancel completely.
- Divide by h. Factor h out of the numerator and cancel it, which is allowed since h ≠ 0.
- Take the limit as h → 0.
Keep "lim" written in front of each line until step 4. The quantity h is a small nonzero step, and x is held fixed while h moves. The meaning behind the quotient is explained in the derivative as a rate of change.
A useful checkpoint comes after step 2. If a term with no h survives the subtraction, there is an algebra error, usually a lost sign or a missing pair of parentheses.
Example 1: a square and a cube
Take f(x) = x².
f(x + h) = (x + h)² = x² + 2xh + h²
f(x + h) − f(x) = 2xh + h²
divided by h: 2x + h
limit: 2x Now take f(x) = x³. Expanding gives (x + h)³ = x³ + 3x²h + 3xh² + h³.
f(x + h) − f(x) = 3x²h + 3xh² + h³
divided by h: 3x² + 3xh + h²
limit: 3x² In both cases only one term survives the limit: the one that had exactly a single factor of h before division. The terms with h² or higher vanish. This observation grows into the power rule.
Example 2: a quadratic
Take f(x) = 3x² − 5x + 2. Be careful with the middle term.
f(x + h) = 3(x + h)² − 5(x + h) + 2
= 3x² + 6xh + 3h² − 5x − 5h + 2
f(x + h) − f(x) = 6xh + 3h² − 5h
divided by h: 6x + 3h − 5
limit: 6x − 5 The constant 2 disappeared at the subtraction step, which is why constants contribute nothing to a derivative. Each term was processed independently, which hints that you may differentiate a sum term by term.
A quick sanity check: at x = 1 the formula gives a slope of 1. Using h = 0.001, f(1) = 0 and f(1.001) = 0.001003, so the quotient is 1.003, right on course.
Example 3: a reciprocal
Take f(x) = 1/x, with x ≠ 0. The tool here is a common denominator.
1/(x + h) − 1/x = [x − (x + h)] / [x(x + h)]
= −h / [x(x + h)]
divided by h: −1 / [x(x + h)]
limit: −1/x² The result is always negative, matching a graph that falls on each of its two branches.
For f(x) = 1/x², the same idea works with slightly more algebra. The difference is [x² − (x + h)²] / [x²(x + h)²], and the numerator equals −h(2x + h). After canceling h you have −(2x + h)/[x²(x + h)²], whose limit is −2x/x⁴ = −2/x³.
Example 4: a square root
Take f(x) = √x with x > 0. Multiply top and bottom by the conjugate, the same two roots joined by a plus sign.
(√(x + h) − √x)/h
= (x + h − x) / [h(√(x + h) + √x)] multiply by conjugate
= 1 / (√(x + h) + √x) cancel h
→ 1 / (2√x) let h → 0 At x = 0 the quotient from the right is 1/√h, which grows without bound. So the square root has no finite derivative there, and its graph starts out vertically.
The same technique handles f(x) = √(2x + 1) for x > −1/2. The numerator after multiplying is 2h, giving a derivative of 2/(2√(2x + 1)) = 1/√(2x + 1).
Two harder fractions
A quotient of linear expressions. Take f(x) = x/(x + 1), with x ≠ −1. Combine the two fractions in the numerator:
(x + h)/(x + h + 1) − x/(x + 1)
= [(x + h)(x + 1) − x(x + h + 1)] / [(x + h + 1)(x + 1)]
= h / [(x + h + 1)(x + 1)]
divided by h: 1 / [(x + h + 1)(x + 1)]
limit: 1/(x + 1)² Almost everything in the top canceled, leaving a single h. That collapse is typical, and it is a good sign that the expansion was done correctly.
A root in the denominator. Take f(x) = 1/√x with x > 0. This needs both tools, a common denominator and then a conjugate.
[1/√(x + h) − 1/√x]/h
= (√x − √(x + h)) / [h·√x·√(x + h)]
= −h / [h·√x·√(x + h)·(√x + √(x + h))]
→ −1 / (√x·√x·2√x)
= −1/(2x√x) When two obstacles appear together, remove them one at a time. Work on the outer structure first (the fraction), then on what remains in the numerator (the roots).
Proving a general rule the same way
First principles can handle unnamed functions too. Suppose f and g are differentiable, and let s(x) = f(x) + g(x). The difference quotient of s splits into two separate quotients:
[s(x + h) − s(x)]/h = [f(x + h) − f(x)]/h + [g(x + h) − g(x)]/h
→ f′(x) + g′(x) This proves that sums differentiate term by term. A constant factor c can be pulled out of the quotient in the same way, giving (c·f)′ = c·f′. Each rule you use later was established by an argument of this kind.
Example 5: sine and the exponential
Algebra alone cannot cancel h inside sin(x + h). Use the addition formula, with x in radians:
[sin(x + h) − sin x]/h
= sin x · (cos h − 1)/h + cos x · (sin h)/h
→ sin x · 0 + cos x · 1 = cos x The two limits used are proved with the squeeze theorem.
For f(x) = eˣ, the law of exponents factors the function out:
(e^(x + h) − eˣ)/h = eˣ · (e^h − 1)/h → eˣ · 1 = eˣ The limit (e^h − 1)/h → 1 is a defining property of the number e. The exponential function is therefore its own derivative.
The alternative form
You can also write the definition with the second input named x:
f′(a) = lim [f(x) − f(a)]/(x − a) as x → a This is the same limit with x = a + h. It is convenient when the numerator factors. For f(x) = x⁴, the numerator x⁴ − a⁴ factors as (x − a)(x + a)(x² + a²). Canceling and letting x → a gives (2a)(2a²) = 4a³.
When the limit does not exist
Apply the method to the absolute value at 0. The quotient is abs(h)/h, which is 1 for positive h and −1 for negative h. The one-sided limits differ, so there is no derivative.
For a function defined in pieces, compute the left and right quotients separately at the joining point, and also check that the pieces actually meet. Matching slope formulas are meaningless if the function jumps. Take f(x) = x² for x ≤ 1 and 2x − 1 for x > 1. Both pieces equal 1 at x = 1. The left quotient is 2 + h → 2, and the right quotient is 2h/h = 2. The derivative exists and equals 2.
Checking a result with numbers
You can test any derivative on a calculator. For f(x) = x³ at x = 2, the claimed slope is 12. With h = 0.01:
| Estimate | Calculation | Result |
|---|---|---|
| One-sided quotient | (2.01³ − 2³)/0.01 | 12.0601 |
| Symmetric quotient | (2.01³ − 1.99³)/0.02 | 12.0001 |
The symmetric version uses points on both sides and is far closer for the same step size. It is a handy check, though it is not the definition. For abs(x) at 0, the symmetric quotient equals 0 for every h, even though no derivative exists there.
Do not make h extremely tiny on a machine. The two function values then agree in almost every stored digit, and subtracting them leaves mostly rounding error.
A numerical check can expose a wrong formula quickly. It cannot confirm a formula for all inputs, so keep the algebraic argument as your justification.
Using the derivative you found
Derivatives answer geometric questions at once. For f(x) = x² − 4x, first principles give f′(x) = 2x − 4. The tangent is horizontal where 2x − 4 = 0, at x = 2, the bottom of the parabola. At x = 5 the value is 5 and the slope is 6, so the tangent line is y = 5 + 6(x − 5), or y = 6x − 25.
Common errors
- Writing f(x + h) as f(x) + h. For x², the correct expression is (x + h)², which contains a middle term.
- Forgetting parentheses when subtracting. Every term of f(x) changes sign.
- Setting h = 0 too soon. Do so only after h has canceled from the denominator.
- Canceling h from only some terms. Every term in the numerator needs the factor.
Practice with answers
Try these before reading the results. For f(x) = 1/(2x + 1), where x ≠ −1/2, the numerator after combining fractions is −2h over the product of denominators, giving −2/(2x + 1)².
For f(x) = x² + 1/x, differentiate each part by the method above and add: 2x − 1/x². For a constant function, the difference is 0 for every h, so the derivative is 0.
Once these feel routine, the standard rules will look like records of calculations you have already done.