#set document(title: "1.2 Slope fields", author: "Jiří Lebl") #set page(width: 8.5in, height: auto, margin: 1in) #import "@preview/cetz:0.5.2" #set text(font: ("STIX Two Text", "Libertinus Serif", "New Computer Modern"), size: 10.5pt, lang: "en") #show math.equation: set text(font: ("STIX Two Math", "New Computer Modern Math")) #set par(justify: true, leading: 0.62em, spacing: 0.9em) #set enum(spacing: 1.1em) // room between list items so tall inline fractions don't collide #set list(spacing: 1.1em) #set table(stroke: 0.5pt + rgb("#c7ccd3")) #let BLUE = rgb("#183B6F") // brand navy — section bars + example/solution labels (white on navy 11.09:1) #let ORANGE = rgb("#A94509") // brand primary-700 — AA-safe deep orange for TEXT (5.93:1 on white; raw brand #F37021 is 2.94:1 and must never carry text) #let RED = rgb("#DC2626") // brand error-600 #let GREEN = rgb("#059669") // brand success-600 (decoration only; small green text uses green-text #007942) #show heading.where(level: 1): it => block(width: 100%, above: 0pt, below: 16pt, fill: gradient.linear(BLUE, rgb("#2C5AA0")), inset: (x: 14pt, y: 12pt), radius: 3pt, text(fill: white, weight: "bold", size: 19pt, it.body)) #show heading.where(level: 2): it => block(width: 100%, above: 18pt, below: 10pt, fill: BLUE, inset: (x: 10pt, y: 6pt), radius: 2pt, text(fill: white, weight: "bold", size: 12pt, it.body)) #show heading.where(level: 3): it => text(fill: ORANGE, weight: "bold", size: 12.5pt, it.body) #show heading.where(level: 4): it => text(fill: BLUE, weight: "bold", size: 10.5pt, it.body) #let examplebox(label, title, body) = block(width: 100%, breakable: true, fill: rgb("#EFF1F5"), stroke: 0.5pt + rgb("#CFDDF0"), radius: 4pt, inset: 10pt, above: 12pt, below: 12pt)[ #block(below: 6pt)[#box(fill: BLUE, inset: (x: 6pt, y: 2pt), radius: 2pt, text(fill: white, weight: "bold", size: 8.5pt, label)) #h(0.4em) #strong[#title]] #body] // rail = decorative left rule (raw brand token); labelcolor = AA-safe label text shade #let notebox(label, rail, labelcolor, tint, body) = block(width: 100%, breakable: true, fill: tint, stroke: (left: 3pt + rail), inset: (left: 10pt, rest: 8pt), radius: (right: 4pt), above: 11pt, below: 11pt)[ #text(fill: labelcolor, weight: "bold", size: 7.5pt, tracking: 0.5pt)[#upper(label)] #linebreak() #body] #let solutionbox(body) = block(above: 4pt, below: 8pt)[ #text(fill: BLUE, weight: "bold", size: 8.5pt)[Solution] #linebreak() #body] #let figph(msg) = block(width: 100%, height: 60pt, fill: rgb("#f6f7f9"), stroke: (paint: rgb("#c7ccd3"), dash: "dashed"), radius: 4pt, inset: 10pt)[ #align(center + horizon, text(fill: rgb("#889"), style: "italic", size: 9pt, msg))] // Standardize inlined figure sizes: measure the natural CeTZ canvas, then scale to a // consistent envelope (aspect-aware; see build_typst.py FIG_* constants). Unlike the // print preamble, dimensions are FLOORED: in an editor a user can trim a figure to a // degenerate 1-D shape (a bare line), and w/h or tw/w would then divide by zero. #let _STD_W = 3.5 #let _WIDE_W = 5.6 #let _MAX_H = 3.4 #let _ASPECT_WIDE = 2.2 #let _UPSCALE_MAX = 1.15 #let stdfig(body) = context { let m = measure(body) let w = calc.max(m.width / 1in, 0.01) let h = calc.max(m.height / 1in, 0.01) let tw = if w / h > _ASPECT_WIDE { _WIDE_W } else { _STD_W } let s = calc.min(tw / w, _MAX_H / h, _UPSCALE_MAX) align(center, box(scale(x: s * 100%, y: s * 100%, reflow: true, body))) } #show figure: set block(breakable: false) #set figure(gap: 8pt) #show figure.caption: set text(size: 8.5pt, fill: rgb("#555")) == 1.2#h(0.6em)Slope fields The general first order equation we are studying looks like #math.equation(block: true, alt: "y prime equals f open parenthesis x , y close parenthesis")[$y^(′) = f ( x , y )$] In general, 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 if we could find approximate solutions. At this point it may be good to first try the Lab I and/or Project I from the #link("https://conf.math.illinois.edu/iode/")[IODE website]. === Slope fields The equation #math.equation(block: false, alt: "y prime equals f open parenthesis x , y close parenthesis")[$y^(′) = f ( x , y )$] gives you a slope at each point in the #math.equation(block: false, alt: "open parenthesis x , y close parenthesis")[$( x , y )$]-plane. And this is the slope a solution #math.equation(block: false, alt: "y open parenthesis x close parenthesis")[$y ( x )$] would have at #math.equation(block: false, alt: "x")[$x$] if its value was #math.equation(block: false, alt: "y")[$y$]. In other words, #math.equation(block: false, alt: "f open parenthesis x , y close parenthesis")[$f ( x , y )$] is the slope of a solution whose graph runs through the point #math.equation(block: false, alt: "open parenthesis x , y close parenthesis")[$( x , y )$]. At a point #math.equation(block: false, alt: "open parenthesis x , y close parenthesis")[$( x , y )$], we plot a short line with the slope #math.equation(block: false, alt: "f open parenthesis x , y close parenthesis")[$f ( x , y )$]. For example, if #math.equation(block: false, alt: "f open parenthesis x , y close parenthesis equals x y")[$f ( x , y ) = x y$], then at point #math.equation(block: false, alt: "open parenthesis 2 , 1.5 close parenthesis")[$( 2 , 1.5 )$] we draw a short line of slope #math.equation(block: false, alt: "x y equals 2 times 1.5 equals 3")[$x y = 2 × 1.5 = 3$]. So, if #math.equation(block: false, alt: "y open parenthesis x close parenthesis")[$y ( x )$] is a solution and #math.equation(block: false, alt: "y open parenthesis 2 close parenthesis equals 1.5")[$y ( 2 ) = 1.5$], then the equation mandates that #math.equation(block: false, alt: "y prime open parenthesis 2 close parenthesis equals 3")[$y^(′) ( 2 ) = 3$]. See Figure #math.equation(block: false, alt: "1")[$1$]. #figure(figph[Diagram of an empty grid from -3 to 3 in both directions with one short blue segment at x = 2, y = 1.5, tilted steeply up to the right to mark the slope at that single point.], alt: "Diagram of an empty grid from -3 to 3 in both directions with one short blue segment at x = 2, y = 1.5, tilted steeply up to the right to mark the slope at that single point.", caption: [Figure #math.equation(block: false, alt: "1")[$1$]: The slope #math.equation(block: false, alt: "y prime equals x y")[$y^(′) = x y$] at #math.equation(block: false, alt: "open parenthesis 2 , 1.5 close parenthesis")[$( 2 , 1.5 )$].]) To get an idea of how solutions behave, we draw such lines at lots of points in the plane, not just the point #math.equation(block: false, alt: "open parenthesis 2 , 1.5 close parenthesis")[$( 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 slope field of the equation. See Example 2 for the slope field of the equation #math.equation(block: false, alt: "y prime equals x y")[$y^(′) = x y$]. Usually in practice, one does not do this by hand, but has a computer do the drawing. The slope field of y′ = xy, the equation this section works through. Explore it to drag the viewing window, or open it in XYZ Graph to add your own initial conditions and watch the solution curve follow the slopes. {"functions":\[{"color":"\#1f4e79","domain":null,"expression":"x\*y","expression2":"","id":"slope-xy","inequality":"lt","lineDash":\[\],"lineWidth":2,"mode":"slope-field","seed":\[0,1\],"seeds":\[{"x":0,"y":0.35},{"x":0,"y":-0.35},{"x":0,"y":-1}\],"tMax":10,"tMin":-10,"variable":"x","visible":true}\],"grid":{"axisColor":"\#333333","gridColor":"\#cccccc","majorSpacing":1,"minorGridColor":"\#eeeeee","showAxes":true,"showLabels":true},"parameters":\[\],"title":"Slope field for y' = xy","version":1,"viewport":{"centerX":0,"centerY":0,"scale":78}} Suppose we are given a specific initial condition #math.equation(block: false, alt: "y open parenthesis x sub 0 close parenthesis equals y sub 0")[$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 Figure #math.equation(block: false, alt: "3")[$3$]. 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. #figure(figph[Slope field over x and y from -3 to 3, symmetric about the origin: the dashes lie flat along both axes and steepen with distance from them, standing nearly vertical at the corners.], alt: "Slope field over x and y from -3 to 3, symmetric about the origin: the dashes lie flat along both axes and steepen with distance from them, standing nearly vertical at the corners.", caption: [Figure #math.equation(block: false, alt: "3")[$3$]: Slope field of #math.equation(block: false, alt: "y prime equals x y")[$y^(′) = x y$].]) #figure(figph[Slope field over x and y from -3 to 3 with three red solutions: the line y = 0 and two curves mirroring it, with turning points at 0.2 and -0.2, that bend sharply away near x = 2.35.], alt: "Slope field over x and y from -3 to 3 with three red solutions: the line y = 0 and two curves mirroring it, with turning points at 0.2 and -0.2, that bend sharply away near x = 2.35.", caption: [Figure #math.equation(block: false, alt: "3")[$3$]: Slope field of #math.equation(block: false, alt: "y prime equals x y")[$y^(′) = x y$] with a graph of solutions satisfying #math.equation(block: false, alt: "y open parenthesis 0 close parenthesis equals 0.2")[$y ( 0 ) = 0.2$], #math.equation(block: false, alt: "y open parenthesis 0 close parenthesis equals 0")[$y ( 0 ) = 0$], and #math.equation(block: false, alt: "y open parenthesis 0 close parenthesis equals minus 0.2")[$y ( 0 ) = − 0.2$].]) 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 Figure #math.equation(block: false, alt: "3")[$3$] we see what the solutions do when the initial conditions are #math.equation(block: false, alt: "y open parenthesis 0 close parenthesis greater than 0")[$y ( 0 ) > 0$], #math.equation(block: false, alt: "y open parenthesis 0 close parenthesis equals 0")[$y ( 0 ) = 0$] and #math.equation(block: false, alt: "y open parenthesis 0 close parenthesis less than 0")[$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 #math.equation(block: false, alt: "y prime equals minus y")[$y^(′) = − y$]. The slope field and a few solutions is in see Figure #math.equation(block: false, alt: "4")[$4$]. If we think of moving from left to right (perhaps #math.equation(block: false, alt: "x")[$x$] is time and time is usually increasing), then we see that no matter what #math.equation(block: false, alt: "y open parenthesis 0 close parenthesis")[$y ( 0 )$] is, all solutions tend to zero as #math.equation(block: false, alt: "x")[$x$] tends to infinity. Again that behavior is clear from simply looking at the slope field itself. #figure(figph[Slope field over x and y from -3 to 3 whose dashes all lean back toward y = 0. Three red solutions entering at y = 3, 1 and -2 merge with the line y = 0 by about x = 1.], alt: "Slope field over x and y from -3 to 3 whose dashes all lean back toward y = 0. Three red solutions entering at y = 3, 1 and -2 merge with the line y = 0 by about x = 1.", caption: [Figure #math.equation(block: false, alt: "4")[$4$]: Slope field of #math.equation(block: false, alt: "y prime equals minus y")[$y^(′) = − y$] with a graph of a few solutions.]) === Existence and uniqueness We wish to ask two fundamental questions about the problem #math.equation(block: true, alt: "y prime equals f open parenthesis x , y close parenthesis , y open parenthesis x sub 0 close parenthesis equals y sub 0")[$y^(′) = f ( x , y ) , #h(1em) y ( x_(0) ) = y_(0)$] + Does a solution exist? + Is the solution unique (if it exists)? 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. #examplebox("Example 1")[][ Attempt to solve #math.equation(block: true, alt: "y prime equals the fraction 1 over x , y open parenthesis 0 close parenthesis equals 0 .")[$y^(′) = frac(1, x) , #h(1em) y ( 0 ) = 0 .$] #solutionbox[ Integrate to find the general solution #math.equation(block: false, alt: "y equals ln | x | plus C")[$y = ln | x | + C$]. Note that the solution does not exist at #math.equation(block: false, alt: "x equals 0")[$x = 0$]. See Figure #math.equation(block: false, alt: "5")[$5$] on the following page. The equation may have been written as the seemingly harmless #math.equation(block: false, alt: "x y prime equals 1")[$x y^(′) = 1$]. #figure(figph[Slope field over x and y from -3 to 3, near vertical beside the vertical axis and flat at the left and right edges. Five red solutions shaped like logarithm graphs drop without bound as x approaches 0.], alt: "Slope field over x and y from -3 to 3, near vertical beside the vertical axis and flat at the left and right edges. Five red solutions shaped like logarithm graphs drop without bound as x approaches 0.", caption: [Figure #math.equation(block: false, alt: "5")[$5$]: Slope field of #math.equation(block: false, alt: "y prime equals the fraction 1 over x .")[$y^(′) = frac(1, x) .$]]) ] ] #examplebox("Example 2")[][ Solve: #math.equation(block: true, alt: "y prime equals 2 the square root of | y | , y open parenthesis 0 close parenthesis equals 0 .")[$y^(′) = 2 sqrt(| y |) , #h(1em) y ( 0 ) = 0 .$] #solutionbox[ #figure(figph[Slope field over x and y from -3 to 3, dashes tilting up to the right. Two red solutions pass through the origin: the line y = 0 and an S-shaped curve leaving the frame near x = 1.75 and x = -1.75.], alt: "Slope field over x and y from -3 to 3, dashes tilting up to the right. Two red solutions pass through the origin: the line y = 0 and an S-shaped curve leaving the frame near x = 1.75 and x = -1.75.", caption: [Figure #math.equation(block: false, alt: "6")[$6$]: Slope field of #math.equation(block: false, alt: "y prime equals 2 the square root of | y |")[$y^(′) = 2 sqrt(| y |)$] with two solutions satisfying #math.equation(block: false, alt: "y open parenthesis 0 close parenthesis equals 0 .")[$y ( 0 ) = 0 .$]]) Note that #math.equation(block: false, alt: "y equals 0")[$y = 0$] is a solution. But another solution is the function #math.equation(block: true, alt: "y open parenthesis x close parenthesis equals { x squared, i f x greater than or equal to 0; minus x squared, i f x less than 0")[$y ( x ) = \{ x^(2) & upright(i) upright(f) " " x ≥ 0 \ − x^(2) & upright(i) upright(f) " " x < 0$] ] ] 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 #strong[Picard’s]#strong[theorem].#math.equation(block: false, alt: "to the power 1")[$1$] #notebox("Note", rgb("#8a94a6"), rgb("#556666"), rgb("#f7f8fa"))[ #strong[Picard’s theorem on existence and uniqueness] If #math.equation(block: false, alt: "f open parenthesis x , y close parenthesis")[$f ( x , y )$] is #emph[continuous] (#emph[as]#emph[a]#emph[function]#emph[of two variables]) #emph[and] #math.equation(block: false, alt: "the fraction ∂ f over ∂ y")[$frac(∂ f, ∂ y)$] #emph[exists and is] #emph[continuous near some] #math.equation(block: false, alt: "open parenthesis x sub 0 , y sub 0 close parenthesis")[$( x_(0) , y_(0) )$], then a solution to #math.equation(block: true, alt: "y prime equals f open parenthesis x , y close parenthesis , y open parenthesis x sub 0 close parenthesis equals y sub 0")[$y^(′) = f ( x , y ) , #h(1em) y ( x_(0) ) = y_(0)$] #emph[exists] (#emph[at least for] #math.equation(block: false, alt: "x")[$x$] #emph[in some small interval)] #emph[and is] #emph[unique]. ] Note that the problems #math.equation(block: false, alt: "y prime equals the fraction 1 over x")[$y^(′) = frac(1, x)$], #math.equation(block: false, alt: "y open parenthesis 0 close parenthesis equals 0")[$y ( 0 ) = 0$] and #math.equation(block: false, alt: "y prime equals 2 the square root of | y |")[$y^(′) = 2 sqrt(| y |)$], #math.equation(block: false, alt: "y open parenthesis 0 close parenthesis equals 0")[$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. #examplebox("Example 3")[][ For some constant #math.equation(block: false, alt: "A")[$A$], solve: #math.equation(block: true, alt: "y prime equals y squared y open parenthesis 0 close parenthesis equals A")[$y^(′) = y^(2) #h(1em) y ( 0 ) = A$]. #solutionbox[ We know how to solve this equation. First assume that #math.equation(block: false, alt: "A not equal to 0")[$A ≠ 0$], so #math.equation(block: false, alt: "y")[$y$] is not equal to zero at least for some #math.equation(block: false, alt: "x")[$x$] near 0. So #math.equation(block: false, alt: "x prime equals the fraction 1 over y squared")[$x^(′) = frac(1, y^(2))$], so #math.equation(block: false, alt: "x equals minus the fraction 1 over y plus C")[$x = − frac(1, y) + C$], so #math.equation(block: false, alt: "y equals the fraction 1 over C minus x")[$y = frac(1, C − x)$]. If #math.equation(block: false, alt: "y open parenthesis 0 close parenthesis equals A")[$y ( 0 ) = A$], then #math.equation(block: false, alt: "C equals the fraction 1 over A")[$C = frac(1, A)$] so #math.equation(block: true, alt: "y equals the fraction 1 over the fraction 1 over A minus x")[$y = frac(1, frac(1, A) − x)$] If #math.equation(block: false, alt: "A equals 0")[$A = 0$], then #math.equation(block: false, alt: "y equals 0")[$y = 0$] is a solution. ] ] For example, when #math.equation(block: false, alt: "A equals 1")[$A = 1$] the solution “blows up” at #math.equation(block: false, alt: "x equals 1")[$x = 1$]. Hence, the solution does not exist for all #math.equation(block: false, alt: "x")[$x$] even if the equation is nice everywhere. The equation #math.equation(block: false, alt: "y prime equals y squared")[$y^(′) = y^(2)$] certainly looks nice. The solution of y′ = y², y(0) = A is y = 1/(1/A − x), so it runs into a wall at x = 1/A: how long a solution exists depends on where you start, not on how nice the equation looks. At A = 1 the wall sits at x = 1 — the case worked above. Drag A down to 0.25 and the wall retreats to x = 4; drag it up to 2 and the wall marches in to x = 0.5. The slope field behind the curve shows the mechanism: slopes steepen like y², so the higher the solution climbs the faster it runs away. {"functions":\[{"color":"\#1f4e79","domain":null,"expression":"y^2","expression2":"","id":"field-y2","inequality":"lt","lineDash":\[\],"lineWidth":1,"mode":"slope-field","seed":null,"seeds":\[\],"tMax":10,"tMin":-10,"variable":"x","visible":true},{"color":"\#b8442a","domain":null,"expression":"1/(1/a - x)","expression2":"","id":"sol-blowup","inequality":"lt","lineDash":\[\],"lineWidth":2.5,"mode":"cartesian","tMax":10,"tMin":-10,"variable":"x","visible":true}\],"grid":{"axisColor":"\#333333","gridColor":"\#cccccc","majorSpacing":1,"minorGridColor":"\#eeeeee","showAxes":true,"showLabels":true},"parameters":\[{"id":"p-a","label":"Initial value y(0) = A","max":2,"min":0.25,"name":"a","step":0.05,"unit":"","value":1}\],"title":"y' = y^2, y(0) = A: the solution blows up at x = 1/A","version":1,"viewport":{"centerX":1.6,"centerY":1.65,"scale":130}} For most of this course we will be interested in equations where existence and uniqueness holds, and in fact holds “globally” unlike for the equation #math.equation(block: false, alt: "y prime equals y squared")[$y^(′) = y^(2)$]. === Footnotes \[1\] Named after the French mathematician Charles Émile Picard (1856 – 1941)