IB Practice / Maths AA HL / Calculus

Limits, continuity and the derivative from first principles: study notes

This topic is about what happens to a function as the input approaches a value: the idea of a limit, when a limit exists, and how limits define continuity, the gradient of a curve and the derivative itself. In the exam you are asked to find a derivative from first principles on a polynomial or a simple rational function (Paper 1, 4-6 marks, usually 'show that'), to evaluate an indeterminate limit with l'Hôpital's rule or a Maclaurin series (Paper 1 or 3, 4-7 marks, often two applications), and occasionally to decide whether a piecewise function is continuous or differentiable at a joining point (2-3 marks).

Download the PDFFree, no sign-up.

1. The informal idea of a limit; convergence and divergence

We write lim⁡x→af(x)=L\lim_{x \to a} f(x) = L to mean that f(x)f(x) can be made as close as we like to the number LL by taking xx close enough to aa, from either side, without needing x=ax = a itself. The value f(a)f(a) may not exist at all: x2−4x−2\frac{x^2-4}{x-2} is undefined at x=2x=2 but its limit there is 44, because the expression equals x+2x+2 for every x≠2x \neq 2. When the limit is a finite number the limit converges. When the values grow without bound (for example 1x2\frac{1}{x^2} as x→0x \to 0) or oscillate without settling (for example sin⁡1x\sin\frac{1}{x} as x→0x \to 0) the limit diverges, and we say it does not exist; in the unbounded case we may write f(x)→∞f(x) \to \infty as a description, not as a value. Limits as x→∞x \to \infty work in the same way and are what justify horizontal asymptotes: lim⁡x→∞3x+1x−2=3\lim_{x\to\infty}\frac{3x+1}{x-2} = 3 because dividing numerator and denominator by xx gives 3+1/x1−2/x→31\frac{3 + 1/x}{1 - 2/x} \to \frac{3}{1}. None of this vocabulary is in the booklet; learn it.

2. Continuity and differentiability at a point

A function is continuous at x=ax = a if three things hold: f(a)f(a) is defined, lim⁡x→af(x)\lim_{x\to a} f(x) exists (the left-hand and right-hand limits agree), and the limit equals f(a)f(a). Informally, the graph can be drawn through the point without lifting the pen. A function is differentiable at x=ax = a if the gradient of the curve has a single well-defined value there, which requires the gradient approached from the left to equal the gradient approached from the right. Differentiability at a point implies continuity there, but the converse is false: f(x)=∣x∣f(x) = |x| is continuous at x=0x = 0 yet has a corner, with gradient −1-1 on the left and +1+1 on the right, so f′(0)f'(0) does not exist. The same happens at a cusp or where the tangent is vertical. For piecewise functions the exam test is mechanical: match the function values at the join for continuity, then match the derivatives of the two pieces at the join for differentiability. This definition is not in the booklet.

3. The derivative as a gradient and as a rate of change

The gradient of the chord joining (x,f(x))(x, f(x)) and (x+h,f(x+h))(x+h, f(x+h)) is the difference quotient f(x+h)−f(x)h\frac{f(x+h)-f(x)}{h}. As h→0h \to 0 the second point slides towards the first and the chord turns into the tangent line at xx; the limit of the chord gradients is the gradient of the tangent, which is what we call f′(x)f'(x). So f′(a)f'(a) is the gradient of the curve at x=ax = a, and the tangent there has equation y−f(a)=f′(a)(x−a)y - f(a) = f'(a)(x - a). Equally, f′(x)f'(x) is the instantaneous rate of change of ff with respect to xx: if s(t)s(t) is displacement then s′(t)s'(t) is velocity, and the chord gradient is the average rate of change over the interval of length hh. Notation: f′(x)f'(x), dydx\frac{dy}{dx} and ddx(f(x))\frac{d}{dx}\left(f(x)\right) all mean the same thing.

4. The derivative from first principles

The booklet gives f′(x)=lim⁡h→0f(x+h)−f(x)hf'(x) = \lim_{h\to 0}\frac{f(x+h)-f(x)}{h}. In a first-principles question you must (i) write this definition with the actual function substituted, (ii) expand and simplify the numerator so that every surviving term has a factor hh, (iii) cancel the hh, and (iv) take the limit explicitly, writing lim⁡h→0\lim_{h\to 0} until the moment you set h=0h = 0. For a polynomial such as f(x)=x3f(x) = x^3, use (x+h)3=x3+3x2h+3xh2+h3(x+h)^3 = x^3 + 3x^2h + 3xh^2 + h^3, so the quotient is 3x2+3xh+h2→3x23x^2 + 3xh + h^2 \to 3x^2. For a simple rational function such as f(x)=1xf(x) = \frac{1}{x}, combine the fractions first: 1x+h−1x=x−(x+h)x(x+h)=−hx(x+h)\frac{1}{x+h} - \frac{1}{x} = \frac{x - (x+h)}{x(x+h)} = \frac{-h}{x(x+h)}, so the quotient is −1x(x+h)→−1x2\frac{-1}{x(x+h)} \to -\frac{1}{x^2}. Substituting h=0h = 0 before cancelling gives the meaningless 00\frac{0}{0}, which is exactly why the limit is needed. In a 'show that' part the markscheme requires the simplified quotient and the limit statement before the printed answer (AG); quoting the power rule earns nothing.

5. Higher derivatives and notation

Differentiating again gives the second derivative, written f′′(x)f''(x) or d2ydx2\frac{d^2y}{dx^2}; the third is f′′′(x)f'''(x) or d3ydx3\frac{d^3y}{dx^3}; from the fourth onward use f(n)(x)f^{(n)}(x) or dnydxn\frac{d^ny}{dx^n}. Note the position of the superscripts: d2ydx2\frac{d^2y}{dx^2} is not (dydx)2\left(\frac{dy}{dx}\right)^2. The second derivative is the rate of change of the gradient (and, when ff is displacement, of velocity, hence acceleration). Higher derivatives appear in this topic when l'Hôpital's rule is applied repeatedly and when Maclaurin coefficients are built. For f(x)=xnf(x) = x^n with nn a positive integer, the pattern f(k)(x)=n!(n−k)!xn−kf^{(k)}(x) = \frac{n!}{(n-k)!}x^{n-k} for k≤nk \le n (and f(k)(x)=0f^{(k)}(x) = 0 for k>nk > n) is worth recognising, and for ekxe^{kx} every derivative multiplies by another kk.

6. L'Hôpital's rule

If lim⁡x→af(x)g(x)\lim_{x\to a}\frac{f(x)}{g(x)} has the form 00\frac{0}{0} or ∞∞\frac{\infty}{\infty} (with aa finite or infinite), then lim⁡x→af(x)g(x)=lim⁡x→af′(x)g′(x)\lim_{x\to a}\frac{f(x)}{g(x)} = \lim_{x\to a}\frac{f'(x)}{g'(x)} provided the right-hand limit exists. Numerator and denominator are differentiated separately; you do not use the quotient rule. The rule is not in the booklet. Exam routine: substitute x=ax = a and state in words that the form is 00\frac{0}{0} (this earns the R mark), differentiate top and bottom, substitute again. If the result is still indeterminate, say so and apply the rule a second time; if it is now a definite value, stop. Applying the rule to a form that is not indeterminate gives wrong answers, for example lim⁡x→0x+1x+2=12\lim_{x\to 0}\frac{x+1}{x+2} = \frac{1}{2}, not 11\frac{1}{1}. Keep chain-rule factors: the derivative of sin⁡3x\sin 3x is 3cos⁡3x3\cos 3x. Remember the standard result lim⁡x→0sin⁡xx=1\lim_{x\to 0}\frac{\sin x}{x} = 1, which often saves a further application. Questions that say 'or otherwise' allow cancellation of a common factor, dividing through by the highest power for limits at infinity, or series.

7. Limits using Maclaurin series

The booklet lists the Maclaurin series of exe^x, ln⁡(1+x)\ln(1+x), sin⁡x\sin x, cos⁡x\cos x and arctan⁡x\arctan x (series are the subject of 5.19). For a limit as x→0x \to 0, replace each function by enough terms of its series, simplify, and the lowest surviving powers of xx decide the limit. For example 1−cos⁡2x=(2x)22!−(2x)44!+⋯=2x2−23x4+…1 - \cos 2x = \frac{(2x)^2}{2!} - \frac{(2x)^4}{4!} + \dots = 2x^2 - \frac{2}{3}x^4 + \dots, so 1−cos⁡2xx2→2\frac{1-\cos 2x}{x^2} \to 2. Series are often quicker than two applications of l'Hôpital and are accepted as an alternative method unless the question prescribes the rule. Substitute 2x2x or x2x^2 carefully into the booklet series and keep one more term than you think you need.

Formulas

f′(x)=lim⁡h→0f(x+h)−f(x)hf'(x) = \lim_{h\to 0}\dfrac{f(x+h)-f(x)}{h}in the booklet
ff continuous at aa: lim⁡x→a−f(x)=lim⁡x→a+f(x)=f(a)\lim_{x\to a^-}f(x) = \lim_{x\to a^+}f(x) = f(a); differentiable at aa additionally needs equal left and right gradientslearn it
L'Hôpital: if f(x)g(x)→00\frac{f(x)}{g(x)} \to \frac{0}{0} or ∞∞\frac{\infty}{\infty} then lim⁡f(x)g(x)=lim⁡f′(x)g′(x)\lim\dfrac{f(x)}{g(x)} = \lim\dfrac{f'(x)}{g'(x)}learn it
lim⁡x→0sin⁡xx=1\lim_{x\to 0}\dfrac{\sin x}{x} = 1, lim⁡x→01−cos⁡xx=0\lim_{x\to 0}\dfrac{1-\cos x}{x} = 0, lim⁡x→∞ln⁡xx=0\lim_{x\to\infty}\dfrac{\ln x}{x} = 0learn it
ex=1+x+x22!+…e^x = 1 + x + \frac{x^2}{2!} + \dots, sin⁡x=x−x33!+…\sin x = x - \frac{x^3}{3!} + \dots, cos⁡x=1−x22!+…\cos x = 1 - \frac{x^2}{2!} + \dots, ln⁡(1+x)=x−x22+…\ln(1+x) = x - \frac{x^2}{2} + \dots, arctan⁡x=x−x33+…\arctan x = x - \frac{x^3}{3} + \dotsin the booklet
Higher derivatives: f′′(x)=d2ydx2f''(x) = \frac{d^2y}{dx^2}, f′′′(x)=d3ydx3f'''(x) = \frac{d^3y}{dx^3}, f(n)(x)=dnydxnf^{(n)}(x) = \frac{d^ny}{dx^n}learn it

Worked examples

Example 1

Let f(x)=x2+1xf(x) = x^2 + \dfrac{1}{x}, x≠0x \neq 0. Using the definition of the derivative from first principles, show that f′(x)=2x−1x2f'(x) = 2x - \dfrac{1}{x^2}. [6 marks]

Solution
  1. Write the definition with the function substituted: f′(x)=lim⁡h→0(x+h)2+1x+h−x2−1xhf'(x) = \lim_{h\to 0}\dfrac{(x+h)^2 + \frac{1}{x+h} - x^2 - \frac{1}{x}}{h}.
  2. Expand the polynomial part: (x+h)2−x2=2xh+h2(x+h)^2 - x^2 = 2xh + h^2.
  3. Combine the rational part over a common denominator: 1x+h−1x=x−(x+h)x(x+h)=−hx(x+h)\dfrac{1}{x+h} - \dfrac{1}{x} = \dfrac{x - (x+h)}{x(x+h)} = \dfrac{-h}{x(x+h)}.
  4. The numerator is therefore 2xh+h2−hx(x+h)2xh + h^2 - \dfrac{h}{x(x+h)}, and every term contains a factor hh. Dividing by hh: f(x+h)−f(x)h=2x+h−1x(x+h)\dfrac{f(x+h)-f(x)}{h} = 2x + h - \dfrac{1}{x(x+h)}.
  5. Take the limit explicitly: f′(x)=lim⁡h→0(2x+h−1x(x+h))=2x+0−1x⋅xf'(x) = \lim_{h\to 0}\left(2x + h - \dfrac{1}{x(x+h)}\right) = 2x + 0 - \dfrac{1}{x\cdot x}.

Answer: f′(x)=2x−1x2f'(x) = 2x - \dfrac{1}{x^2}, as required (AG). The marks are for the substituted definition (M1), the expanded and combined numerator (A1 A1), the cancelled quotient (A1), the explicit limit (M1) and the final line (A1).

Example 2

(a) Use l'Hôpital's rule to determine the value of lim⁡x→0ex−1−x1−cos⁡2x\lim_{x\to 0}\dfrac{e^{x} - 1 - x}{1 - \cos 2x}. [5 marks] (b) Find lim⁡x→∞ln⁡xx\lim_{x\to\infty}\dfrac{\ln x}{x}. [2 marks]

Solution
  1. (a) Substitute x=0x = 0: numerator e0−1−0=0e^0 - 1 - 0 = 0, denominator 1−cos⁡0=01 - \cos 0 = 0. The form is 00\frac{0}{0}, so l'Hôpital's rule applies (R1).
  2. Differentiate numerator and denominator separately: ddx(ex−1−x)=ex−1\dfrac{d}{dx}(e^x - 1 - x) = e^x - 1 and ddx(1−cos⁡2x)=2sin⁡2x\dfrac{d}{dx}(1 - \cos 2x) = 2\sin 2x (keep the chain-rule factor 2). The limit becomes lim⁡x→0ex−12sin⁡2x\lim_{x\to 0}\dfrac{e^x - 1}{2\sin 2x} (A1).
  3. Substitute again: e0−12sin⁡0=00\dfrac{e^0 - 1}{2\sin 0} = \dfrac{0}{0}, still indeterminate, so the rule may be applied a second time (M1).
  4. Differentiate again: ddx(ex−1)=ex\dfrac{d}{dx}(e^x - 1) = e^x and ddx(2sin⁡2x)=4cos⁡2x\dfrac{d}{dx}(2\sin 2x) = 4\cos 2x, giving lim⁡x→0ex4cos⁡2x\lim_{x\to 0}\dfrac{e^x}{4\cos 2x} (A1).
  5. Substitute x=0x = 0: 14⋅1=14\dfrac{1}{4\cdot 1} = \dfrac{1}{4}. This is a definite value, so stop (A1). Check by series: ex−1−x=x22+x36+…e^x - 1 - x = \frac{x^2}{2} + \frac{x^3}{6} + \dots and 1−cos⁡2x=2x2−…1 - \cos 2x = 2x^2 - \dots, so the quotient tends to 1/22=14\frac{1/2}{2} = \frac{1}{4}.
  6. (b) As x→∞x \to \infty both ln⁡x\ln x and xx tend to infinity, so the form is ∞∞\frac{\infty}{\infty} (R1). Differentiating: lim⁡x→∞1/x1=lim⁡x→∞1x=0\lim_{x\to\infty}\dfrac{1/x}{1} = \lim_{x\to\infty}\dfrac{1}{x} = 0 (A1).

Answer: (a) 14\dfrac{1}{4}. (b) 00.

Example 3

The function ff is defined by f(x)=ax2+1f(x) = ax^2 + 1 for x≤1x \le 1 and f(x)=bx+2f(x) = bx + 2 for x>1x > 1, where a,b∈Ra, b \in \mathbb{R}. (a) Find the values of aa and bb for which ff is both continuous and differentiable at x=1x = 1. [4 marks] (b) The function gg is defined by g(x)=∣x−1∣g(x) = |x - 1|. State, with a reason, whether gg is continuous at x=1x = 1 and whether it is differentiable at x=1x = 1. [2 marks]

Solution
  1. (a) Continuity at x=1x = 1: the value from the left piece, f(1)=a+1f(1) = a + 1, must equal the limit from the right, lim⁡x→1+(bx+2)=b+2\lim_{x\to 1^+}(bx + 2) = b + 2. So a+1=b+2a + 1 = b + 2, that is a−b=1a - b = 1 (M1 A1).
  2. Differentiability at x=1x = 1: the gradient of the left piece is 2ax2ax, which is 2a2a at x=1x = 1; the gradient of the right piece is bb. These must be equal, so 2a=b2a = b (M1).
  3. Solve simultaneously: substituting b=2ab = 2a into a−b=1a - b = 1 gives a−2a=1a - 2a = 1, so a=−1a = -1 and b=−2b = -2 (A1).
  4. Check: left value −1+1=0-1 + 1 = 0, right value −2+2=0-2 + 2 = 0; left gradient −2-2, right gradient −2-2. The two pieces join smoothly.
  5. (b) gg is continuous at x=1x = 1 because g(1)=0g(1) = 0 and ∣x−1∣→0|x - 1| \to 0 from both sides. It is not differentiable there because the gradient is −1-1 for x<1x < 1 and +1+1 for x>1x > 1; the graph has a corner, so the left and right gradients disagree and no single tangent exists (A1 for each conclusion with reason).

Answer: (a) a=−1a = -1, b=−2b = -2. (b) gg is continuous but not differentiable at x=1x = 1 because the graph has a corner there (left gradient −1-1, right gradient +1+1).

Can you...

  • Explain in one sentence what lim⁡x→af(x)=L\lim_{x\to a}f(x) = L means, and give an example of a divergent limit?
  • State the three conditions for continuity at a point and explain, with ∣x∣|x| as the example, why continuity does not imply differentiability?
  • Derive f′(x)f'(x) from first principles for a quadratic, a cubic and 1x\frac{1}{x}, writing the difference quotient, cancelling hh and taking the limit explicitly?
  • Apply l'Hôpital's rule twice to a 00\frac{0}{0} limit involving sin⁡\sin, cos⁡\cos or exe^x, stating the indeterminate form before each application and stopping when the value is definite?
  • Evaluate the same limit with the booklet Maclaurin series, and use the x→∞x \to \infty form to justify a horizontal asymptote?

Common errors

  • Setting h=0h = 0 in the difference quotient before cancelling, which produces 00\frac{0}{0}; always simplify until hh is a common factor of the numerator, cancel, and only then take the limit.
  • Writing the answer from the power rule in a first-principles question; the markscheme awards marks only for the written-out quotient, the simplified algebra and the explicit limit statement.
  • Applying l'Hôpital's rule when the form is not 00\frac{0}{0} or ∞∞\frac{\infty}{\infty}; substitute first, state the form in words (this is the R mark), and stop as soon as substitution gives a definite number.
  • Differentiating the whole fraction with the quotient rule instead of differentiating numerator and denominator separately; l'Hôpital's rule compares f′(x)f'(x) with g′(x)g'(x), not (fg)′\left(\frac{f}{g}\right)'.
  • Dropping chain-rule factors such as the 22 in ddxsin⁡2x=2cos⁡2x\frac{d}{dx}\sin 2x = 2\cos 2x or the parameter kk in ddxekx=kekx\frac{d}{dx}e^{kx} = ke^{kx}; a lost factor in the first application doubles its damage in the second.
  • Assuming a continuous piecewise function is automatically differentiable at the join; check the gradients of the two pieces separately, since a corner (as in ∣x∣|x|) is continuous but has no derivative.

Original questions and notes written by Pietro Meloni, PhD, from the IB syllabus. Not endorsed by or affiliated with the International Baccalaureate Organization. Found a mistake? Please tell me privately at pietro@pietromeloni.com. More questions on this topic: Calculus practice.

Find out what is costing the marks.

Twenty minutes, one to one, online. No charge, no commitment.

Request an initial assessment