-
Notifications
You must be signed in to change notification settings - Fork 20
/
ch-first-order-ode.tex
3902 lines (3521 loc) · 122 KB
/
ch-first-order-ode.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{First order equations} \label{fo:chapter}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Integrals as solutions}
\label{integralsols:section}
\sectionnotes{1 lecture (or less)\EPref{, \S1.2 in \cite{EP}}\BDref{,
covered in \S1.2 and \S2.1 in \cite{BD}}}
A first order ODE is an equation of the form
\begin{equation*}
\frac{dy}{dx} = f(x,y) ,
\end{equation*}
or just
\begin{equation*}
y' = f(x,y) .
\end{equation*}
In general, there is no simple formula or procedure one can follow to find
solutions.
In the next few lectures, we will look at cases where solutions are not
difficult to obtain.
In this section, we consider the case when $f$ is a function of $x$ alone,
that is, the equation is
\begin{equation} \label{ias:inteq}
y' = f(x) .
\end{equation}
We can integrate (antidifferentiate) both sides of the equation with respect to $x$:
\begin{equation*}
\int y'(x) \,dx = \int f(x) \,dx + C ,
\end{equation*}
that is,
\begin{equation*}
y(x) = \int f(x) \,dx + C .
\end{equation*}
This $y(x)$ is actually the general solution.
So to solve \eqref{ias:inteq},
we find some antiderivative of $f(x)$
and then we add an arbitrary constant to get the general solution.
\begin{example}
Find the general solution of $y' = 3 x^2$.
Elementary calculus tells us
that the general solution must be $y = x^3 + C$. Let us check by
differentiating:
$y' = 3x^2$. We got \emph{precisely} our equation back.
\end{example}
Now is a good time to discuss a point about
calculus notation and terminology. Calculus
textbooks muddy the waters by talking about the integral as primarily the
so-called indefinite integral. The \myindex{indefinite integral}
is really the \emph{\myindex{antiderivative}}
(in fact the whole one-parameter family
of antiderivatives). There really exists only one integral and that
is the definite integral.
The only reason for the indefinite integral notation is that we can always
write an antiderivative as a (definite) integral. That is, by the fundamental
theorem of calculus we can always write
$\int f(x) \,dx + C$ as
\begin{equation*}
\int_{x_0}^x f(t) \,dt + C .
\end{equation*}
Hence the terminology \emph{to \myindex{integrate}} when we may really mean
\emph{to \myindex{antidifferentiate}}.
Integration is just one way to compute the
antiderivative (and it is a way that always works, see the following
examples). Integration is defined as the area under the graph, it
only happens to also compute antiderivatives.
For sake of consistency, we will keep using the
indefinite integral notation when we want an antiderivative,
and you should \emph{always} think of the definite integral
as a way to write it.
Normally, we also have an initial condition such as $y(x_0) = y_0$
for some two numbers $x_0$ and $y_0$ ($x_0$ is often 0, but not always).
We can then write the solution as a definite integral in a nice way.
Suppose our problem is $y' = f(x)$, $y(x_0) = y_0$. Then the solution is
\begin{equation} \label{int:eqdef}
y(x) = \int_{x_0}^x f(t) \,dt + y_0 .
\end{equation}
Let us check!
We compute
$y' = f(x)$ via the fundamental theorem of calculus, and by Jupiter, $y$ is a
solution. Is it the one satisfying the initial condition? Well,
$y(x_0) = \int_{x_0}^{x_0} f(t)\,dt + y_0 = y_0$. It is!
Do note that the definite integral and the indefinite integral
(antidifferentiation) are completely different beasts. The definite integral
always evaluates to a number. Therefore, \eqref{int:eqdef} is a formula we
can plug into the calculator or a computer, and it will be happy to calculate
specific values for us. We will easily be able to plot the
solution and work with it just like with any other function.
It is not so crucial to always find a
closed form for the antiderivative.
\begin{example}
Solve
\begin{equation*}
y' = e^{-x^2}, \qquad y(0) = 1 .
\end{equation*}
By the preceding discussion, the solution must be
\begin{equation*}
y(x) = \int_0^x e^{-s^2} \,ds + 1 .
\end{equation*}
Here is a good way to make fun of your friends taking second semester
calculus. Tell them to
find the closed form solution. Ha ha ha (bad math joke). It is
not possible (in closed form).
There is absolutely nothing wrong with writing the solution as a
definite integral.
This particular integral
is in fact very important
in statistics.
\end{example}
Using this method, we can also solve equations of the form
\begin{equation*}
y' = f(y) .
\end{equation*}
We write the equation in \myindex{Leibniz notation}:
\begin{equation*}
\frac{dy}{dx} = f(y) .
\end{equation*}
Now we use the inverse function theorem from calculus
to switch the roles of $x$ and $y$
to obtain
\begin{equation*}
\frac{dx}{dy} = \frac{1}{f(y)} .
\end{equation*}
What
we are doing seems like algebra with $dx$ and $dy$.
It is tempting to just do algebra with $dx$
and $dy$ as if they were numbers. And in this case it does work. Be
careful,
however, as this sort of hand-waving calculation can lead to trouble,
especially when
more than one independent variable is involved.
At this point, we can simply integrate with respect to $y$,
\begin{equation*}
x(y) = \int \frac{1}{f(y)} \,dy + C .
\end{equation*}
Finally, we try to solve for $y$.
\begin{example}
Previously, we guessed $y' = ky$ (for some $k > 0$) has the solution
$y=Ce^{kx}$. We could have found the solution by integrating.
First we note that $y=0$ is a solution.
Henceforth, we assume $y\not= 0$. We write
\begin{equation*}
\frac{dx}{dy} = \frac{1}{ky} .
\end{equation*}
We integrate in $y$ to obtain
\begin{equation*}
x(y) = x = \frac{1}{k} \ln \, \lvert y \rvert + D,
\end{equation*}
where $D$ is an arbitrary constant.
Now we solve for $y$ (actually for $\lvert y \rvert$).
\begin{equation*}
\lvert y \rvert =
e^{kx-kD} =
e^{-kD} e^{k x} .
\end{equation*}
If we replace $e^{-kD}$ with an arbitrary constant $C$, we can
get rid of the absolute value bars (which we can do as $D$ was arbitrary). In
this way, we
also incorporate the solution $y=0$. We get the same general solution as
we guessed before, $y = Ce^{kx}$.
\end{example}
\begin{example}
Find the general solution of
$y' = y^2$.
First we note that $y=0$ is a solution. We can now assume that $y \not= 0$.
Write
\begin{equation*}
\frac{dx}{dy} = \frac{1}{y^2} .
\end{equation*}
We integrate to get
\begin{equation*}
x = \frac{-1}{y} + C .
\end{equation*}
We solve for $y = \frac{1}{C-x}$.
So the general solution is
\begin{equation*}
y = \frac{1}{C-x} \qquad \text{together with} \qquad y = 0.
\end{equation*}
Note the singularities of the solution. If, for example, $C=1$, then the
solution \myquote{blows up} as we approach $x=1$. See
\figurevref{1over1mx:fig}. Generally,
it is hard to tell
from just looking at the equation itself how the solution is going to behave.
The equation $y' = y^2$ is very nice and defined everywhere, but
the solution is only defined on the interval $(-\infty, C)$ or
$(C, \infty)$. Usually when this happens, we only consider the solution
on one of these intervals and not both.
For example, if we impose an initial condition $y(0) = 1$, then
the solution is $y=\frac{1}{1-x}$, and we would consider this solution only
for $x$ on the interval $(-\infty,1)$. In the figure, it is the left side
of the graph.
\begin{myfig}
\capstart
\diffyincludegraphics{width=3in}{width=4.5in}{1over1mx}
\caption{Plot of $y=\frac{1}{1-x}$.\label{1over1mx:fig}}
\end{myfig}
\end{example}
Classical problems leading to differential equations solvable by integration
are problems
dealing with \myindex{velocity},
\myindex{acceleration}, and \myindex{distance}. You have surely seen these
problems before in your calculus class.
\begin{example}
Suppose a car drives at a speed of $e^{t/2}$ meters per second,
where $t$ is time in seconds.
How far did the car get in 2 seconds (starting at $t=0$)? How far in 10 seconds?
Let $x$ denote the distance the car traveled.
The equation is
\begin{equation*}
x' = e^{t/2} .
\end{equation*}
We just integrate this equation to get that
\begin{equation*}
x(t) = 2 e^{t/2} + C .
\end{equation*}
We still need to figure out $C$. We know that when $t=0$, then
$x=0$. That is, $x(0) = 0$. So
\begin{equation*}
0 = x(0) = 2e^{0/2} + C = 2 + C .
\end{equation*}
Thus $C = -2$ and
\begin{equation*}
x(t) = 2 e^{t/2} - 2 .
\end{equation*}
Now we just plug in to get where the car is at 2 and at 10 seconds.
We obtain
\begin{equation*}
x(2) = 2e^{2/2} - 2 \approx 3.44 \text{ meters} ,
\qquad
x(10) = 2e^{10/2} - 2 \approx 294 \text{ meters} .
\end{equation*}
\end{example}
\begin{example}
Suppose that the car accelerates at $\unitfrac[t^2]{m}{s^2}$.
At time $t=0$ the car is at the 1 meter mark and is traveling at
\unitfrac[10]{m}{s}. Where is the car at time $t=10$?
Well this is actually a second order problem. If $x$ is the distance
traveled, then $x'$ is the velocity, and $x''$ is the acceleration.
The equation with initial conditions is
\begin{equation*}
x'' = t^2 , \qquad x(0) = 1 , \qquad x'(0) = 10 .
\end{equation*}
What if we say $x' = v$. Then we have the problem
\begin{equation*}
v' = t^2, \qquad v(0) = 10 .
\end{equation*}
Once we solve for $v$, we can integrate and find $x$.
\end{example}
\begin{exercise}
Solve for $v$, and then solve for $x$. Find $x(10)$ to answer the
question.
\end{exercise}
\subsection{Exercises}
\begin{exercise}
Solve $\frac{dy}{dx} = x^2+x$ for $y(1)=3$.
\end{exercise}
\begin{exercise}
Solve $\frac{dy}{dx} = \sin (5x)$ for $y(0)=2$.
\end{exercise}
\begin{exercise}
Solve $\frac{dy}{dx} = \frac{1}{x^2-1}$ for $y(0)=0$.
\end{exercise}
\begin{exercise}
Solve $y' = y^3$ for $y(0)=1$.
\end{exercise}
\begin{exercise}[little harder]
Solve $y' = (y-1)(y+1)$ for $y(0)=3$.
\end{exercise}
\begin{exercise}
Solve $\frac{dy}{dx} = \frac{1}{y+1}$ for $y(0)=0$.
\end{exercise}
\begin{exercise}[harder]
Solve $y'' = \sin x$ for $y(0)=0$, $y'(0) = 2$.
\end{exercise}
\begin{exercise}
A spaceship is traveling at the speed \unitfrac[$2t^2+1$]{km}{s} ($t$ is
time in seconds). It is pointing directly away from earth and at time $t=0$
it is 1000 kilometers from earth. How far from earth is it at one minute from
time $t=0$?
\end{exercise}
\begin{exercise}
Solve $\frac{dx}{dt} = \sin(t^2)+t$, $x(0)=20$. It is OK to leave your
answer as a definite integral.
\end{exercise}
\begin{exercise}
A dropped ball accelerates downwards at a constant rate $9.8$ meters per second
squared. Set up the differential equation for the height above ground $h$ in meters.
Then supposing $h(0) = 100$ meters, how long does it take for the ball to hit
the ground.
\end{exercise}
\begin{exercise}
Find the general solution of
$y' = e^x$, and then $y' = e^y$.
\end{exercise}
\setcounter{exercise}{100}
\begin{exercise}
Solve $\frac{dy}{dx} = e^x + x$ and $y(0) = 10$.
\end{exercise}
\exsol{%
$y = e^x + \frac{x^2}{2} + 9$
}
\begin{exercise}
Solve $x' = \frac{1}{x^2}$, $x(1)=1$.
\end{exercise}
\exsol{%
$x = {(3t-2)}^{1/3}$
}
\begin{exercise}
Solve $x' = \frac{1}{\cos(x)}$, $x(0)=\frac{\pi}{4}$.
\end{exercise}
\exsol{%
$x = \sin^{-1} \bigl(t+\nicefrac{1}{\sqrt{2}}\bigr)$
}
\begin{exercise}
Sid is in a car traveling at speed $10t+70$ miles per hour away from Las Vegas,
where $t$ is in hours. At $t=0$, Sid is 10 miles away from Vegas. How
far from Vegas is Sid 2 hours later?
\end{exercise}
\exsol{%
170
}
\begin{exercise}
Solve $y' = y^n$, $y(0) = 1$, where $n$ is a positive integer.
Hint: You have to consider different cases.
\end{exercise}
\exsol{%
If $n \not= 1$, then
$y={\bigl((1-n)x+1\bigr)}^{1/(1-n)}$.
If $n=1$, then $y = e^x$.
}
\begin{exercise}
The rate of change of the volume of a snowball that is melting is
proportional to the surface area of the snowball. Suppose the
snowball is perfectly spherical. The volume (in centimeters cubed)
of a ball of radius $r$ centimeters is
$(\nicefrac{4}{3}) \pi r^3$. The surface area is
$4 \pi r^2$. Set up the differential equation for how the radius $r$ is changing.
Then, suppose that at time $t=0$ minutes, the radius is 10 centimeters.
After 5 minutes, the radius is 8 centimeters. At what time $t$ will the
snowball be completely melted?
\end{exercise}
\exsol{%
The equation is $r' = -C$ for some constant $C$.
The snowball will be completely melted in 25 minutes from time $t=0$.
}
\begin{exercise}
Find the general solution to $y''''= 0$. How many distinct constants do you need?
\end{exercise}
\exsol{%
$y = Ax^3 + Bx^2 + Cx + D$, so 4 constants.
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\sectionnewpage
\section{Slope fields}
\label{slopefields:section}
%mbxINTROSUBSECTION
\sectionnotes{1 lecture\EPref{, \S1.3 in \cite{EP}}\BDref{,
\S1.1 in \cite{BD}}}
%At this point it may be good to first try the
%Lab I\index{IODE software!Lab I} and/or Project I\index{IODE software!Project I} from the
%IODE website: \url{http://www.math.uiuc.edu/iode/}.
%
%\medskip
As we said, the general first order equation we are studying looks like
\begin{equation*}
y' = f(x,y).
\end{equation*}
A lot of the time, we cannot simply solve these kinds of equations explicitly.
It would be nice if we could at least figure out the shape and behavior of
the solutions, or find approximate solutions.
\subsection{Slope fields}
%As you have seen in IODE Lab I (if you did it),
The equation $y' = f(x,y)$
gives you a slope at each point
in the
$(x,y)$-plane. And this is the slope a solution $y(x)$ would have
at $x$ if its value was $y$. In other words, $f(x,y)$ is the slope
of a solution whose graph runs through the
point $(x,y)$. At a point $(x,y)$, we draw a short line
with the slope $f(x,y)$.
For example, if $f(x,y) = xy$, then at point $(2,1.5)$ we draw a
short line of slope $xy = 2 \times 1.5 = 3$. If $y(x)$ is a solution
and $y(2) = 1.5$, then the equation mandates that $y'(2) = 3$.
See \figurevref{1.3:fig0}.
\begin{myfig}
\capstart
\diffyincludegraphics{width=3in}{width=4.5in}{1-3-xysl-one}
\caption{The slope $y'=xy$ at $(2,1.5)$.\label{1.3:fig0}}
\end{myfig}
To get an idea of how solutions behave, we draw such lines at lots
of points in the plane, not just the point $(2,1.5)$. We would
ideally want to see the slope at every point, but that is
just not possible. Usually we pick a
grid of points fine enough so that it shows the behavior, but not too
fine so that we can still recognize the individual lines.
We call this picture the \emph{\myindex{slope field}} of the equation.
See \figurevref{1.3:fig1} for the slope field of the equation $y' = xy$.
In practice, one does not do this by hand, a computer can do the
drawing.
Suppose we are given a specific initial condition $y(x_0) = y_0$.
A solution, that is, the graph of the solution, would be a curve
that follows the slopes we drew.
For a few sample
solutions, see \figurevref{1.3:fig2}. It is easy to roughly sketch
(or at least imagine)
possible solutions in the slope field, just from looking at the slope field
itself. You simply sketch a line that roughly fits the little line segments
and goes through your initial condition.
\begin{myfig}
\parbox[t]{3.0in}{
\capstart
\diffyincludegraphics{width=3.0in}{width=4.5in}{1-3-xysl}
\caption{Slope field of $y' = xy$.\label{1.3:fig1}}
}
\quad
\parbox[t]{3.0in}{
\capstart
\diffyincludegraphics{width=3.0in}{width=4.5in}{1-3-xysl-sol}
\caption{Slope field of $y' = xy$ with a graph of solutions satisfying
$y(0) = 0.2$, $y(0) = 0$, and $y(0) = -0.2$.\label{1.3:fig2}}
}
\end{myfig}
By looking at the slope field we get a lot of information
about the behavior of solutions without having to solve
the equation. For
example, in \figurevref{1.3:fig2} we see what the solutions do when the initial conditions
are $y(0) > 0$, $y(0) = 0$ and $y(0) < 0$.
A small change in the
initial condition causes quite different behavior.
We see this behavior just
from the slope field and imagining what solutions ought to do.
We see a different behavior for the equation
$y' = -y$. The slope field and a few solutions is in
see \figurevref{1.3:fig3}.
If we think of moving from left to right (perhaps $x$ is time
and time is usually increasing), then
we see that no matter what $y(0)$ is, all solutions tend to zero as $x$
tends to infinity.
Again that behavior is clear from simply
looking at the slope field itself.
\begin{myfig}
\capstart
\diffyincludegraphics{width=3in}{width=4.5in}{1-3-mysl-sol}
\caption{Slope field of $y' = -y$ with a graph of a few solutions.\label{1.3:fig3}}
\end{myfig}
\subsection{Existence and uniqueness}
We wish to ask two fundamental questions about the problem
\begin{equation*}
y' = f(x,y), \qquad y(x_0) = y_0.
\end{equation*}
\begin{enumerate}[(i)]
\item Does a solution \emph{exist}?
\item Is the solution \emph{unique} (if it exists)?
\end{enumerate}
What do you think is the answer?
The answer seems to be yes to both does it not? Well, pretty much. But there
are cases when the answer to either question can be no.
Since generally the equations we encounter in applications
come from real life situations, it seems
logical that a solution always exists.
It also has to be unique if we believe our
universe is deterministic. If the solution does not exist, or if it is
not unique, we have
probably not devised the correct model. Hence, it is good to know
when things go wrong and why.
\begin{example}
Attempt to solve:
\begin{equation*}
y' = \frac{1}{x}, \qquad y(0) = 0 .
\end{equation*}
Integrate to find the general solution $y = \ln \, \lvert x \rvert + C$. The
solution does not exist at $x=0$. See \figurevref{1.3:xinvfig}.
Moreover,
the equation may have been written as the seemingly harmless $x y' = 1$.
\begin{myfig}
\parbox[t]{3in}{
\capstart
\diffyincludegraphics{width=3in}{width=4.5in}{1-3-xinv-sol}
\caption{Slope field of $y' = \nicefrac{1}{x}$.\label{1.3:xinvfig}}
}
\quad
\parbox[t]{3in}{
\capstart
\diffyincludegraphics{width=3in}{width=4.5in}{1-3-sqrt-sol}
\caption{Slope field of $y' = 2 \sqrt{\lvert y \rvert}$ with two
solutions satisfying $y(0) = 0$.\label{1.3:sqrtfig}}
}
\end{myfig}
\end{example}
\begin{example}
Solve:
\begin{equation*}
y' = 2 \sqrt{\lvert y \rvert}, \qquad y(0) = 0 .
\end{equation*}
See \figurevref{1.3:sqrtfig}.
Note that $y=0$ is a solution. But another solution is the function
\begin{equation*}
y(x) =
\begin{cases}
x^2 & \text{if } \; x \geq 0,\\
-x^2 & \text{if } \; x < 0.
\end{cases}
\end{equation*}
\end{example}
It is hard to tell by staring at the slope field that the
solution is not
unique.
Is there any hope?
Of course there is. We have the following theorem,
known as Picard's theorem%
\footnote{Named after the French mathematician
\href{https://en.wikipedia.org/wiki/Charles_\%C3\%89mile_Picard}{Charles \'Emile Picard}
(1856--1941)}.
\begin{theorem}[Picard's theorem on existence and uniqueness]%
\label{slope:picardthm}%
\index{existence and uniqueness}\index{Picard's theorem}
If $f(x,y)$ is continuous (as a function of two
variables) and $\frac{\partial f}{\partial y}$ exists and is
continuous near some $(x_0,y_0)$, then a solution to
\begin{equation*}
y' = f(x,y), \qquad y(x_0) = y_0,
\end{equation*}
exists (at least for $x$ in some small interval) and is unique.
\end{theorem}
Note that the problems $y' = \nicefrac{1}{x}$, $y(0) = 0$ and
$y' = 2 \sqrt{\lvert y \rvert}$, $y(0) = 0$ do not satisfy the hypothesis of the
theorem.
Even if we can use the theorem,
we ought to be careful about this existence business. It is quite
possible that the solution only exists for a short while.
\begin{example}
For some constant $A$, solve:
\begin{equation*}
y' = y^2, \qquad y(0) = A .
\end{equation*}
We know how to solve this equation. First assume that $A \not= 0$,
so $y$ is not equal to zero at least for some $x$ near 0. So
$x' = \nicefrac{1}{y^2}$, so
$x = \nicefrac{-1}{y} + C$, so $y = \frac{1}{C-x}$. If $y(0) = A$, then
$C = \nicefrac{1}{A}$ so
\begin{equation*}
y = \frac{1}{\nicefrac{1}{A} - x} .
\end{equation*}
If $A=0$, then $y=0$ is a solution.
For example, when $A=1$
the solution \myquote{blows up} at $x=1$. Hence, the solution does not exist
for all $x$ even if the equation is nice everywhere. The equation
$y' = y^2$ certainly
looks nice.
\end{example}
For most of this
course we will be interested in equations where existence and
uniqueness holds, and in fact holds \myquote{globally} unlike for the equation
$y'=y^2$.
%But it is necessary to understand the examples where things fail for the
%aforementioned reasons.
\subsection{Exercises}
\begin{exercise}
Sketch slope field for $y'=e^{x-y}$. How do the solutions behave as $x$
grows? Can you guess a particular solution by looking at the slope
field?
\end{exercise}
\begin{exercise}
Sketch slope field for $y'=x^2$.
\end{exercise}
\begin{exercise}
Sketch slope field for $y'=y^2$.
\end{exercise}
\begin{exercise}
Is it possible to solve the equation $y' = \frac{xy}{\cos x}$ for $y(0) = 1$?
Justify.
\end{exercise}
\begin{exercise}
Is it possible to solve the equation $y' = y\sqrt{\lvert x\rvert}$ for
$y(0) = 0$? Is the solution unique?
Justify.
\end{exercise}
\begin{samepage}
\begin{exercise}
Match equations $y'=1-x$, $y'=x-2y$, $y' = x(1-y)$ to slope fields.
Justify.
\begin{tasks}(3)
\task
\parbox[c]{1.75in}{\includegraphics[width=1.75in]{figures/yprimex1minusyslope}}
\task
\parbox[c]{1.75in}{\includegraphics[width=1.75in]{figures/yprime1minusxslope}}
\task
\parbox[c]{1.75in}{\includegraphics[width=1.75in]{figures/yprimexminus2yslope}}
\end{tasks}
\end{exercise}
\end{samepage}
\begin{exercise}[challenging]
Take $y' = f(x,y)$, $y(0) = 0$, where $f(x,y) > 1$
for all $x$ and $y$. If
the solution exists for all $x$, can you say
what happens to $y(x)$ as $x$ goes to positive infinity? Explain.
\end{exercise}
\begin{exercise}[challenging]
Take $(y-x)y' = 0$, $y(0) = 0$.
\begin{tasks}
\task Find two distinct solutions.
\task Explain why this does not violate Picard's theorem.
\end{tasks}
\end{exercise}
\begin{exercise}
Suppose $y' = f(x,y)$. What will the slope field look like, explain and
sketch an example, if you know the following about $f(x,y)$:
\begin{tasks}(2)
\task $f$ does
not depend on $y$.
\task $f$ does not depend on $x$.
\task $f(t,t) = 0$ for any
number $t$.
\task $f(x,0) = 0$ and $f(x,1) = 1$ for all $x$.
\end{tasks}
\end{exercise}
\begin{exercise}
Find a solution to $y' = \lvert y \rvert$, $y(0) = 0$. Does Picard's theorem apply?
\end{exercise}
\begin{exercise}
Take an equation $y' = (y-2x) g(x,y) + 2$ for some function $g(x,y)$.
Can you solve the problem for the
initial condition $y(0) = 0$,
and if so what is the solution?
\end{exercise}
\begin{exercise}[challenging]
\pagebreak[2]
Suppose $y' = f(x,y)$ is such that $f(x,1) = 0$ for every $x$,
$f$ is continuous and $\frac{\partial f}{\partial y}$ exists and
is continuous for every $x$ and $y$.
\begin{tasks}
\task
Guess a solution given the initial condition
$y(0) = 1$.
\task
Can graphs of two solutions of the equation for different initial conditions
ever intersect?
\task
Given $y(0) = 0$, what can you say about the solution. In particular,
can $y(x) > 1$ for any $x$? Can $y(x) = 1$ for any $x$? Why or why not?
\end{tasks}
\end{exercise}
\setcounter{exercise}{100}
\begin{exercise}
Sketch the slope field of $y'=y^3$. Can you visually find the solution
that satisfies $y(0)=0$?
\end{exercise}
\exsol{%
%mbxSTARTIGNORE
\vtop{\vskip-1ex \hbox{\includegraphics[width=2in]{figures/yprimey3slope}}}
\quad
%mbxENDIGNORE
%mbxlatex \\
%mbxlatex \includegraphics[width=2in]{figures/yprimey3slope}
%mbxlatex \\
$y=0$ is a solution such that $y(0)=0$.
}
\begin{exercise}
Is it possible to solve $y' = xy$ for $y(0) = 0$? Is the solution unique?
\end{exercise}
\exsol{%
Yes a solution exists. The equation is $y' = f(x,y)$ where $f(x,y) = xy$. The function
$f(x,y)$ is continuous and
$\frac{\partial f}{\partial y} = x$, which is also continuous near $(0,0)$.
So a solution exists and is unique. (In fact, $y=0$ is the solution.)
}
\begin{exercise}
Is it possible to solve $y' = \frac{x}{x^2-1}$ for $y(1) = 0$?
\end{exercise}
\exsol{%
No, the equation is not defined at $(x,y) = (1,0)$.
}
\begin{samepage}
\begin{exercise}
Match equations $y'=\sin x$, $y'=\cos y$, $y' = y\cos(x)$ to slope fields.
Justify.
\begin{tasks}(3)
\task
\parbox[c]{1.75in}{\includegraphics[width=1.75in]{figures/yprimecosyslope}}
\task
\parbox[c]{1.75in}{\includegraphics[width=1.75in]{figures/yprimecosxyslope}}
\task
\parbox[c]{1.75in}{\includegraphics[width=1.75in]{figures/yprimesinxslope}}
\end{tasks}
\end{exercise}
\end{samepage}
\exsol{%
a) $y'=\cos y$, \quad
b) $y' = y\cos(x)$, \quad
c) $y'=\sin x$. \quad
Justification left to reader.
}
\begin{exercise}[tricky]
Suppose
\begin{equation*}
f(y) =
\begin{cases}
0 & \text{ if $y > 0$}, \\
1 & \text{ if $y \leq 0$} .
\end{cases}
\end{equation*}
Does $y' = f(y)$, $y(0) = 0$ have a continuously differentiable solution? Does Picard apply? Why, or why not?
\end{exercise}
\exsol{%
Picard does not apply as $f$ is not continuous at $y=0$.
The equation does not have a continuously differentiable solution.
Suppose it did. Notice that
$y'(0) = 1$. By the first derivative test, $y(x) > 0$ for small positive $x$.
But then for those $x$, we have $y'(x) = f\bigl(y(x)\bigr) = 0$.
It is not possible for $y'$ to be continous, $y'(0)=1$ and
$y'(x) = 0$ for arbitrarily small positive $x$.
}
\begin{exercise}
Consider an equation of the form $y' = f(x)$ for some continuous function
$f$, and an initial condition $y(x_0) = y_0$. Does a
solution exist for all $x$? Why or why not?
\end{exercise}
\exsol{%
The solution is $y(x) = \int_{x_0}^x f(s) \,ds + y_0$, and this does indeed
exist for every $x$.
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\sectionnewpage
\section{Separable equations}
\label{separable:section}
%mbxINTROSUBSECTION
\sectionnotes{1 lecture\EPref{, \S1.4 in \cite{EP}}\BDref{,
\S2.2 in \cite{BD}}}
When a differential equation is of the form
$y' = f(x)$,
we integrate:
$y = \int f(x) \,dx + C$.
Unfortunately, simply integrating no longer works for the
general form of the equation
$y' = f(x,y)$.
Integrating both sides yields the rather unhelpful expression
\begin{equation*}
y = \int f(x,y) \,dx + C .
\end{equation*}
Notice the dependence on $y$ in the integral.
\subsection{Separable equations}
We say a differential equation is
\emph{\myindex{separable}}
if we can write it as
\begin{equation*}
y' = f(x)g(y) ,
\end{equation*}
for some functions $f(x)$ and $g(y)$.
Let us write the equation in the \myindex{Leibniz notation}
\begin{equation*}
\frac{dy}{dx} = f(x)g(y) .
\end{equation*}
Then we rewrite the equation as
\begin{equation*}
\frac{dy}{g(y)} = f(x) \,dx .
\end{equation*}
Both sides look like something we can integrate. We obtain
\begin{equation*}
\int \frac{dy}{g(y)} = \int f(x) \,dx + C .
\end{equation*}
If we can find closed form expressions
for these two integrals, we can, perhaps, solve for $y$.
\begin{example} \label{example:yprimeisxy}
Take the equation
\begin{equation*}
y' = xy .
\end{equation*}
Note that $y=0$ is a solution. We will remember that fact and
assume $y \not =0$ from now on, so that we can divide by $y$.
Write the equation as $\frac{dy}{dx} = xy$ or
$\frac{dy}{y} = x \, dx$.
Then
\begin{equation*}
\int \frac{dy}{y} = \int x\,dx + C .
\end{equation*}
We compute the antiderivatives to get
\begin{equation*}
\ln \, \lvert y\rvert = \frac{x^2}{2} + C ,
\end{equation*}
or
\begin{equation*}
\lvert y \rvert = e^{\frac{x^2}{2} + C} = e^{\frac{x^2}{2}} e^C = D e^{\frac{x^2}{2}} ,
\end{equation*}
where $D > 0$ is some constant. Because $y=0$ is also a solution and because
of the absolute value, we can write:
\begin{equation*}
y = D e^{\frac{x^2}{2}} ,
\end{equation*}
for any number $D$ (including zero or negative).
We check:
\begin{equation*}
y' = D x e^{\frac{x^2}{2}} = x \left( D e^{\frac{x^2}{2}} \right) = xy .
\end{equation*}
Yay!
\end{example}
You may be worried that we
integrated in two different variables.
We seemingly did a different operation to each side.
Perhaps we should be a little bit more careful
and work through this method more rigorously.
Consider
\begin{equation*}
\frac{dy}{dx} = f(x)g(y) .
\end{equation*}
We rewrite the equation as follows.
Note that $y = y(x)$ is a function of $x$ and so is
$\frac{dy}{dx}$!
\begin{equation*}
\frac{1}{g(y)}\,\frac{dy}{dx} = f(x) .
\end{equation*}
We integrate both sides with respect to $x$:
\begin{equation*}
\int \frac{1}{g(y)}\,\frac{dy}{dx} \,dx = \int f(x) \,dx + C .
\end{equation*}
We use the change of variables formula (substitution) on the left hand side:
\begin{equation*}
\int \frac{1}{g(y)}\,dy = \int f(x) \,dx + C .
\end{equation*}
And we are done.
\subsection{Implicit solutions}
We sometimes get stuck even if we can do the
integration. Consider the separable equation
\begin{equation*}
y' = \frac{xy}{y^2+1} .
\end{equation*}
We separate variables,
\begin{equation*}
\frac{y^2+1}{y}\,dy = \left(y+\frac{1}{y}\right)\,dy = x\,dx .
\end{equation*}
We integrate to get
\begin{equation*}
\frac{y^2}{2} + \ln \, \lvert y \rvert = \frac{x^2}{2} + C ,
\end{equation*}
or perhaps the less intimidating expression (where $D = 2C$)
\begin{equation*}
y^2 + 2 \ln \, \lvert y\rvert = x^2 + D .
\end{equation*}
It is not easy to find the solution explicitly---it is hard to solve
for $y$. We, therefore, leave the solution in this form and call
it an
\emph{\myindex{implicit solution}}.
It is still
easy to check that an implicit solution satisfies the differential
equation. In this case, we differentiate with respect to $x$, and remember
that $y$ is a function of $x$,
to get
\begin{equation*}
y'\left(2y + \frac{2}{y}\right) = 2x .
\end{equation*}
Multiply both sides by $y$ and divide by $2(y^2+1)$ and you will
get exactly the differential equation. We leave this computation to the
reader.
If you have an implicit solution, and
you want to compute values
for $y$, you might have to be tricky. You might get multiple solutions $y$
for each $x$, so you have to pick one. Sometimes you can
graph $x$ as a function of $y$, and then turn your paper to
see a graph.
Sometimes you have to do more.
Computers are also good at some of these tricks.
More advanced mathematical software usually has some
way of plotting solutions to implicit equations.
For example, for $D=0$, if you plot all the points $(x,y)$ that
are solutions to $y^2+2\ln \, \lvert y\rvert=x^2$,
you find the two curves in \figurevref{implicitsols:fig}. This is not quite
a graph of a function. For each $x$ there are two choices of $y$.
To find a function, you have to pick one of these two curves.
You pick the one that satisfies your initial condition if you have one.
For instance, the top curve satisfies the condition $y(1)=1$.
So for each $D$, we really got two solutions.
As you can see, computing values from an implicit solution can be somewhat
tricky. But sometimes, an implicit solution is the best we can do.
\begin{myfig}
\capstart
\diffyincludegraphics{width=3in}{width=4.5in}{implicitsols}
\caption{The implicit solution $y^2+2\ln \, \lvert y\rvert = x^2$
to $y'=\frac{xy}{y^2+1}$.\label{implicitsols:fig}}
\end{myfig}
The equation above also has the solution $y=0$.
So the general solution is
\begin{equation*}
y^2 + 2 \ln \, \lvert y \rvert = x^2 + D, \qquad \text{and} \qquad y=0.
\avoidbreak
\end{equation*}
Sometimes these extra solutions that came up
due to division by zero such as
$y=0$
are called \emph{singular solutions\index{singular solution}}.
\subsection{Examples of separable equations}
\begin{example}
Solve $x^2y' = 1 - x^2+y^2 - x^2y^2$, $y(1) = 0$.