12.3 The Derivative from First Principles
The derivative $f'(a)=\displaystyle\lim_{h\to0}\dfrac{f(a+h)-f(a)}{h}$ is the instantaneous rate of change of $f$ at $a$ and the slope of the tangent to its graph. Compute it from first principles for powers, reciprocals, square roots, $\sin x$ and $\cos x$.
Draw a smooth curve and pick a point on it. Through that point there is exactly one straight line that "just touches" the curve there, running in the same direction as the curve โ the tangent line. For a circle you know how to draw it: perpendicular to the radius. For a parabola, a sine wave or the graph of a stone's height against time, there is no radius to help. How steep is the tangent? Where does it go?
In Section 12.1 we answered a question that turns out to be the same: the instantaneous speed of a falling stone. We took the average rate of change over a short interval, $\tfrac{f(a+h)-f(a)}{h}$ โ the slope of a chord, or secant line, through two points of the graph โ and let $h\to0$. In this section we give that limit its name, the derivative, and learn to compute it straight from the definition ("from first principles"). The results for $x^2$, $x^3$, $\tfrac1x$, $\sqrt x$, $\sin x$ and $\cos x$ found here are the raw material for the quick rules of Section 12.4.
The Derivative at a Point
Let $f$ be a real function defined on an open interval containing the point $a$. The derivative of $f$ at $a$ is $$f'(a)=\lim_{h\to0}\dfrac{f(a+h)-f(a)}{h},$$ provided this limit exists (as a real number). When it exists we say that $f$ is differentiable at $a$. Putting $x=a+h$ gives the equivalent form $f'(a)=\displaystyle\lim_{x\to a}\dfrac{f(x)-f(a)}{x-a}$.
The fraction $\tfrac{f(a+h)-f(a)}{h}$ is called the difference quotient. It always has the form $\tfrac00$ at $h=0$, so finding a derivative always means simplifying before letting $h\to0$. The derivative has two meanings, and it pays to keep both in mind.
The difference quotient is the average rate of change of $f$ over $[a,a+h]$. Its limit $f'(a)$ is the instantaneous rate of change of $f$ at $a$. If $s(t)$ is position, $s'(t)$ is the velocity; if $V(t)$ is the volume in a tank, $V'(t)$ is the flow rate.
The difference quotient is the slope of the secant line through $P(a,f(a))$ and $Q(a+h,f(a+h))$. As $h\to0$, $Q$ slides along the curve to $P$ and the secant turns into the tangent at $P$. So $f'(a)$ is the slope of the tangent, and the tangent line is $$y-f(a)=f'(a)(x-a).$$
The tangent-line equation is the point-slope form of a line from Section 9.2, with the point $(a,f(a))$ and slope $m=f'(a)$.
The Derivative as a Function
In Example 1 we found $f'(3)=6$ for $f(x)=x^2$. Repeating the work at $a=1$, $a=-2$, $a=10$โฆ would be wasteful. Instead we do it once, at a general point $x$.
The derivative of $f$ is the function $f'$ whose value at $x$ is $$f'(x)=\lim_{h\to0}\dfrac{f(x+h)-f(x)}{h},$$ defined at every $x$ where this limit exists. Finding $f'(x)$ directly from this limit is called differentiating from first principles. If $y=f(x)$, the derivative is also written $$f'(x)=\dfrac{dy}{dx}=\dfrac{d}{dx}f(x)=y'.$$
The notation $\tfrac{dy}{dx}$ is due to Leibniz: it reminds us that the derivative is the limit of $\tfrac{\Delta y}{\Delta x}$, a change in $y$ divided by a change in $x$. It is a single symbol, not a fraction you may cancel. The value at a point is written $f'(a)$ or $\left.\tfrac{dy}{dx}\right|_{x=a}$.
- Write $f(x+h)$ by replacing every $x$ in the formula by $(x+h)$ โ with brackets.
- Form the difference $f(x+h)-f(x)$ and simplify it until every term contains the factor $h$. Tools: expanding (binomial theorem), a common denominator for fractions, rationalising for square roots, a sum or difference formula for trigonometric functions.
- Divide by $h$ and cancel it (allowed because $h\ne0$).
- Only now let $h\to0$, using substitution or a standard limit such as $\tfrac{\sin h}{h}\to1$.
Derivatives of $\sin x$ and $\cos x$
For trigonometric functions, step 2 of the strategy uses the sum formulae of Section 3.3, and step 4 uses the two standard limits of Section 12.2. That is why we needed $\tfrac{\sin h}{h}\to1$ and $\tfrac{1-\cos h}{h}\to0$.
For every real $x$ (in radians), $$\dfrac{d}{dx}(\sin x)=\cos x,\qquad\dfrac{d}{dx}(\cos x)=-\sin x.$$
Proof. By the sum formula, $\sin(x+h)=\sin x\cos h+\cos x\sin h$, so $$\begin{aligned}\dfrac{\sin(x+h)-\sin x}{h}&=\cos x\cdot\dfrac{\sin h}{h}\\&\quad-\sin x\cdot\dfrac{1-\cos h}{h}.\end{aligned}$$ Here $x$ is fixed and only $h$ varies. As $h\to0$ the first fraction tends to $1$ and the second to $0$ (Theorem 12.7), so the limit is $\cos x\cdot1-\sin x\cdot0=\cos x$.
Similarly $\cos(x+h)=\cos x\cos h-\sin x\sin h$, so $$\begin{aligned}\dfrac{\cos(x+h)-\cos x}{h}&=-\cos x\cdot\dfrac{1-\cos h}{h}\\&\quad-\sin x\cdot\dfrac{\sin h}{h},\end{aligned}$$ which tends to $-\cos x\cdot0-\sin x\cdot1=-\sin x$. $\blacksquare$
The graphs agree. $\sin x$ is steepest upwards at $x=0$, where $\cos0=1$; it is flat at its peak $x=\tfrac\pi2$, where $\cos\tfrac\pi2=0$; and it falls fastest at $x=\pi$, where $\cos\pi=-1$. The radian measure matters: in degrees, the slope of $\sin x^\circ$ at $0$ would be $\tfrac{\pi}{180}$, not $1$.
1. Writing $f(x+h)=f(x)+h$. For $f(x)=x^2$, $f(x+h)=(x+h)^2=x^2+2xh+h^2$, not $x^2+h$. Replace every $x$ by $(x+h)$.
2. Putting $h=0$ too early. Setting $h=0$ in $\tfrac{(x+h)^2-x^2}{h}$ gives $\tfrac00$. You must cancel $h$ first; only then let $h\to0$.
3. "Cancelling" $h$ that is not a factor. In $\tfrac{2xh+h^2}{h}$, $h$ is a factor of both terms, giving $2x+h$. In $\tfrac{(x+h)^2}{h}$ it is not โ expand and subtract $f(x)$ first.
4. Using $f'(x)$ for the tangent instead of $f'(a)$. The tangent at $x=a$ has the number $f'(a)$ as its slope: $y-f(a)=f'(a)(x-a)$. Writing $y-9=2x(x-3)$ for the tangent to $y=x^2$ at $(3,9)$ gives a parabola, not a line.
5. Degrees. $\tfrac{d}{dx}\sin x=\cos x$ only for radians, because it rests on $\tfrac{\sin h}{h}\to1$.
6. Assuming every function has a derivative. At a corner (like $|x|$ at $0$) or a jump (like $[x]$ at an integer) the difference quotient has no limit, so there is no derivative.
Exercises
- 1 $f(x)=x^2+1$; find $f'(2)$.
- 2 $f(x)=5x-3$; find $f'(-1)$.
- 3 $f(x)=2x^2-3x$; find $f'(1)$.
- 4 $f(x)=x^3$; find $f'(-2)$.
- 5 $f(x)=\dfrac1x$; find $f'(2)$.
- 6 $f(x)=\sqrt x$; find $f'(9)$.
- 7 Find the equation of the tangent to $y=x^2-4x$ at the point where $x=3$.
- 8 Show that $f(x)=|x-1|$ is not differentiable at $x=1$.
- 1 $f(x)=7$
- 2 $f(x)=3x+5$
- 3 $f(x)=x^2-2x$
- 4 $f(x)=x^3+x$
- 5 $f(x)=\dfrac{1}{x+2}$, $x\ne-2$
- 6 $f(x)=\dfrac2x$, $x\ne0$
- 7 $f(x)=\sqrt{x+1}$, $x\gt-1$
- 8 $f(x)=\dfrac{1}{2x+1}$, $x\ne-\tfrac12$
- 9 $f(x)=x^4$ (use the binomial theorem)
- 1 $\cos3x$
- 2 $\sin(x+1)$
- 3 $x+\sin x$
- 4 $\sin x\cos x$ (first write it as a single sine)
- 5 $\sec x$, where $\cos x\ne0$
- 6 $\cos^2x$ (first write it using $\cos2x$)
- 1 A stone is thrown upwards and its height is $y=30t-5t^2$ metres after $t$ seconds. Find its velocity at a general time $t=a$ from first principles, then at $t=1$ and $t=4$. When is the velocity $0$, and how high is the stone then?
- 2 Find the rate of change of the area $A=\pi r^2$ of a circle with respect to its radius when $r=5\ \text{cm}$. What do you notice about the answer?
- 3 Find the rate of change of the volume $V=x^3$ of a cube with respect to its edge $x$ when $x=2\ \text{cm}$.
- 4 A workshop's cost of making $x$ chairs is $C(x)=500+20x+0.05x^2$ rupees. Find $C'(x)$ from first principles and the marginal cost $C'(100)$. Compare it with the actual cost of the $101$st chair, $C(101)-C(100)$.
- 5 Find the tangent lines to $y=\sin x$ at $x=0$ and to $y=\cos x$ at $x=\tfrac\pi2$.
How this is examined: "Find the derivative of โฆ from first principles" is a near-certain Board question (2โ3 marks) โ polynomials, $\tfrac1x$-type fractions, square roots and simple trigonometric functions, with every step of the limit shown. Rate-of-change case studies use the derivative as a velocity. JEE uses the derivative as a slope (tangent conditions) and tests differentiability at corners.
E1. Board ยท 1 mark For $f(x)=x^2$, the value of $\displaystyle\lim_{h\to0}\dfrac{f(-3+h)-f(-3)}{h}$ is (A) $-6$ (B) $6$ (C) $9$ (D) $-9$
E2. Board ยท 2 marks Find the derivative of $f(x)=\dfrac{x}{x+1}$ from first principles.
E3. Board ยท 3 marks Find the derivative of $x\sin x$ from first principles.
E4. Board ยท Case study On a test track a car is $s(t)=2t^2+3t$ metres past the start line $t$ seconds after it begins. (i) Find its average velocity over $[1,3]$. (1 mark) (ii) Find its velocity at $t=2$ from first principles. (2 marks) (iii) At what time is its velocity $15\ \text{m/s}$? (1 mark)
E5. JEE Main The tangent to $y=x^2-5x+6$ at the point $P$ is parallel to the line $y=3x+1$. Then $P$ is (A) $(4,2)$ (B) $(1,2)$ (C) $(4,3)$ (D) $(-1,12)$
E6. JEE Advanced Numerical answer. Let $f(x)=x|x|$. Using the definition of the derivative, find $f'(0)+f'(2)$.
Research question. How fast was India's population growing in a given year โ and how well does a difference quotient from census data estimate that instantaneous growth rate?
Why it matters. Governments plan schools, hospitals and water supply from growth rates, not just totals. Census data come only every ten years, so planners estimate the rate at a particular year from differences โ exactly the difference quotient $\tfrac{P(t+h)-P(t)}{h}$ โ and they must decide which $h$ to use and whether to look forward, backward or both ways.
What to do.
- Collect India's census populations for $1971$, $1981$, $1991$, $2001$ and $2011$ (in crores) from an official or encyclopaedia source.
- Plot $P$ against the year and sketch by eye the tangent at $1991$. Estimate its slope (crores per year).
- Compute the forward difference quotient $\tfrac{P(2001)-P(1991)}{10}$, the backward one $\tfrac{P(1991)-P(1981)}{10}$, and their average, the centred quotient $\tfrac{P(2001)-P(1981)}{20}$. Which is closest to your tangent slope?
- Fit a quadratic $P(t)=a+bt+ct^2$ (with $t$ = years after $1971$) to three of the points in a spreadsheet, differentiate it, and compare $P'(20)$ with your quotients.
- Express each estimate as a percentage growth rate per year, $\tfrac{P'(t)}{P(t)}\times100\%$.
Tools: A spreadsheet or graphing app, census data
Hand in: Your table of data and quotients, the graph with the tangent at $1991$, the fitted model and a paragraph comparing the forward, backward and centred estimates.
Going further. For a quadratic model, show algebraically that the centred quotient $\tfrac{P(t+h)-P(t-h)}{2h}$ equals $P'(t)$ exactly, for every $h$. Why does that make the centred quotient the better estimate for real data?
๐งช Self-check quiz
Q1. The derivative of $f$ at $a$ is defined as
Q2. From first principles, the derivative of $x^2$ at $x=5$ is
Q3. With $x$ in radians, $\dfrac{d}{dx}(\cos x)$ is
Q4. The slope of the tangent to $y=\dfrac1x$ at the point $(1,1)$ is
Q5. Which statement about $f(x)=|x|$ at $x=0$ is correct?