Free access until 31 December 2026 · Physics and Maths questions and notes, updated continuously · Build a test

ExaminerPrep › IB Maths AA › Notes

IB Maths AA · Topic 5 · 5.12 · HL only

Limits, first principles and higher derivatives

This note builds the idea of a derivative from scratch using limits. You will learn how to evaluate simple limits, how to differentiate from first principles, and how to find second and higher derivatives and spot their patterns. It explains where all the differentiation rules come from.

Key ideas

Limits. The limit of \(f(x)\) as \(x\) approaches \(a\), written \(\lim_{x\to a}f(x)\), is the value that \(f(x)\) gets closer and closer to as \(x\) gets closer to \(a\). It does not matter what happens at \(x=a\) itself. A limit may exist even when \(f(a)\) is undefined.

Methods for simple limits:

  • Direct substitution. If \(f\) is a sensible function at \(a\), just substitute. For example, \(\lim_{x\to 3}(x^2+1)=10\).
  • Factorise and cancel. If substituting gives \(\tfrac00\), factorise and cancel the common factor. For \(x\ne 3\), \(\dfrac{x^2-9}{x-3}=x+3\), so the limit as \(x\to3\) is 6.
  • Rationalise. For limits with square roots, multiply top and bottom by the conjugate.
  • Limits as \(x\to\infty\). Divide every term by the highest power of \(x\). Terms such as \(\dfrac1x\) and \(\dfrac1{x^2}\) tend to 0. For example, \(\dfrac{3x^2+1}{x^2-5}=\dfrac{3+1/x^2}{1-5/x^2}\to 3\). When a sequence or function settles towards a value like this, we say it converges to that value.

Derivative from first principles. The gradient of the chord from \(x\) to \(x+h\) is \(\dfrac{f(x+h)-f(x)}{h}\). As \(h\) shrinks to 0, the chord becomes the tangent. So \[f'(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}.\] The steps are always the same. Write \(f(x+h)\), subtract \(f(x)\), simplify so that \(h\) can be cancelled from the top and bottom, and only then let \(h\to0\). You cannot put \(h=0\) at the start because you would get \(\tfrac00\).

The same limit gives the gradient at a particular point \(x=a\): \(f'(a)=\lim_{h\to0}\dfrac{f(a+h)-f(a)}{h}\). A function is differentiable at a point only if this limit exists. A sharp corner, such as the graph of \(|x|\) at \(x=0\), has different gradients on its left and right, so the derivative does not exist there.

One-sided limits. A limit can be approached from the left (\(x\lt a\)) or from the right (\(x\gt a\)). The limit exists only if both give the same value. For \(f(x)=|x|\), the chord gradients are \(-1\) from the left and \(+1\) from the right at \(x=0\), so the two limits disagree. A function that is differentiable at a point must also be continuous there, but a continuous function can still have a corner.

Gradient at a point. To find the gradient at \(x=2\) of \(f(x)=x^2\) from first principles, compute \(\dfrac{(2+h)^2-4}{h}=\dfrac{4h+h^2}{h}=4+h\), which tends to 4. This agrees with \(f'(x)=2x\) at \(x=2\).

Higher derivatives. Differentiating \(f'\) gives the second derivative: \[f''(x)=\frac{d^2y}{dx^2}.\] Differentiate again for \(f'''(x)=\dfrac{d^3y}{dx^3}\), and so on. The \(n\)th derivative is written \(f^{(n)}(x)\) or \(\dfrac{d^ny}{dx^n}\).

The second derivative describes how the gradient changes. If \(f''(x)\gt 0\), the curve is concave up. If \(f''(x)\lt 0\), it is concave down. A point of inflection is where \(f''\) changes sign, so \(f''(x)=0\) is necessary but not enough. You must check that the sign changes either side.

Some functions give a pattern when differentiated repeatedly. Writing out the first few derivatives lets you predict the \(n\)th. For example, the derivatives of \(e^{2x}\) are \(2e^{2x}\), \(4e^{2x}\), \(8e^{2x}\), so \(f^{(n)}(x)=2^ne^{2x}\).

Definitions and formulae

Term or formulaMeaning / when to use
\(\lim_{x\to a}f(x)=L\)\(f(x)\) approaches \(L\) as \(x\) approaches \(a\).
\(f'(x)=\lim_{h\to0}\dfrac{f(x+h)-f(x)}{h}\)Definition of the derivative. Use when "from first principles" is stated.
\(f'(a)=\lim_{h\to0}\dfrac{f(a+h)-f(a)}{h}\)Gradient at the single point \(x=a\).
\(f''(x)=\dfrac{d^2y}{dx^2}\)Second derivative: rate of change of the gradient.
\(f^{(n)}(x)=\dfrac{d^ny}{dx^n}\)The \(n\)th derivative.
\((a+h)^3=a^3+3a^2h+3ah^2+h^3\)Useful expansion for first-principles questions on cubics.

Worked examples

Example 1 Use differentiation from first principles to show that the derivative of \(f(x)=x^3\) is \(3x^2\).

\(f(x+h)=(x+h)^3=x^3+3x^2h+3xh^2+h^3\).

\(f(x+h)-f(x)=3x^2h+3xh^2+h^3\).

Divide by \(h\): \(\dfrac{f(x+h)-f(x)}{h}=3x^2+3xh+h^2\) (for \(h\ne0\)).

As \(h\to0\), the terms \(3xh\) and \(h^2\) tend to 0.

Answer: \(f'(x)=\lim_{h\to0}(3x^2+3xh+h^2)=3x^2\).

Example 2 Use first principles to find the derivative of \(f(x)=\dfrac1{x+1}\), where \(x\ne-1\).

\(f(x+h)-f(x)=\dfrac1{x+h+1}-\dfrac1{x+1}\).

Put over a common denominator: \(\dfrac{(x+1)-(x+h+1)}{(x+h+1)(x+1)}=\dfrac{-h}{(x+h+1)(x+1)}\).

Divide by \(h\): \(\dfrac{f(x+h)-f(x)}{h}=\dfrac{-1}{(x+h+1)(x+1)}\).

Let \(h\to0\): \(\dfrac{-1}{(x+1)(x+1)}\).

Answer: \(f'(x)=-\dfrac1{(x+1)^2}\).

Example 3 Let \(f(x)=x\,e^{2x}\). Find \(f'(x)\), \(f''(x)\) and \(f'''(x)\). Hence suggest a formula for \(f^{(n)}(x)\), and use it to find \(f^{(5)}(0)\).

Use the product rule. \(f'(x)=e^{2x}+2xe^{2x}=(1+2x)e^{2x}\).

\(f''(x)=2e^{2x}+2(1+2x)e^{2x}=(4+4x)e^{2x}\).

\(f'''(x)=4e^{2x}+2(4+4x)e^{2x}=(12+8x)e^{2x}\).

Look at the pattern: the coefficients of \(x\) are \(2,4,8\), which are \(2^n\). The constants are \(1,4,12\). These are \(n\cdot2^{n-1}\): \(1\cdot1\), \(2\cdot2\), \(3\cdot4\).

Suggested formula: \(f^{(n)}(x)=(2^nx+n\,2^{n-1})e^{2x}\).

For \(n=5\) and \(x=0\): \(f^{(5)}(0)=5\cdot2^4\cdot e^0=80\).

Answer: \(f^{(n)}(x)=(2^nx+n2^{n-1})e^{2x}\), so \(f^{(5)}(0)=80\).

Common errors

  • Common error: letting \(h=0\) too early. First simplify until \(h\) cancels, then take the limit.
  • Common error: dropping "\(\lim_{h\to 0}\)" from the lines before the limit is taken, or keeping it on the final answer after \(h\) has gone.
  • Common error: an expansion slip in \((x+h)^n\), such as writing \((x+h)^2=x^2+h^2\). The middle term \(2xh\) is missing.
  • Common error: claiming a point of inflection just because \(f''(x)=0\). The sign of \(f''\) must change.
  • Common error: writing \(\dfrac{d^2y}{dx^2}\) as \(\left(\dfrac{dy}{dx}\right)^2\). They are different things.

Exam tip: In a "show that" first-principles question, write out every line, including the line where \(h\) is cancelled. The final answer is already given, so the working is the whole task.

Check yourself

  1. Find \(\displaystyle\lim_{x\to2}\frac{x^2-4}{x-2}\) and \(\displaystyle\lim_{x\to\infty}\frac{5x+2}{2x-7}\).
    AnswerFirst: \(\frac{(x-2)(x+2)}{x-2}=x+2\to4\). Second: divide by \(x\): \(\frac{5+2/x}{2-7/x}\to\frac52\).
  2. Use first principles to differentiate \(f(x)=x^2+3x\).
    Answer\(f(x+h)-f(x)=2xh+h^2+3h\). Dividing by \(h\) gives \(2x+h+3\), which tends to \(2x+3\) as \(h\to0\).
  3. Use first principles to differentiate \(f(x)=\sqrt x\) for \(x\gt0\).
    Answer\(\frac{\sqrt{x+h}-\sqrt x}{h}\). Multiply top and bottom by \(\sqrt{x+h}+\sqrt x\): the top becomes \(h\), giving \(\frac{1}{\sqrt{x+h}+\sqrt x}\to\frac1{2\sqrt x}\).
  4. Find \(f''(x)\) for \(f(x)=x\ln x\), and \(f'''(x)\) for \(g(x)=x^4-3x^2\) at \(x=2\).
    Answer\(f'=\ln x+1\), so \(f''=\frac1x\). For \(g\): \(g'=4x^3-6x\), \(g''=12x^2-6\), \(g'''=24x\), so \(g'''(2)=48\).