
## Section1.2Slope fields

1 lecture, §1.3 in [EP], §1.1 in [BD]

As we said, the general first order equation we are studying looks like

\begin{equation*} y' = f(x,y). \end{equation*}

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.

### Subsection1.2.1Slope fields

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 the point $(x,y)\text{.}$ At a point $(x,y)\text{,}$ we plot a short line with the slope $f(x,y)\text{.}$ For example, if $f(x,y) = xy\text{,}$ then at point $(2,1.5)$ we draw a short line of slope $2 \times 1.5 = 3\text{.}$ That is, if $y(x)$ is a solution and $y(2) = 1.5\text{,}$ then the equation mandates that $y'(2) = 3\text{.}$ See Figure 2.2.1.

To get an idea of how the solutions behave, we draw such lines at lots of points in the plane, not just the point $(2,1.5)\text{.}$ Usually we pick a grid of such points fine enough so that it shows the behavior, but not too fine so that we can still recognize the individual lines. See Figure 2.2.2. We call this picture the slope field of the equation. Usually in practice, one does not do this by hand, but has a computer do the drawing.

Suppose we are given a specific initial condition $y(x_0) = y_0\text{.}$ A solution, that is, the graph of the solution, would be a curve that follows the slopes. For a few sample solutions, see Figure 2.2.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.

By looking at the slope field we can get a lot of information about the behavior of solutions. For example, in Figure 2.2.3 we can see what the solutions do when the initial conditions are $y(0) > 0\text{,}$ $y(0) = 0$ and $y(0) < 0\text{.}$ Note that a small change in the initial condition causes quite different behavior. We can see this behavior just from the slope field imagining what solutions ought to do. On the other hand, plotting a few solutions of the equation $y' = -y\text{,}$ we see that no matter what $y(0)$ is, all solutions tend to zero as $x$ tends to infinity. See Figure 2.2.4. Again that behavior should be clear from simply from looking at the slope field itself.

### Subsection1.2.2Existence and uniqueness

\begin{equation*} y' = f(x,y), \qquad y(x_0) = y_0. \end{equation*}
1. Does a solution exist?

2. 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.

###### Example1.2.1

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\text{.}$ The solution does not exist at $x=0\text{.}$ See Figure 2.2.6. The equation may have been written as the seemingly harmless $x y' = 1\text{.}$

###### Example1.2.2

Solve:

\begin{equation*} y' = 2 \sqrt{\lvert y \rvert}, \qquad y(0) = 0 . \end{equation*}

See Figure 2.2.7. 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*}

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 1 Named after the French mathematician Charles Émile Picard (1856–1941).

Note that the problems $y' = \nicefrac{1}{x}\text{,}$ $y(0) = 0$ and $y' = 2 \sqrt{\lvert y \rvert}\text{,}$ $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.

###### Example1.2.3

For some constant $A\text{,}$ 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\text{,}$ so $y$ is not equal to zero at least for some $x$ near 0. So $x' = \nicefrac{1}{y^2}\text{,}$ so $x = \nicefrac{-1}{y} + C\text{,}$ so $y = \frac{1}{C-x}\text{.}$ If $y(0) = A\text{,}$ then $C = \nicefrac{1}{A}$ so

\begin{equation*} y = \frac{1}{\nicefrac{1}{A} - x} . \end{equation*}

If $A=0\text{,}$ then $y=0$ is a solution.

For example, when $A=1$ the solution “blows up” at $x=1\text{.}$ Hence, the solution does not exist for all $x$ even if the equation is nice everywhere. The equation $y' = y^2$ certainly looks nice.

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 $y'=y^2\text{.}$

### Subsection1.2.3Exercises

###### Exercise1.2.1

Sketch slope field for $y'=e^{x-y}\text{.}$ How do the solutions behave as $x$ grows? Can you guess a particular solution by looking at the slope field?

###### Exercise1.2.2

Sketch slope field for $y'=x^2\text{.}$

###### Exercise1.2.3

Sketch slope field for $y'=y^2\text{.}$

###### Exercise1.2.4

Is it possible to solve the equation $y' = \frac{xy}{\cos x}$ for $y(0) = 1\text{?}$ Justify.

###### Exercise1.2.5

Is it possible to solve the equation $y' = y\sqrt{\lvert x\rvert}$ for $y(0) = 0\text{?}$ Is the solution unique? Justify.

###### Exercise1.2.6

Match equations $y'=1-x\text{,}$ $y'=x-2y\text{,}$ $y' = x(1-y)$ to slope fields. Justify.
a) b) c)

###### Exercise1.2.7

(challenging)   Take $y' = f(x,y)\text{,}$ $y(0) = 0\text{,}$ where $f(x,y) > 1$ for all $x$ and $y\text{.}$ If the solution exists for all $x\text{,}$ can you say what happens to $y(x)$ as $x$ goes to positive infinity? Explain.

###### Exercise1.2.8

(challenging)   Take $(y-x)y' = 0\text{,}$ $y(0) = 0\text{.}$ a) Find two distinct solutions. b) Explain why this does not violate Picard's theorem.

###### Exercise1.2.9

Suppose $y' = f(x,y)\text{.}$ What will the slope field look like, explain and sketch an example, if you have the following about $f(x,y)\text{.}$ a) $f$ does not depend on $y\text{.}$ b) $f$ does not depend on $x\text{.}$ c) $f(t,t) = 0$ for any number $t\text{.}$ d) $f(x,0) = 0$ and $f(x,1) = 1$ for all $x\text{.}$

###### Exercise1.2.10

Find a solution to $y' = \lvert y \rvert\text{,}$ $y(0) = 0\text{.}$ Does Picard's theorem apply?

###### Exercise1.2.11

Take an equation $y' = (y-2x) g(x,y) + 2$ for some function $g(x,y)\text{.}$ Can you solve the problem for the initial condition $y(0) = 0\text{,}$ and if so what is the solution?

###### Exercise1.2.101

Sketch the slope field of $y'=y^3\text{.}$ Can you visually find the solution that satisfies $y(0)=0\text{?}$

$y=0$ is a solution such that $y(0)=0\text{.}$

###### Exercise1.2.102

Is it possible to solve $y' = xy$ for $y(0) = 0\text{?}$ Is the solution unique?

Yes a solution exists. $y' = f(x,y)$ where $f(x,y) = xy\text{.}$ The function $f(x,y)$ is continuous and $\frac{\partial f}{\partial y} = x\text{,}$ which is also continuous near $(0,0)\text{.}$ So a solution exists and is unique. (In fact $y=0$ is the solution).

###### Exercise1.2.103

Is it possible to solve $y' = \frac{x}{x^2-1}$ for $y(1) = 0\text{?}$

No, the equation is not defined at $(x,y) = (1,0)\text{.}$

###### Exercise1.2.104

Match equations $y'=\sin x\text{,}$ $y'=\cos y\text{,}$ $y' = y\cos(x)$ to slope fields. Justify.
a) b) c)

a) $y'=\cos y\text{,}$ b) $y' = y\cos(x)\text{,}$ c) $y'=\sin x\text{.}$ Justification left to reader.

###### Exercise1.2.105

(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)\text{,}$ $y(0) = 0$ have a continuously differentiable solution? Does Picard apply, why, or why not?

Picard does not apply as $f$ is not continuous at $y=0\text{.}$ The equation does not have a continuously solution. If it did notice that $y'(0) = 1\text{,}$ by first derivative test, $y(x) > 0$ for small positive $x\text{,}$ but then for those $x$ we would have $y'(x) = 0\text{,}$ so clearly the derivative cannot be continuous.