## Section 1.2 Slope fields

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 1.2.1 Slope fields

We can visually describe 1st order ODEs using Slope Fields, which allows us to encode the slope at any point. We will see that the concepts of differential equations, solutions, an initial conditions that we have thus far described analytically - i.e. with equations - all have a geometric parallel.

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\text{.}\) In other words, \(f(x,y)\) is the slope of a solution whose graph runs through 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 \(xy = 2 \times 1.5 = 3\text{.}\) So, if \(y(x)\) is a solution and \(y(2) = 1.5\text{,}\) then the equation mandates that \(y'(2) = 3\text{.}\) See Figure 1.2.

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)\text{.}\) 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 Figure 1.3 for the slope field of the equation \(y' = xy\text{.}\) 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 we drew. For a few sample solutions, see Figure 1.4. 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.

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 1.4 we see what the solutions do when the initial conditions are \(y(0) > 0\text{,}\) \(y(0) = 0\) and \(y(0) < 0\text{.}\) 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\text{.}\) The slope field and a few solutions is in see Figure 1.5. 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.

#### Example 1.2.1.

*Geogebra Activity:*Use this Geogebra slope field plotter

^{ 1 }to explore the slope fields of several first order differential equations and play around with the solutions starting at different initial conditions.

### Subsection 1.2.2 Existence and uniqueness

#### Video 1.2.2. Existence and Uniqueness.

The key theorems that makes differential equations work are called Existence and Uniqueness theorems. They tell you, depending on the type of ODE, when solutions exist, and when they are unique. This is pretty crucial, because otherwise we’d never know whether it was worth bothering to try to find a solution, or if we found one whether to keep looking. We will see many Existence and Uniqueness theorems, but for now we are focusing specifically on 1st order ODEs.

We wish to ask two fundamental questions about the problem

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

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

#### Example 1.2.2.

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 1.6. The equation may have been written as the seemingly harmless \(x y' = 1\text{.}\)

#### Example 1.2.3.

Solve:

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

See Figure 1.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

^{ 2 }.#### Theorem 1.2.1. Picard’s theorem on existence and uniqueness.

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)\text{,}\) 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.

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.

#### Example 1.2.4.

For some constant \(A\text{,}\) solve: \[ y’ = y^2, y(0) = A . \]

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{.}\)

### Subsection 1.2.3 Exercises

For problems 1-5, try sketching by hand first, then you can use the Slope Field plotter to see the answer: https://www.geogebra.org/m/z9c3ndaf

^{ 4 }.#### Exercise 1.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?

#### Exercise 1.2.2.

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

#### Exercise 1.2.3.

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

#### Exercise 1.2.4.

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

Answer.

a) \(y' = x(1-y)\text{,}\) b) \(y'=1-x\text{,}\) c) \(y'=x-2y\text{.}\)

#### Exercise 1.2.5.

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

Answer.

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

#### Exercise 1.2.6.

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

Answer.

\(f(x,y)\) is continuous near \((0,1)\) and \(\frac{\partial f}{\partial y}=\frac{x}{\cos x}\) exists and is continuous near \((0,1)\text{,}\) therefore by Picard’s theorem a unique solution exists.

#### Exercise 1.2.7.

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

Answer.

\(f(x,y)\) is continuous near \((0,0)\) and \(\frac{\partial f}{\partial y}=\sqrt{|x|}\) exists and is continuous near \((0,0)\text{,}\) therefore by Picard’s theorem a unique solution exists.

#### Exercise 1.2.8.

*(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.

Answer.

The slope field for this equation would have slopes of at least one everywhere as \(f(x,y)>1\) for all \(x\) and \(y\text{,}\) so with an initial condition \((0,0)\) a solution would pass through the origin and keep on increasing forever. Thus as \(x\rightarrow \infty\text{,}\) \(y\rightarrow \infty\text{.}\)

#### Exercise 1.2.9.

*(challenging)*Take \((y-x)y' = 0\text{,}\) \(y(0) = 0\text{.}\)

- Find two distinct solutions.
- Explain why this does not violate Picard’s theorem.

Answer.

a) \(y=0,\quad y=x\)

b) The DE cannot be written in the form \(y'=f(x,y)\text{,}\) so Picard’s theorem does not apply.

b) The DE cannot be written in the form \(y'=f(x,y)\text{,}\) so Picard’s theorem does not apply.

#### Exercise 1.2.10.

Suppose \(y' = f(x,y)\text{.}\) What will the slope field look like, explain and sketch an example, if you know the following about \(f(x,y)\text{:}\)

- \(f\) does not depend on \(y\text{.}\)
- \(f\) does not depend on \(x\text{.}\)
- \(f(t,t) = 0\) for any number \(t\text{.}\)
- \(f(x,0) = 0\) and \(f(x,1) = 1\) for all \(x\text{.}\)

#### Exercise 1.2.11.

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

Answer.

\(y=0\) is a solution. \(f(x,y)\) is continuous but \(\frac{\partial f}{\partial y}\) does not exist near \((0,0)\text{,}\) so Picard’s theorem does not apply.

#### Exercise 1.2.12.

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?

Answer.

\(y=2x\)

#### Exercise 1.2.13.

*(challenging)*Suppose \(y' = f(x,y)\) is such that \(f(x,1) = 0\) for every \(x\text{,}\) \(f\) is continuous and \(\frac{\partial f}{\partial y}\) exists and is continuous for every \(x\) and \(y\text{.}\)

- Guess a solution given the initial condition \(y(0) = 1\text{.}\)
- Can graphs of two solutions of the equation for different initial conditions ever intersect?
- Given \(y(0) = 0\text{,}\) what can you say about the solution. In particular, can \(y(x) > 1\) for any \(x\text{?}\) Can \(y(x) = 1\) for any \(x\text{?}\) Why or why not?

Answer.

a) \(y=1\)

b) No. As this satisfies the conditions of Picard’s Theorem everywhere, there must be a unique solution from any given points. Thus two different solutions at the same point is not possible as that point can be taken as the initial condition.

c) Since \(y=1\) is one solution for a different initial condition, by part (b), any other solution cannot intersect that. Given that the initial condition here \(y(0)=0\) is below the \(y(x)=1\) line, the solution can never intersect with 1, thus \(y(x)< 1\) for all \(x\text{.}\)

b) No. As this satisfies the conditions of Picard’s Theorem everywhere, there must be a unique solution from any given points. Thus two different solutions at the same point is not possible as that point can be taken as the initial condition.

c) Since \(y=1\) is one solution for a different initial condition, by part (b), any other solution cannot intersect that. Given that the initial condition here \(y(0)=0\) is below the \(y(x)=1\) line, the solution can never intersect with 1, thus \(y(x)< 1\) for all \(x\text{.}\)

#### Exercise 1.2.14.

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

Answer.

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

#### Exercise 1.2.15.

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

Answer.

Yes a solution exists. The equation is \(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.)

#### Exercise 1.2.16.

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

Answer.

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

#### Exercise 1.2.17.

*(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?

Answer.

Picard does not apply as \(f\) is not continuous at \(y=0\text{.}\) The equation does not have a continuously differentiable solution. Suppose it did. Notice that \(y'(0) = 1\text{.}\) By the 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.

#### Exercise 1.2.18.

Consider an equation of the form \(y' = f(x)\) for some continuous function \(f\text{,}\) and an initial condition \(y(x_0) = y_0\text{.}\) Does a solution exist for all \(x\text{?}\) Why or why not?

Answer.

The solution is \(y(x) = \int_{x_0}^x f(s) \,ds + y_0\text{,}\) and this does indeed exist for every \(x\text{.}\)

`www.geogebra.org/m/zjfhbkqe`

Named after the French mathematician Charles Émile Picard

^{ 3 }(1856–1941)`en.wikipedia.org/wiki/Charles_\%C3\%89mile_Picard`

`www.geogebra.org/m/z9c3ndaf`