# Differential Equations and Slope Fields

This section contains:

When you start learning how to integrate functions, you’ll probably be introduced to the notion of Differential Equations and Slope Fields.

# Differential Equations and Separation of Variables

A differential equation is basically any equation that has a derivative in it. For example, it typically contains $$x$$, $$y$$, and the derivative of $$y$$ ($${y}’$$ or $$\displaystyle \frac{{dy}}{{dx}}$$).

Remember the following from the Antiderivatives and Indefinite Integration section:

Definitions of Antiderivative (Integral):

A function $$F$$ is an antiderivative of another function $$f$$ when $${F}’\left( x \right)=f\left( x \right)$$.

Note that the term indefinite integral is another word for an antiderivative, and is denoted by the integral sign $$\int{.}$$

When we have the differential equation (an equation that involve $$x$$, $$y$$ and the derivative of $$y$$) in the form $$\displaystyle \frac{{dy}}{{dx}}=f\left( x \right)$$, we can write it as $$dy=f\left( x \right)dx$$. When we integrate, we have $$\displaystyle y=\int{{f\left( x \right)dx}}=F\left( x \right)+\,\,C$$, where $$C$$ is the constant of integration.

But the most important thing to remember is that integration is the opposite of differentiation!

To solve a differential equation, we need to separate the variables so that one variable is on the left hand side of the equal sign (usually the “$$y$$”, including the “$$dy$$”), and the other variable is on the right hand side (usually the “$$x$$”, including the “$$dx$$”).

At this point, we can integrate on both sides, and put the $$“+\,C”$$ on the side with the $$x$$’s (right away). We will simplify as needed, being careful to preserve the $$“+\,C”$$ during the simplification. Notice that if we add, subtract, multiply, or divide with the $$“+\,C”$$ when simplifying, we still end up with a constant $$(+\,C$$).

<

Here are some examples:

 Differential Equation Problem Solution Solve using separation of variables:     $$\displaystyle \frac{{dy}}{{dx}}=\frac{{{{x}^{2}}+4}}{{2{{y}^{3}}}}$$ We want to get everything with a “$$y$$” in it on the left, and everything with an “$$x$$” in it on the right. For this problem, we can just cross-multiply: $$\displaystyle 2{{y}^{3}}dy=\left( {{{x}^{2}}+4} \right)dx$$. Now integrate, and put the “$$+\,C$$” on the side with the “$$x$$”. Include the “$$+\,C$$” immediately after integrating: \displaystyle \begin{align}\int{{2{{y}^{3}}dy}}&=\int{{\left( {{{x}^{2}}+4} \right)dx}}\\2\cdot \frac{1}{4}{{y}^{4}}&=\frac{1}{3}{{x}^{3}}+4x+C\\{{y}^{4}}&=\frac{2}{3}{{x}^{3}}+8x+2C\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\text{(which is still }C\text{)}\\y&=\pm \sqrt[4]{{\frac{2}{3}{{x}^{3}}+8x+C}}\,\,\,\,\,\,\,\,\,\,\,\,\,\text{(include }\pm \text{ since we are taking even root)}\end{align} Solve using separation of variables:     $$\displaystyle \frac{1}{{\sqrt{{{{x}^{3}}-1}}}}\frac{{dy}}{{dx}}={{x}^{2}}{{y}^{3}}$$   which is:   $$\displaystyle {{\left( {{{x}^{3}}-1} \right)}^{{-\frac{1}{2}}}}\frac{{dy}}{{dx}}={{x}^{2}}{{y}^{3}}$$ We want to get everything with a “$$y$$” in it on the left, and everything with an “$$x$$” in it on the right. First, multiply both sides by $$dx$$: $$\displaystyle {{\left( {{{x}^{3}}-1} \right)}^{{-\frac{1}{2}}}}dy={{x}^{2}}{{y}^{3}}dx$$. Then “move” the “$$x$$” variables to the right, and “$$y$$” to the left by multiplying or dividing on both sides: $$\displaystyle \frac{{dy}}{{{{y}^{3}}}}=\frac{{{{x}^{2}}dx}}{{{{{\left( {{{x}^{3}}-1} \right)}}^{{-\frac{1}{2}}}}}},\,\,\,\text{or}\,\,\,{{y}^{{-3}}}dy={{\left( {{{x}^{3}}-1} \right)}^{{\frac{1}{2}}}}{{x}^{2}}dx$$   Now integrate, and put the “$$+\,C$$” on the side with the “$$x$$”. Note that we have to use $$u$$-sub for the right-hand side: \require {cancel} \displaystyle \begin{align}\int{{{{y}^{{-3}}}dy}}&=\int{{{{{\left( {{{x}^{3}}-1} \right)}}^{{\frac{1}{2}}}}{{x}^{2}}dx}}\\\int{{{{y}^{{-3}}}dy}}&=\int{{\frac{{{{u}^{{\frac{1}{2}}}}}}{3}\cancel{{{{x}^{2}}}}}}\frac{{du}}{{3\cancel{{{{x}^{2}}}}}}\end{align}          $$\displaystyle u={{x}^{3}}-1;\,\,\,du=3{{x}^{2}}dx;\,\,\,dx=\frac{{du}}{{3{{x}^{2}}}}$$   \displaystyle \begin{align}-\frac{1}{2}{{y}^{{-2}}}&=\frac{1}{3}\frac{{{{{\left( {{{x}^{3}}-1} \right)}}^{{\frac{3}{2}}}}}}{{\frac{3}{2}}}+C=\frac{2}{9}{{\left( {{{x}^{3}}-1} \right)}^{{\frac{3}{2}}}}+C\\{{y}^{{-2}}}&=\left( {\frac{2}{9}{{{\left( {{{x}^{3}}-1} \right)}}^{{\frac{3}{2}}}}+C} \right)\cdot -2=-\frac{4}{9}{{\left( {{{x}^{3}}-1} \right)}^{{\frac{3}{2}}}}+-2C\,\,\,\,\,\,\,\,\,\text{(which is still }C\text{)}\\{{\left( {{{y}^{{\cancel{{-2}}}}}} \right)}^{{\cancel{{-\frac{1}{2}}}}}}&={{\left( {-\frac{4}{9}{{{\left( {{{x}^{3}}-1} \right)}}^{{\frac{3}{2}}}}+C} \right)}^{{-\frac{1}{2}}}}\\y&=\pm \frac{1}{{\sqrt{{-\frac{4}{9}{{{\left( {{{x}^{3}}-1} \right)}}^{{\frac{3}{2}}}}+C}}}}\,\,\,\,\,\,\,\,\,\,\,\text{(include }\pm \text{ since we are taking even root)}\\y&=\pm \frac{3}{{2\sqrt{{-{{{\left( {{{x}^{3}}-1} \right)}}^{{\frac{3}{2}}}}+C}}}}\,\,\,\,\,\,\,\,\,\,\,\,\,\text{(there are many ways to simplify)}\end{align}

Sometimes we have to solve the differential equation and then put in an initial value to get the $$“C”$$. When doing this, it’s best to put in the initial condition immediately after differentiating. Here are some examples; sorry the math is so messy:

 Differential Equation Problem Solution Solve the differential equation   $$\displaystyle 10{{y}^{4}}\frac{{dy}}{{dx}}-5{{x}^{5}}=0$$,   given that the point $$(2,1)$$ is on the curve. We want to get everything with a “$$y$$” in it on the left, and everything with an “$$x$$” in it on the right. Multiply both sides by $$dx$$: $$\displaystyle 10{{y}^{4}}dy=5{{x}^{5}}\,dx$$, or $$\displaystyle 2{{y}^{4}}dy={{x}^{5}}\,dx$$.   Now integrate, and put the “$$+\,C$$” on the side with the “$$x$$”. \displaystyle \begin{align}\int{{2{{y}^{4}}dy}}&=\int{{{{x}^{5}}\,dx}}\\\frac{2}{5}{{y}^{5}}&=\frac{1}{6}{{x}^{6}}\,+C\end{align} Put in initial point $$(2,1)$$ to determine “$$C$$”: $$\displaystyle \frac{2}{5}{{\left( 1 \right)}^{5}}=\frac{1}{6}{{\left( 2 \right)}^{6}}\,+C\,\,\,\Rightarrow \,\,\,\,C=\frac{2}{5}-\frac{{32}}{3}=-\frac{{154}}{{15}}$$ Our equation is $$\displaystyle \frac{2}{5}{{y}^{5}}=\frac{1}{6}{{x}^{6}}\,-\frac{{154}}{{15}}$$, so let’s solve for $$y$$: $$\require {cancel} \displaystyle \frac{2}{5}{{y}^{5}}=\frac{1}{6}{{x}^{6}}\,-\frac{{154}}{{15}}\,\Rightarrow {{y}^{5}}=\left( {\frac{1}{6}{{x}^{6}}\,-\frac{{{}^{{77}}\cancel{{154}}}}{{{}_{3}\cancel{{15}}}}} \right)\left( {\frac{{\cancel{5}}}{{\cancel{2}}}} \right)\Rightarrow y=\sqrt[5]{{\frac{5}{{12}}{{x}^{6}}\,-\frac{{77}}{3}}}$$ Solve the initial value problem using separation of variables:   $$\displaystyle y\frac{{dy}}{{dx}}=8\sqrt{{{{{\left( {1+{{y}^{2}}} \right)}}^{3}}}}$$   $$\displaystyle y\left( 0 \right)=1$$ We want to get everything with a “$$y$$” in it on the left, and everything with an “$$x$$” in it on the right. First, multiply both sides by $$dx$$: $$\displaystyle y\,dy=8\sqrt{{{{{\left( {1+{{y}^{2}}} \right)}}^{3}}}}dx$$, or $$\displaystyle y\,dy=8{{\left( {1+{{y}^{2}}} \right)}^{{\frac{3}{2}}}}dx$$. Then “move” everything with a “$$y$$” to the left by multiplying on both sides: \displaystyle \begin{align}y\,dy&=8{{\left( {1+{{y}^{2}}} \right)}^{{\frac{3}{2}}}}dx\,\,\,\\&\Rightarrow \,\,y\,{{\left( {1+{{y}^{2}}} \right)}^{{-\frac{3}{2}}}}dy=8\cancel{{{{{\left( {1+{{y}^{2}}} \right)}}^{{\frac{3}{2}}}}\cdot {{{\left( {1+{{y}^{2}}} \right)}}^{{-\frac{3}{2}}}}}}dx\,\,\,\\&\Rightarrow \,\,y\,{{\left( {1+{{y}^{2}}} \right)}^{{-\frac{3}{2}}}}dy=8dx\end{align}   Now integrate, and put the “$$+\,C$$” on the side with the “$$x$$”. Note that we have to use $$u$$-sub on the left-hand side: \displaystyle \begin{align}\int{{y\,{{{\left( {1+{{y}^{2}}} \right)}}^{{-\frac{3}{2}}}}dy}}&=\int{{8dx}}\\\int{{\cancel{y}\,{{u}^{{-\frac{3}{2}}}}\cdot \frac{{du}}{{2\cancel{y}}}}}&=\int{{8dx}}\end{align}        $$\displaystyle u=1+{{y}^{2}};\,\,\,du=2y\,dy;\,\,\,dy=\frac{{du}}{{2y}}$$ $$\displaystyle \frac{1}{2}\int{{{{u}^{{-\frac{3}{2}}}}du}}=\int{{8dx}}\,\,\,\,\Rightarrow \,\,\,\frac{1}{2}\frac{{{{u}^{{-\frac{1}{2}}}}}}{{-\frac{1}{2}}}=8x+C\,\,\,\,\Rightarrow \,\,\,-{{\left( {1+{{y}^{2}}} \right)}^{{-\frac{1}{2}}}}=8x+C$$   Put in initial point $$(0,1)$$ to determine “$$C$$”. We also rationalized the denominator: $$\displaystyle -{{\left( {1+{{{\left( 1 \right)}}^{2}}} \right)}^{{-\frac{1}{2}}}}=8\left( 0 \right)+C\,\,\,\Rightarrow \,\,\,\,C=-\frac{1}{{\sqrt{2}}}\cdot \frac{{\sqrt{2}}}{{\sqrt{2}}}=-\frac{{\sqrt{2}}}{2}$$ Our equation is $$\displaystyle -{{\left( {1+{{y}^{2}}} \right)}^{{-\frac{1}{2}}}}=8x-\frac{{\sqrt{2}}}{2}$$, so let’s solve for $$y$$:   $$\displaystyle -{{\left( {1+{{y}^{2}}} \right)}^{{-\frac{1}{2}}}}=8x-\frac{{\sqrt{2}}}{2}\,\,\Rightarrow 1+{{y}^{2}}={{\left( {-8x+\frac{{\sqrt{2}}}{2}} \right)}^{{-2}}}\,\Rightarrow y=\sqrt{{{{{\left( {-8x+\frac{{\sqrt{2}}}{2}} \right)}}^{{-2}}}-1}}$$ Note that we only take the positive square root, since our initial value of $$y$$ is positive (1).

# Slope Fields

Slope Fields are a strange concept (they look funny!), but they really aren’t that difficult.

<
<

Slope fields are little lines on a coordinate system graph that represent the slope for that $$(x,y)$$ combination for a particular differential equation (remember that a differential equation represents a slope). For example, for the differential equation $$\displaystyle \frac{{dy}}{{dx}}=x+y$$, for point $$(0,0)$$ on the slope field graph, the little line would be horizontal, since $$0+0=0$$, and the slope of 0 is represented by a horizontal line.

Let’s show an example. If we have the differential equation $$\displaystyle \frac{{dx}}{{dy}}=\frac{x}{y},$$ do you see how the slope will be 0 everywhere $$x$$ is 0, and it will be 1 everywhere $$x$$ and $$y$$ are the same? And it will be 2 when $$x$$ is twice the value of $$y$$, and so on? The slope is undefined (vertical lines or no lines) when $$y=0$$.

Here’s the slope field. Again, remember that the little lines represent the slope, since a differential equation is a slope.

Slope Field for:   $$\displaystyle \frac{{dy}}{{dx}}=\frac{x}{y}$$

Here are more examples of slope fields. Note that if we solved the differential equation, we’d see the solution to that differential equation in the slope field pattern. For example, for the differential equation $$\displaystyle \frac{{dy}}{{dx}}=2$$, the little lines in the slope field graph are $$\displaystyle y=2x$$.

 Differential Equation Slope Field Graph Solution to Differential Equation $$\displaystyle \frac{{dy}}{{dx}}=2$$ \displaystyle \begin{align}dy&=2dx\\\int{{dy}}&=\int{{2dx}}\\y&=2x+C\end{align} $$\displaystyle \frac{{dy}}{{dx}}={{x}^{2}}$$ \displaystyle \begin{align}dy&={{x}^{2}}dx\\\int{{dy}}&=\int{{{{x}^{2}}dx}}\\y&=\frac{{{{x}^{3}}}}{3}+C\end{align} $$\displaystyle \frac{{dy}}{{dx}}=\sin x$$ \displaystyle \begin{align}dy&=\sin x\,dx\\\int{{dy}}&=\int{{\sin x\,dx}}\\y&=-\cos x+C\end{align} $$\displaystyle \frac{{dy}}{{dx}}=\frac{1}{{3{{y}^{2}}}}$$ \displaystyle \begin{align}3{{y}^{{2\,}}}dy&=\,dx\\\int{{3{{y}^{{2\,}}}dy}}&=\int{{dx}}\\{{y}^{3}}&=x+C\\y&=\sqrt[3]{{x+C}}\end{align}

Here’s a few more that we’ll draw with solution curves, given the solution passes through the given initial points. To draw the solution curves, start with the initial point, and then follow the curve of the little lines as you best can:

 Differential Equation Slope Field Graph $$\displaystyle \frac{{dy}}{{dx}}=\frac{{{{x}^{2}}}}{y}$$   through point $$\left( {1,1} \right)$$ $$\displaystyle \frac{{dy}}{{dx}}=x-y$$   through point $$\left( {2,1} \right)$$ $$\displaystyle \frac{{dy}}{{dx}}=xy$$   through point $$\left( {0,1} \right)$$

Here’s a type of slope field problem you might see:

 Slope Field Problem Solution Which statement is not correct about the drawing of the slope field for:   $$\displaystyle \frac{{dy}}{{dx}}=-3y$$   a. All of the lines in a particular row are the same. b. All of the lines in a particular column are the same. c. All lines below the $$x$$-axis have a positive slope. d. All lines above the $$x$$-axis have a negative slope. e. There are horizontal lines on the $$x$$-axis. Since the slopes for each $$\displaystyle \frac{{dy}}{{dx}}$$ depends on a $$y$$ value ($$-3y$$) and not an $$x$$ value, all the slopes (lines drawn) across a particular row are the same. For negative $$x$$ values, the slope will be positive (negative times a negative) and for positive $$x$$ values, the slope will be negative (negative times a positive). The slope values across the row at $$y=0$$ are all $$\displaystyle -3\left( 0 \right)=0$$ (horizontal lines).    Thus, a, c, d, and e are correct, so the answer is b.   We could also draw the slope field to see this graphically:

Learn these rules, and practice, practice, practice!

On to L’Hopital’s Rule – you are ready!

<