-
Notifications
You must be signed in to change notification settings - Fork 26
/
ch-der.tex
1787 lines (1584 loc) · 58.7 KB
/
ch-der.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
\chapter{The Derivative} \label{der:chapter}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{The derivative}
\label{sec:der}
%mbxINTROSUBSECTION
\sectionnotes{1 lecture}
The idea of a derivative is the following.
If the graph of a function looks locally like a straight line,
then we can then talk about the slope of this line.
The slope tells us the rate at which
the value of the function is changing at that particular point.
Of course, we are leaving out any function that has corners or
discontinuities.
Let us be precise.
\subsection{Definition and basic properties}
\begin{defn}
Let $I$ be an interval, let
$f \colon I \to \R$ be a function, and let $c \in I$. If
the limit
\begin{equation*}
L \coloneqq \lim_{x \to c} \frac{f(x)-f(c)}{x-c}
\end{equation*}
exists, then we say $f$ is
\emph{\myindex{differentiable}}\index{function!differentiable} at
$c$, we call $L$ the \emph{\myindex{derivative}} of $f$ at $c$,
and we write $f'(c) \coloneqq L$.\glsadd{not:derivative}
\medskip
If $f$ is differentiable at all $c \in I$, then we simply say that
$f$ is \emph{differentiable}, and then we obtain a function
$f' \colon I \to \R$.
The derivative is sometimes written as $\frac{df}{dx}$ or
$\frac{d}{dx}\bigl( f(x) \bigr)$.
\medskip
The expression $\frac{f(x)-f(c)}{x-c}$ is called the
\emph{\myindex{difference quotient}}.
\end{defn}
The graphical interpretation of the derivative is depicted in
\figureref{derivfig}. The left-hand plot gives the line through
$\bigl(c,f(c)\bigr)$
and $\bigl(x,f(x)\bigr)$ with slope
$\frac{f(x)-f(c)}{x-c}$, that is,
the so-called \emph{\myindex{secant line}}. When we take the limit as $x$ goes to $c$,
we get the right-hand plot, where we see
that the derivative of the function
at the point $c$ is the slope of the line tangent to the graph of $f$
at the point $\bigl(c,f(c)\bigr)$.
\begin{myfigureht}
\subimport*{figures/}{deriv_derivd.pdf_t}
\caption{Graphical interpretation of the derivative.\label{derivfig}}
\end{myfigureht}
We allow $I$ to be a closed interval and we allow
$c$ to be an endpoint of $I$. Some calculus books do not allow $c$ to be an
endpoint of an interval, but all the theory still works by allowing it, and
it makes our work easier.
\begin{example}
Let $f(x) \coloneqq x^2$ defined on the whole real line. Let $c \in \R$ be arbitrary. We find that if
$x \not=c$,
\begin{equation*}
\frac{x^2-c^2}{x-c} =
\frac{(x+c)(x-c)}{x-c} =
(x+c) .
\end{equation*}
Therefore,
\begin{equation*}
f'(c) =
\lim_{x\to c} \frac{x^2-c^2}{x-c} =
\lim_{x\to c} (x+c) = 2c.
\end{equation*}
\end{example}
\begin{example}
Let $f(x) \coloneqq ax + b$ for numbers $a, b \in \R$.
Let $c \in \R$ be arbitrary.
For $x \not=c$,
\begin{equation*}
\frac{f(x)-f(c)}{x-c} =
\frac{a(x-c)}{x-c} = a .
\end{equation*}
Therefore,
\begin{equation*}
f'(c) =
\lim_{x\to c}
\frac{f(x)-f(c)}{x-c} =
\lim_{x\to c}
a = a.
\end{equation*}
In fact, every differentiable function \myquote{infinitesimally} behaves like
the affine function $ax + b$. You can guess many results
and formulas for derivatives, if you work them out for affine functions
first.
\end{example}
\begin{example}
The function $f(x) \coloneqq \sqrt{x}$ is differentiable for $x > 0$. To see this
fact, fix $c > 0$,
and suppose $x \not= c$ and $x > 0$. Compute
\begin{equation*}
\frac{\sqrt{x}-\sqrt{c}}{x-c}
=
\frac{\sqrt{x}-\sqrt{c}}{(\sqrt{x}-\sqrt{c})(\sqrt{x}+\sqrt{c})}
=
\frac{1}{\sqrt{x}+\sqrt{c}} .
\end{equation*}
Therefore,
\begin{equation*}
f'(c) =
\lim_{x\to c}
\frac{\sqrt{x}-\sqrt{c}}{x-c}
=
\lim_{x\to c}
\frac{1}{\sqrt{x}+\sqrt{c}}
=
\frac{1}{2\sqrt{c}} .
\end{equation*}
\end{example}
\begin{example}
The function $f(x) \coloneqq \abs{x}$ is not differentiable
at the origin. When $x > 0$,
\begin{equation*}
\frac{\abs{x}-\abs{0}}{x-0} =
\frac{x-0}{x-0} = 1 .
\end{equation*}
When $x < 0$,
\begin{equation*}
\frac{\abs{x}-\abs{0}}{x-0} =
\frac{-x-0}{x-0} = -1 .
\end{equation*}
\end{example}
A famous example of Weierstrass shows that there exists a continuous
function that is not differentiable at \emph{any} point. The construction
of this function is beyond the scope of this chapter. On the other hand,
a differentiable function is always continuous.
\begin{prop}
Let $f \colon I \to \R$ be differentiable at $c \in I$,
then it is continuous at $c$.
\end{prop}
\begin{proof}
We know the limits
\begin{equation*}
\lim_{x\to c}\frac{f(x)-f(c)}{x-c} = f'(c)
\qquad
\text{and}
\qquad
\lim_{x\to c}(x-c) = 0
\end{equation*}
exist. Furthermore,
\begin{equation*}
f(x)-f(c) =
\left( \frac{f(x)-f(c)}{x-c} \right) (x-c) .
\end{equation*}
Therefore, the limit of $f(x)-f(c)$ exists and
\begin{equation*}
\lim_{x\to c} \bigl( f(x)-f(c) \bigr) =
\left(\lim_{x\to c} \frac{f(x)-f(c)}{x-c} \right)
\left(\lim_{x\to c} (x-c) \right) =
f'(c) \cdot 0 = 0.
\end{equation*}
Hence $\lim\limits_{x\to c} f(x) = f(c)$, and $f$ is continuous at $c$.
\end{proof}
An important property of the derivative is linearity. The
derivative is the approximation of a function by a straight line.
The slope of a line through two points changes linearly when the
$y$-coordinates are changed linearly. By taking the limit,
it makes sense that the derivative is linear.
\begin{prop}[Linearity]
\index{linearity of the derivative}
Let $I$ be an interval, let
$f \colon I \to \R$ and $g \colon I \to \R$ be differentiable at $c \in I$,
and let $\alpha \in \R$.
\begin{enumerate}[(i)]
\item
Define $h \colon I \to \R$ by $h(x) \coloneqq \alpha f(x)$. Then
$h$ is differentiable at $c$ and
$h'(c) = \alpha f'(c)$.
\item
Define $h \colon I \to \R$ by $h(x) \coloneqq f(x) + g(x)$. Then
$h$ is differentiable at $c$ and
$h'(c) = f'(c) + g'(c)$.
\end{enumerate}
\end{prop}
\begin{proof}
First, let $h(x) \coloneqq \alpha f(x)$.
For $x \in I$, $x \not= c$,
\begin{equation*}
\frac{h(x)-h(c)}{x-c} =
\frac{\alpha f(x) - \alpha f(c)}{x-c}
=
\alpha \frac{f(x) - f(c)}{x-c} .
\end{equation*}
The limit as $x$ goes to $c$ exists on the right-hand side
by \corref{falg:cor}. We get
\begin{equation*}
\lim_{x\to c}\frac{h(x)-h(c)}{x-c} =
\alpha \lim_{x\to c} \frac{f(x) - f(c)}{x-c} .
\end{equation*}
Therefore, $h$ is differentiable at $c$,
and the derivative is computed as given.
Next, define $h(x) \coloneqq f(x)+g(x)$.
For $x \in I$, $x \not= c$, we have
\begin{equation*}
\frac{h(x)-h(c)}{x-c} =
\frac{\bigl(f(x) + g(x)\bigr) - \bigl(f(c) + g(c)\bigr)}{x-c}
=
\frac{f(x) - f(c)}{x-c}
+
\frac{g(x) - g(c)}{x-c} .
\end{equation*}
The limit as $x$ goes to $c$ exists on the right-hand side
by \corref{falg:cor}. We get
\begin{equation*}
\lim_{x\to c}\frac{h(x)-h(c)}{x-c} =
\lim_{x\to c} \frac{f(x) - f(c)}{x-c}
+
\lim_{x\to c}\frac{g(x) - g(c)}{x-c} .
\end{equation*}
Therefore, $h$ is differentiable at $c$,
and the derivative is computed as given.
\end{proof}
It is not true that the derivative of a product of two functions is
the product of the derivatives. Instead we get the so-called \emph{product
rule} or the \emph{\myindex{Leibniz rule}}%
\footnote{Named for the German mathematician
\href{https://en.wikipedia.org/wiki/Leibniz}{Gottfried Wilhelm Leibniz}
(1646--1716).}.
\begin{prop}[Product rule]\index{product rule}
Let $I$ be an interval, let
$f \colon I \to \R$ and $g \colon I \to \R$ be
functions differentiable at $c$. If $h \colon I \to \R$
is defined by
\begin{equation*}
h(x) \coloneqq f(x) g(x) ,
\end{equation*}
then $h$ is differentiable at $c$ and
\begin{equation*}
h'(c) = f(c) g'(c) + f'(c) g(c) .
\end{equation*}
\end{prop}
The proof of the product rule is left as an exercise. The key to the proof is
the identity
$f(x) g(x) - f(c) g(c) =
f(x)\bigl( g(x) - g(c) \bigr)
+ \bigl( f(x) - f(c) \bigr) g(c)$,
which is illustrated in \figureref{figprodrule}.
\begin{myfigureht}
\subimport*{figures/}{figprodrule.pdf_t}
\caption{The idea of product rule. The area of the entire rectangle
$f(x)g(x)$ differs from the area of the white rectangle $f(c)g(c)$
by the area of the lightly shaded rectangle
$f(x)\bigl( g(x) - g(c) \bigr)$ plus the darker rectangle
$\bigl( f(x) - f(c) \bigr) g(c)$.
In other words, $\Delta (f \cdot g)
= f \cdot \Delta g + \Delta f \cdot g$.\label{figprodrule}}
\end{myfigureht}
\begin{prop}[Quotient rule]\index{quotient rule}
Let $I$ be an interval, let
$f \colon I \to \R$ and $g \colon I \to \R$ be differentiable at $c$
and $g(x) \not= 0$ for all $x \in I$.
If $h \colon I \to \R$
is defined by
\begin{equation*}
h(x) \coloneqq \frac{f(x)}{g(x)},
\end{equation*}
then $h$ is differentiable at $c$ and
\begin{equation*}
h'(c) = \frac{f'(c) g(c) - f(c) g'(c)}{{\bigl(g(c)\bigr)}^2} .
\end{equation*}
\end{prop}
Again, the proof is left as an exercise.
\subsection{Chain rule}
More complicated functions are often obtained by composition,
which is differentiated via the chain rule. The rule also tells us
how a derivative changes if we change variables.
\begin{prop}[Chain rule]
\index{chain rule}
Let $I_1, I_2$ be intervals, let
$g \colon I_1 \to I_2$ be differentiable at $c \in I_1$,
and
$f \colon I_2 \to \R$ be differentiable at $g(c)$.
If $h \colon I_1 \to \R$
is defined by
\begin{equation*}
h(x) \coloneqq (f \circ g) (x) = f\bigl(g(x)\bigr) ,
\end{equation*}
then $h$ is differentiable at $c$ and
\begin{equation*}
h'(c) = f'\bigl(g(c)\bigr)g'(c) .
\end{equation*}
\end{prop}
\begin{proof}
Let $d \coloneqq g(c)$. Define
$u \colon I_2 \to \R$ and $v \colon I_1 \to \R$ by
\begin{equation*}
u(y) \coloneqq
\begin{cases}
\frac{f(y) - f(d)}{y-d} & \text{if } y \not=d, \\
f'(d) & \text{if } y = d,
\end{cases}
\qquad
v(x) \coloneqq
\begin{cases}
\frac{g(x) - g(c)}{x-c} & \text{if } x \not=c, \\
g'(c) & \text{if } x = c.
\end{cases}
\end{equation*}
Because $f$ is differentiable at $d = g(c)$, we find that
$u$ is continuous at $d$. Similarly, $v$ is continuous at $c$.
For any $x$ and $y$,
\begin{equation*}
f(y)-f(d) = u(y) (y-d)
\qquad \text{and} \qquad
g(x)-g(c) = v(x) (x-c) .
\end{equation*}
Plug in to obtain
\begin{equation*}
h(x)-h(c)
=
f\bigl(g(x)\bigr)-f\bigl(g(c)\bigr)
=
u\bigl( g(x) \bigr) \bigl(g(x)-g(c)\bigr)
=
u\bigl( g(x) \bigr) \bigl(v(x) (x-c)\bigr) .
\end{equation*}
Therefore, if $x \not= c$,
\begin{equation} \label{eq:chainruleeq}
\frac{h(x)-h(c)}{x-c}
=
u\bigl( g(x) \bigr) v(x) .
\end{equation}
By continuity of $u$ and $v$ at $d$ and $c$ respectively, we find
$\lim_{y \to d} u(y)
= f'(d) = f'\bigl(g(c)\bigr)$ and
$\lim_{x \to c} v(x) = g'(c)$.
The function $g$ is continuous at $c$, and so $\lim_{x \to c} g(x) = g(c)$.
Hence the limit of
the right-hand side of \eqref{eq:chainruleeq}
as $x$ goes to $c$
exists and is equal to $f'\bigl(g(c)\bigr) g'(c)$. Thus $h$
is differentiable at $c$ and $h'(c) = f'\bigl(g(c)\bigr)g'(c)$.
\end{proof}
\subsection{Exercises}
\begin{exercise}
Prove the product rule.
Hint: Prove and use
$f(x) g(x) - f(c) g(c) = f(x)\bigl( g(x) - g(c) \bigr) + \bigl( f(x) -
f(c) \bigr) g(c)$.
\end{exercise}
\begin{exercise}
Prove the quotient rule. Hint: You can do this directly, but it may be
easier to find the derivative of $\nicefrac{1}{x}$ and then use
the chain rule and the product rule.
\end{exercise}
\begin{exercise} \label{exercise:diffofxn}
For $n \in \Z$,
prove that $x^n$ is differentiable and find the derivative,
unless, of course, $n < 0$ and $x=0$.
Hint: Use the product rule.
\end{exercise}
\begin{exercise}
Prove that a polynomial is differentiable and find the derivative.
Hint: Use the previous exercise.
\end{exercise}
\begin{exercise}
Define $f \colon \R \to \R$ by
\begin{equation*}
f(x) \coloneqq
\begin{cases}
x^2 & \text{if } x \in \Q,\\
0 & \text{otherwise.}
\end{cases}
\end{equation*}
Prove that $f$ is differentiable at $0$, but discontinuous at all points
except $0$.
\end{exercise}
\begin{exercise}
Assume the inequality $\abs{x-\sin(x)} \leq x^2$. Prove that $\sin$ is
differentiable at $0$, and find the derivative at $0$.
\end{exercise}
\begin{exercise}
Using the previous exercise, prove that $\sin$ is differentiable at all $x$
and that the derivative is $\cos(x)$. Hint: Use the sum-to-product
trigonometric identity as we did before.
\end{exercise}
\begin{exercise}
Let $f \colon I \to \R$ be differentiable. For $n \in \Z$, let $f^n$
be the function defined by $f^n(x) \coloneqq {\bigl( f(x) \bigr)}^n$. If
$n < 0$, assume $f(x) \not= 0$ for all $x \in I$. Prove that
$(f^n)'(x) = n {\bigl(f(x) \bigr)}^{n-1} f'(x)$.
\end{exercise}
\begin{exercise}
Suppose $f \colon \R \to \R$ is a differentiable
Lipschitz continuous function.
Prove that $f'$ is a bounded function.
\end{exercise}
\begin{exercise} \label{exercise:inversederformula}
Let $I_1, I_2$ be intervals.
Let $f \colon I_1 \to I_2$ be a bijective function and $g \colon I_2 \to I_1$
be the inverse. Suppose that both $f$ is differentiable at $c \in I_1$ and
$f'(c) \not=0$ and $g$ is differentiable at $f(c)$. Use the chain rule
to find a formula for $g'\bigl(f(c)\bigr)$ (in terms of $f'(c)$).
\end{exercise}
\begin{exercise} \label{exercise:bndmuldiff}
Suppose $f \colon I \to \R$ is bounded, $g \colon I \to
\R$ is differentiable at $c \in I$, and $g(c) = g'(c) = 0$. Show
that $h(x) \coloneqq f(x) g(x)$ is differentiable at $c$. Hint: You
cannot apply the product rule.
\end{exercise}
\begin{exercise} \label{exercise:diffsqueeze}
Suppose $f \colon I \to \R$,
$g \colon I \to \R$, and
$h \colon I \to \R$, are functions. Suppose $c \in I$ is such that
$f(c) = g(c) = h(c)$, $g$ and $h$ are differentiable at $c$,
and $g'(c) = h'(c)$. Furthermore suppose $h(x) \leq f(x) \leq g(x)$ for
all $x \in I$. Prove $f$ is differentiable at $c$ and $f'(c) = g'(c) =
h'(c)$.
\end{exercise}
\begin{exercise}
Suppose $f \colon (-1,1) \to \R$ is a function such that $f(x) = x h(x)$ for a bounded
function $h$.
\begin{enumerate}[a)]
\item
Show that $g(x) \coloneqq {\bigl( f(x) \bigr)}^2$ is
differentiable at the origin and $g'(0) = 0$.
\item
Find an example of a
continuous function $f \colon (-1,1) \to \R$ with $f(0) = 0$, but such
that $g(x) \coloneqq {\bigl( f(x) \bigr)}^2$ is not differentiable at the origin.
\end{enumerate}
\end{exercise}
\begin{exercise}
Suppose $f \colon I \to \R$ is differentiable at $c \in I$.
Prove there exist numbers $a$ and $b$ with the property that
for every $\epsilon > 0$, there is a $\delta > 0$, such that
$\abs{a+b(x-c) - f(x)} \leq \epsilon \abs{x-c}$, whenever $x \in I$ and
$\abs{x-c} < \delta$.
In other words, show that
there exists a function $g \colon I \to \R$
such that $\lim_{x\to c} g(x) = 0$ and
$\abs{a+b(x-c) - f(x)} = g(x) \abs{x-c}$.
\end{exercise}
\begin{exercise} \label{exercise:simpleLHopital}
Prove the following simple version of \myindex{L'H\^opital's rule}\index{L'Hospital's rule}.
Suppose
$f \colon (a,b) \to \R$ and $g \colon (a,b) \to \R$ are differentiable
functions
whose derivatives $f'$ and $g'$ are continuous functions.
Suppose that at $c \in (a,b)$, $f(c) = 0$, $g(c)=0$,
$g'(x) \not= 0$ for all $x \in (a,b)$, and
$g(x) \not= 0$ whenever $x \not= c$. Note
that the limit of $\nicefrac{f'(x)}{g'(x)}$ as $x$ goes to $c$ exists. Show that
\begin{equation*}
\lim_{x \to c} \frac{f(x)}{g(x)} =
\lim_{x \to c} \frac{f'(x)}{g'(x)} .
\end{equation*}
\end{exercise}
\begin{exercise}
Suppose $f \colon (a,b) \to \R$ is differentiable at $c \in (a,b)$,
$f(c)=0$, and $f'(c) > 0$.
Prove that there is a $\delta > 0$ such that $f(x) < 0$
whenever $c-\delta < x < c$ and
$f(x) > 0$
whenever $c < x < c+\delta$.
\end{exercise}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\sectionnewpage
\section{Mean value theorem}
\label{sec:mvt}
%mbxINTROSUBSECTION
\sectionnotes{2 lectures (some applications may be skipped)}
\subsection{Relative minima and maxima}
We talked about absolute maxima and minima. These are the tallest peaks and
the lowest valleys in the entire mountain range. What
about peaks of individual mountains and bottoms of individual valleys?
The derivative, being a local concept, is like walking around in a fog; it
cannot tell you if you are on the highest peak, but it can tell you whether you are
at the top of some peak.
\begin{defn}
Let $S \subset \R$ be a set and
let $f \colon S \to \R$ be a function. The function $f$ is said to have
a \emph{\myindex{relative maximum}}\index{maximum!relative}
at $c \in S$ if there exists a $\delta>0$
such that for all $x \in S$ where $\abs{x-c} < \delta$,
we have $f(x) \leq f(c)$.
The definition of
\emph{\myindex{relative minimum}}\index{minimum!relative}
is analogous.
\end{defn}
\begin{lemma}\label{relminmax:lemma}
Suppose $f \colon (a,b) \to \R$ is differentiable at $c \in (a,b)$,
and $f$ has
a relative minimum or a relative maximum at $c$. Then
$f'(c) = 0$.
\end{lemma}
\begin{proof}
Suppose $c$ is a
relative maximum of $f$. That is, there is a $\delta > 0$ such
that for every $x \in (a,b)$ where
$\abs{x-c} < \delta$, we have $f(x)-f(c) \leq 0$.
Consider the difference
quotient. If $c < x < c+\delta$, then
\begin{equation*}
\frac{f(x)-f(c)}{x-c} \leq 0 ,
\end{equation*}
and if $c-\delta < y < c$, then
\begin{equation*}
\frac{f(y)-f(c)}{y-c} \geq 0 .
\end{equation*}
See \figureref{fig:critpt} for an illustration.
\begin{myfigureht}
\includegraphics{figures/critpt}
\caption{Slopes of secants at a relative maximum.\label{fig:critpt}}
\end{myfigureht}
As $a < c < b$, there exist
sequences $\{ x_n \}_{n=1}^\infty$ and
$\{ y_n \}_{n=1}^\infty$ in $(a,b)$ and within $\delta$ of $c$,
such that $x_n > c$, and
$y_n < c$ for all $n \in \N$, and such that
$\lim_{n\to\infty} x_n = \lim_{n\to\infty} y_n = c$.
Since $f$
is differentiable at $c$,
\begin{equation*}
0 \geq \lim_{n\to\infty} \frac{f(x_n)-f(c)}{x_n-c}
=
f'(c)
=
\lim_{n\to\infty} \frac{f(y_n)-f(c)}{y_n-c} \geq 0.
\end{equation*}
We are done with a maximum.
For a minimum, consider
the function $-f$.
\end{proof}
For a differentiable function, a point where
$f'(c) = 0$ is called a \emph{\myindex{critical point}}. When $f$ is not
differentiable at some points,
it is common to also say that $c$ is a critical point
if $f'(c)$ does not exist.
The theorem says that a relative minimum or maximum at an interior point
of an interval must be a critical point.
As you remember from calculus, one finds minima and maxima of a function
by finding all the critical points together with the endpoints of
the interval and simply checking at which of these points
is the function biggest or smallest.
\subsection{Rolle's theorem}
Suppose a function has the same value at both endpoints of an interval.
Intuitively it ought to attain a minimum or a maximum in the interior of the
interval,
then at such a minimum or a maximum, the derivative should be zero.
See \figureref{rollefig} for the geometric idea. This is the content of the
so-called Rolle's theorem%
\footnote{Named after the French mathematician
\href{https://en.wikipedia.org/wiki/Michel_Rolle}{Michel Rolle}
(1652--1719).}.
\begin{myfigureht}
\includegraphics{figures/rollefig}
\caption{Point where the tangent line is horizontal, that is $f'(c) =
0$.\label{rollefig}}
\end{myfigureht}
\begin{thm}[Rolle] \label{thm:rolle}
\index{Rolle's theorem}
Let $f \colon [a,b] \to \R$ be a continuous function
differentiable on $(a,b)$ such that $f(a) = f(b)$.
Then there exists a $c \in (a,b)$ such that $f'(c) = 0$.
\end{thm}
\begin{proof}
As $f$ is continuous on $[a,b]$, it attains an absolute minimum and an
absolute
maximum in $[a,b]$. We wish to apply \lemmaref{relminmax:lemma}, and
so we need to find some $c \in (a,b)$ where $f$ attains a minimum or a
maximum.
Write $K \coloneqq f(a) = f(b)$.
If there exists an $x$ such that $f(x) > K$, then the absolute
maximum is bigger than $K$ and hence occurs at some $c \in (a,b)$, and
therefore $f'(c) = 0$. On the other hand, if there exists an $x$
such that $f(x) < K$, then the absolute minimum occurs at some
$c \in (a,b)$, and so $f'(c) = 0$. If there is no $x$ such that
$f(x) > K$ or
$f(x) < K$, then $f(x) = K$ for all $x$ and then
$f'(x) = 0$ for all $x \in [a,b]$, so any $c \in (a,b)$ works.
\end{proof}
It is absolutely necessary for the derivative to exist for all $x
\in (a,b)$. Consider the function $f(x) \coloneqq \abs{x}$ on $[-1,1]$.
Clearly $f(-1) = f(1)$, but there is no point $c$ where $f'(c) = 0$.
\subsection{Mean value theorem}
We extend \hyperref[thm:rolle]{Rolle's theorem}
to functions that attain different
values at the endpoints.
\begin{thm}[Mean value theorem] \label{thm:mvt}
\index{mean value theorem}
Let $f \colon [a,b] \to \R$ be a continuous function
differentiable on $(a,b)$. Then there exists a point $c \in (a,b)$
such that
\begin{equation*}
f(b)-f(a) = f'(c)(b-a) .
\end{equation*}
\end{thm}
For a geometric interpretation of the mean value theorem, see
\figureref{mvtfig}. The idea is that the value $\frac{f(b)-f(a)}{b-a}$
is the slope of the line between the points $\bigl(a,f(a)\bigr)$
and $\bigl(b,f(b)\bigr)$.
Then $c$ is the point such that $f'(c) = \frac{f(b)-f(a)}{b-a}$, that
is, the tangent line at the point $\bigl(c,f(c)\bigr)$ has the same slope as the
line between $\bigl(a,f(a)\bigr)$ and $\bigl(b,f(b)\bigr)$.
The name comes from the fact that the slope of the secant line
is the mean value of the derivative, so the average derivative is achieved
in the interior of the interval.
The theorem follows from \hyperref[thm:rolle]{Rolle's theorem},
by subtracting from $f$ the affine linear function with the derivative
$\frac{f(b)-f(a)}{b-a}$ with the same values at $a$ and $b$ as $f$.
That is, we subtract the function whose graph is the straight line
$\bigl(a,f(a)\bigr)$ and $\bigl(b,f(b)\bigr)$.
Then we are looking for a point where this new
function has derivative zero.
\begin{myfigureht}
\includegraphics{figures/mvtfig}
\caption{Graphical interpretation of the mean value theorem.\label{mvtfig}}
\end{myfigureht}
\begin{proof}
Define the
function $g \colon [a,b] \to \R$ by
\begin{equation*}
g(x) \coloneqq f(x)-f(b)-\frac{f(b)-f(a)}{b-a}(x-b) .
\end{equation*}
The function $g$ is differentiable on $(a,b)$,
continuous on $[a,b]$, such that $g(a) = 0$ and $g(b) = 0$. Thus there exists
a
$c \in (a,b)$ such that $g'(c) = 0$, that is,
\begin{equation*}
0 = g'(c) = f'(c)-\frac{f(b)-f(a)}{b-a} .
\end{equation*}
In other words,
$f(b)-f(a) = f'(c)(b-a)$.
\end{proof}
The proof generalizes. By considering
$g(x) \coloneqq
f(x)-f(b)-\frac{f(b)-f(a)}{\varphi(b)-\varphi(a)}\bigl(\varphi(x)-\varphi(b)\bigr)$,
one can prove the following version. We leave the proof as an exercise.
\begin{thm}[Cauchy's mean value theorem] \label{thm:cauchymvt}
\index{Cauchy's mean value theorem}
Let $f \colon [a,b] \to \R$ and $\varphi \colon [a,b] \to \R$ be continuous
functions
differentiable on $(a,b)$. Then there exists a point $c \in (a,b)$
such that
\begin{equation*}
\bigl(f(b)-f(a)\bigr)\varphi'(c) = f'(c)\bigl(\varphi(b)-\varphi(a)\bigr) .
\end{equation*}
\end{thm}
The mean value theorem has the distinction of being one of the few theorems
commonly cited
in court. That is, when police measure the speed of cars by aircraft, or
via cameras reading license plates, they
measure the time the car takes to go between two points.
The mean value theorem then
says that the car must have somewhere attained the speed you get by dividing the
difference in distance by the difference in time.
\subsection{Applications}
Let us look at a few applications of the mean value theorem.
The applications show the typical use of the theorem, which is
to get rid of a limit by finding the right sort of points where the
derivative is not just close to some difference quotient, but actually
equal to one.
First, we solve our very first differential equation.
\begin{prop} \label{prop:derzeroconst}
Let $I$ be an interval and
let $f \colon I \to \R$ be a differentiable function such that $f'(x) = 0$
for all $x \in I$.
Then $f$ is constant.
\end{prop}
\begin{proof}
Take arbitrary $x,y \in I$ with $x < y$.
As $I$ is an interval, $[x,y] \subset I$.
Then $f$ restricted to $[x,y]$ satisfies the hypotheses
of the \hyperref[thm:mvt]{mean value theorem}.
Therefore, there is a $c \in (x,y)$ such that
\begin{equation*}
f(y)-f(x) = f'(c)(y-x).
\end{equation*}
As $f'(c) = 0$, we have $f(y) = f(x)$. Hence,
the function is constant.
\end{proof}
Now that we know what it means for the function to stay constant, we look
at increasing and decreasing functions.
We say $f \colon I \to \R$ is \emph{\myindex{increasing}}
(resp.\ \emph{\myindex{strictly increasing}}) if
$x < y$ implies $f(x) \leq f(y)$ (resp.\ $f(x) < f(y)$).
We define
\emph{\myindex{decreasing}} and
\emph{\myindex{strictly decreasing}} in the same way by switching the
inequalities for $f$.
\begin{prop} \label{incdecdiffprop}
Let $I$ be an interval and
let $f \colon I \to \R$ be a differentiable function.
%\begin{enumerate}[(i),itemsep=0.5\itemsep,parsep=0.5\parsep,topsep=0.5\topsep,partopsep=0.5\partopsep]
\begin{enumerate}[(i)]
\item $f$ is increasing if and only if $f'(x) \geq 0$ for all $x \in I$.
\item $f$ is decreasing if and only if $f'(x) \leq 0$ for all $x \in I$.
\end{enumerate}
\end{prop}
\begin{proof}
Let us prove the first item. Suppose $f$ is increasing.
For all $x,c \in I$ with $x \neq c$,
\begin{equation*}
\frac{f(x)-f(c)}{x-c} \geq 0 .
\end{equation*}
Taking a limit as $x$ goes to $c$, we see that $f'(c) \geq 0$.
For the other direction, suppose $f'(x) \geq 0$ for all $x \in I$.
Take any $x, y \in I$ where $x < y$, and note that $[x,y] \subset I$.
By the \hyperref[thm:mvt]{mean value theorem}, there is some $c \in (x,y)$ such that
\begin{equation*}
f(y)-f(x) = f'(c)(y-x) .
\end{equation*}
As $f'(c) \geq 0$ and $y-x > 0$, then $f(y) - f(x) \geq 0$ or $f(x) \leq
f(y)$, and so
$f$ is increasing.
We leave the second item, decreasing $f$, to the reader as exercise.
\end{proof}
A similar but weaker statement is true for strictly increasing and
decreasing functions.
\begin{prop} \label{incdecdiffstrictprop}
Let $I$ be an interval and
let $f \colon I \to \R$ be a differentiable function.
\begin{enumerate}[(i)]
\item
\label{incdecdiffstrictprop:i}
If $f'(x) > 0$ for all $x \in I$, then
$f$ is strictly increasing.
\item
\label{incdecdiffstrictprop:ii}
If $f'(x) < 0$ for all $x \in I$,
then $f$ is strictly decreasing.
\end{enumerate}
\end{prop}
The proof of
\ref{incdecdiffstrictprop:i}
is left as an exercise.
Then \ref{incdecdiffstrictprop:ii}
follows from
\ref{incdecdiffstrictprop:i} by considering $-f$
instead.
The converse of this proposition is not true. The function
$f(x) \coloneqq x^3$ is strictly increasing, but $f'(0) = 0$.
\medskip
Another application of the \hyperref[thm:mvt]{mean value theorem} is the following result about
location of extrema, sometimes called the
\emph{\myindex{first derivative test}}.
The result is stated for an absolute minimum and maximum.
To apply it to find relative minima
and maxima, restrict $f$ to an interval $(c-\delta,c+\delta)$.
\begin{prop} \label{firstderminmaxtest}
Let $f \colon (a,b) \to \R$ be continuous. Let $c \in (a,b)$
and suppose
$f$ is differentiable on $(a,c)$ and $(c,b)$.
\begin{enumerate}[(i)]
\item If $f'(x) \leq 0$ whenever $x \in (a,c)$ and
$f'(x) \geq 0$ whenever $x \in (c,b)$, then $f$ has an absolute minimum
at $c$.
\item If $f'(x) \geq 0$ whenever $x \in (a,c)$ and
$f'(x) \leq 0$ whenever $x \in (c,b)$, then $f$ has an absolute maximum
at $c$.
\end{enumerate}
\end{prop}
\begin{proof}
We prove the first item and leave the second to the reader.
Take $x \in (a,c)$
and a sequence $\{ y_n\}_{n=1}^\infty$ such that $x < y_n < c$ for all $n$
and $\lim_{n\to\infty} y_n = c$.
By the preceding proposition,
$f$ is decreasing on $(a,c)$ so $f(x) \geq f(y_n)$ for all $n$.
As $f$ is
continuous at $c$, we take the limit to get
$f(x) \geq f(c)$.
Similarly, take $x \in (c,b)$
and $\{ y_n\}_{n=1}^\infty$ a sequence such that $c < y_n < x$ and
$\lim_{n\to\infty} y_n = c$.
The function is increasing on $(c,b)$ so $f(x) \geq f(y_n)$ for all $n$.
By continuity of $f$, we get
$f(x) \geq f(c)$. Thus $f(x) \geq f(c)$ for all
$x \in (a,b)$.
\end{proof}
The converse of the proposition does not hold. See
\exampleref{baddifffunc:example} below.
\medskip
Another often used application of the mean value theorem you have possibly
seen in calculus is the following result on differentiability at the
end points of an interval. The proof is
\exerciseref{exercise:endpointderivative}.
\begin{prop} \label{prop:endpointderivative}
\leavevmode
\begin{enumerate}[(i)]
\item
Suppose $f \colon [a,b) \to \R$ is continuous, differentiable in $(a,b)$,
and $\lim_{x \to a} f'(x) = L$. Then $f$ is differentiable at $a$ and
$f'(a) = L$.
\item
Suppose $f \colon (a,b] \to \R$ is continuous, differentiable in $(a,b)$,
and $\lim_{x \to b} f'(x) = L$. Then $f$ is differentiable at $b$ and
$f'(b) = L$.
\end{enumerate}
\end{prop}
In fact, using the extension result \propref{context:prop}, you do not need to assume
that $f$ is defined at the end point. See \exerciseref{exercise:extendboundedder}.
\subsection{Continuity of derivatives and the intermediate value theorem}
Derivatives of functions satisfy an
intermediate value property.
\begin{thm}[Darboux] \label{thm:darboux} \index{Darboux's theorem}
Let $f \colon [a,b] \to \R$ be differentiable. Suppose $y \in \R$ is such
that $f'(a) < y < f'(b)$ or
$f'(a) > y > f'(b)$. Then there exists a $c \in (a,b)$ such that $f'(c) =
y$.
\end{thm}
The proof follows by subtracting $f$ and a linear function with derivative
$y$. The new function $g$ reduces the problem
to the case $y=0$, where $g'(a) > 0 > g'(b)$. That is, $g$ is increasing at $a$ and
decreasing at $b$, so it must attain a maximum inside $(a,b)$,
where the derivative is zero. See \figureref{darbouxthmfig}.
\begin{myfigureht}
\includegraphics{figures/darbouxthmfig}
\caption{Idea of the proof of Darboux theorem.\label{darbouxthmfig}}
\end{myfigureht}
\begin{proof}
Suppose
$f'(a) < y < f'(b)$.
Define
\begin{equation*}
g(x) \coloneqq yx - f(x) .
\end{equation*}
The function $g$ is continuous on $[a,b]$, and so $g$ attains a maximum at some $c \in
[a,b]$.
The function $g$ is also differentiable on $[a,b]$.
Compute $g'(x) = y-f'(x)$. Thus $g'(a) > 0$. As the derivative is
the limit of difference quotients and is positive, there must be some
difference quotient that is positive. That is, there must exist
an $x > a$ such that
\begin{equation*}
\frac{g(x)-g(a)}{x-a} > 0 ,
\end{equation*}
or $g(x) > g(a)$. Thus $g$
cannot possibly have a maximum at $a$. Similarly, as $g'(b) < 0$,
we find an $x < b$ (a different $x$) such that
$\frac{g(x)-g(b)}{x-b} < 0$ or that $g(x) > g(b)$, thus
$g$ cannot possibly have a maximum at $b$.
Therefore, $c \in (a,b)$,
and \lemmaref{relminmax:lemma} applies: As $g$ attains a maximum
at $c$ we find $g'(c) = 0$
and so $f'(c) = y$.
Similarly, if $f'(a) > y > f'(b)$, consider $g(x) \coloneqq f(x)- yx$.
\end{proof}
We have seen already that
there exist discontinuous functions that have the
intermediate value property. While it is hard to imagine at first, there
also
exist functions that are differentiable everywhere and the derivative is not
continuous.
\begin{example} \label{baddifffunc:example}
Let $f \colon \R \to \R$ be the function defined by
\begin{equation*}
f(x) \coloneqq
\begin{cases}
{\bigl( x \sin(\nicefrac{1}{x}) \bigr)}^2 & \text{if } x \not= 0, \\
0 & \text{if } x = 0.
\end{cases}
\end{equation*}
We claim that $f$ is differentiable everywhere, but
$f' \colon \R \to \R$ is not continuous at
the origin. Furthermore, $f$ has a minimum at $0$, but the derivative
changes sign infinitely often near the origin.
See \figureref{fig:nonc1diff}.
\begin{myfigureht}
\subimport*{figures/}{nonc1diff_full.pdf_t}
\caption{A function with a discontinuous derivative. The function $f$ is on the left
and $f'$ is on the right. Notice that $f(x) \leq x^2$ on the left graph.\label{fig:nonc1diff}}
\end{myfigureht}
Proof: It is immediate from the definition that $f$ has an absolute
minimum at $0$; we know $f(x) \geq 0$ for all $x$ and $f(0) = 0$.
For $x \not= 0$,
$f$ is differentiable
and
the derivative
is $2 \sin (\nicefrac{1}{x}) \bigl( x \sin (\nicefrac{1}{x}) -
\cos(\nicefrac{1}{x}) \bigr)$.
As an exercise, show that for $x_n = \frac{4}{(8n+1)\pi}$,
we have
$\lim_{n\to\infty} f'(x_n) = -1$, and for
$y_n = \frac{4}{(8n+3)\pi}$, we have
$\lim_{n\to\infty} f'(y_n) = 1$. So $f'$
cannot be continuous at $0$
no matter what $f'(0)$ is.