## Section 1.2 Slope fields

¶*Note: 1 lecture, §1.3 in [EP], §1.1 in [BD]*

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

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

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

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 2.2.2 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 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. 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 2.2.3 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 2.2.4. 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.

### Subsection 1.2.2 Existence and uniqueness

We wish to ask two fundamental questions about the problem

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

Attempt to solve:

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

###### Example 1.2.2.

Solve:

See Figure 2.2.7. Note that \(y=0\) is a solution. But another solution is the function

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

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

exists (at least for some small interval of \(x\)'s) 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.3.

For some constant \(A\text{,}\) solve:

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

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

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

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

###### Exercise 1.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.

###### Exercise 1.2.6.

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

###### Exercise 1.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.

###### Exercise 1.2.8.

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

Find two distinct solutions.

Explain why this does not violate Picard's theorem.

###### Exercise 1.2.9.

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

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

###### Exercise 1.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?

###### Exercise 1.2.12.

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

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

###### Exercise 1.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).

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

###### Exercise 1.2.104.

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

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

###### Exercise 1.2.105.

*(tricky)* Suppose

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

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?

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