Deniz Bilman, Department of Mathematics, University of Michigan
Consider the first order ODE
\begin{equation}\label{eq:ODEgen} \frac{dy}{dt}=f(x,t). \end{equation}This ODE describes how a quantity $y(t)$ changes with respect to the independent variable $t$ (can be time, distance from a point, or something else.) In this course we have two main goals:
In the first lecture, we realized that we can solve explicitly any autonomous ODE that is of the form
\begin{equation}\label{eq:} \frac{dy}{dx} = a\,y + b, \end{equation}where $a$ and $b$ are real numbers. This is one class of ODEs that we can solve. Today we ask "are there other types of ODEs that we can directly solve (implicitly or explicitly)?" The answer is "Yes." The first example of a class of ODEs that we can solve is the so-called separable ODEs.
In the remaining of this lecture we label the independent variable as $x$ instead of $t$. We do this because we want the student to be comfortable with different variables. Now consider the ODEs that are of the form
\begin{equation}\label{eq:ODEsep} \frac{dy}{dx} = p(x)\cdot q(y). \end{equation}Such an ODE is separable: The derivative $\frac{dy}{dx}$ of the dependent variable $y$ is equal to the product of two functions: $p(x)$, which is a function of the independent variable $x$, and $q(y)$, which is a function of the dependent variable $y$. The structure of the right hand side enables us to formally rewrite the ODE \eqref{eq:ODEsep} as
\begin{equation}\label{eq:ODEsep2} p(x) - \frac{1}{q(y)}\frac{dy}{dx} = 0. \end{equation}Now for convenience let's set
$$N(y) = -\frac{1}{q(y)}.$$(The book also sets $M(x)=p(x)$ at this stage.) We then can rewrite the expression \eqref{eq:ODEsep2} as:
\begin{equation}\label{eq:ODEsep3} p(x) + N(y)\frac{dy}{dx} = 0. \end{equation}Note that the ODE \eqref{eq:ODEsep3} is equivalent to the ODE \eqref{eq:ODEsep}. Therefore, ODEs of the form \eqref{eq:ODEsep3} are also called separable ODEs.
Let $H_1(x)$ be an antiderivative of $p(x)$:
$$p(x) = \frac{d}{dx} H_1 (x),$$or, equivalently
$$\int p(x)\,dx = H_1(x).$$Similarly, let $H_2(y)$ be an antiderivative (with respect to $y$) of $N(y)$:
$$\frac{d}{dy} H_2 (y) = N(y),$$or, equivalently
$$H_2(y) = \int N(y)\,dy.$$Now, since $y$ is a function $y(x)$ of $x$, $\frac{d}{dy} H_2 (y) = N(y),$ tells us that the second term on the left hand side of \eqref{eq:ODEsep3} is the derivative of $H_2(y(x))$ with respect to $x$ by the Chain Rule:
\begin{equation}\label{eq:term2} \frac{d}{dx} H_2(y(x)) = \frac{d H_2(y)}{dy}\cdot \frac{dy}{dx} = N(y)\frac{dy}{dx}. \end{equation}Recalling also that $p(x) = \frac{d}{dx} H_1 (x)$, the ODE \eqref{eq:ODEsep3}
\begin{equation*} p(x) + N(y)\frac{dy}{dx} = 0 \end{equation*}is equivalent to
\begin{align} \frac{d}{dx} H_1 (x) + \frac{d}{dx} H_2 (y(x)) &= 0\\ \frac{d}{dx}\Big(H_1 (x) + H_2 (y) \Big) &= 0\label{eq:ODEsep4}. \end{align}This means that the ODE we started with can be written as the derivative of a function of $x$ with respect to $x$. We have
$$\frac{d}{dx}\Big(H_1 (x) + H_2 (y) \Big)=0$$which implies that
\begin{equation}\label{eq:ODEsoln} H_1 (x) + H_2 (y) =c, \end{equation}for some arbitrary integration constant $c$. The expression \eqref{eq:ODEsoln} is the general solution to the ODE \eqref{eq:ODEsep} and it describes the 1-parameter family of ($c$ is the parameter) integral curves of the ODE.
We now apply this procedure in a couple of concrete examples. Given an initial value problem (IVP), we will be concerned with 3 questions:
Solve the initial value problem (IVP) $$ \frac{dy}{dx} = \frac{x^2}{1-y^2},~~~ y(0)=0. $$
First, observe that the ODE is separable:
$$ \frac{dy}{dx} = x^2\cdot\frac{1}{1-y^2}. $$We can then write
$$ (1-y^2)\frac{dy}{dx} -x^2=0 $$The first term on the left hand side is the derivative of $y(x) - \frac{y(x)^3}{3}$ with respect to $x$, that is:
$$ \frac{d}{dx}\left(y-\frac{y^3}{3}\right)=\frac{d}{dx}\left(y(x)-\frac{y(x)^3}{3}\right)= (1-y^2)\frac{dy}{dx} $$by the Chain Rule, and
$$ x^2=\frac{d}{dx}\frac{x^3}{3}. $$Thus we get that the ODE given in the problem can be expressed as:
\begin{equation}\label{eq:ex1deriv} \frac{d}{dx}\left(y(x) - \frac{y(x)^3}{3} - \frac{x^3}{3} \right) = 0. \end{equation}Here in this first example we denoted the dependence of $y$ on $x$ in our notation. We will suppress this dependence in the coming examples. We integrate \eqref{eq:ex1deriv} and obtain
\begin{equation}\label{eq:ODEcurves} y - \frac{y^3}{3} - \frac{x^3}{3} = c, \end{equation}for some arbitrary integration constant $c$. This can be rewritten as
\begin{equation}\label{eq:ex1sol} 3y - y^3 - x^3 = c. \end{equation}The equation \eqref{eq:ex1sol} is an implicit equation and it defines the integral curves (1-parameter family of curves, with the parameter $c$) for the ODE given in this initial value problem. Note that any function $y=\varphi(x)$ which satisifies the relation \eqref{eq:ex1sol} also satisfies the ODE under consideration.
Now, (especially for students who took Math 116) it is also possible to express
$$ \frac{dy}{dx} = x^2\cdot\frac{1}{1-y^2}. $$as
$$ (1-y^2)\,dy = x^2\,dx. $$Then integrating both sides and combining the resulting integration constants into a single arbitrary constant $c$ gives
$$ y-\frac{y^3}{3} = \frac{x^3}{3} + c, $$which is of course the same as \eqref{eq:ex1sol}. The reason we did not go through this calculation was to avoid doing algebra with the differentials $dy$ and $dx$ since we did not define them. These methods are not different. The process boils down to finding antiderivatives of $N(y)=1-y^2$ and $p(x)=x^2$ no matter how one proceeds.
See below a plot of these integral curves on the $(x,y)$-plane (for varying values of the constant $c$: see the color bar.)
In [1]:
using Plots
plotly()
import Gadfly
dark_panel = Gadfly.Theme(
line_width=2.5pt,
guide_title_position=:center
)
Gadfly.push_theme(dark_panel)
Gadfly.plot(z=(x,y) -> -x^3 - y^3 + 3*y,
x=linspace(-5,5,150), y=linspace(-5,5,150), Gadfly.Geom.contour(levels=-50:5:50), Gadfly.Guide.title("Integral Curves"),Gadfly.Guide.colorkey("c"))
Out[1]:
Now we use the IC $y(0)=0$ to pick a particular solution from this family. Note that if $x=0$ and $y=0$, then \eqref{eq:ex1sol} gives
$$ 3\cdot 0 - 0 - 0 = c \implies c=0 $$Thus the solution $y(x)$ to this IVP is given implicitly by
\begin{equation}\label{eq:ODEpartcurve} 3y - y^3 - x^3 = 0. \end{equation}See below for a plot of this particular solution. The initial condition is marked with an orange dot.
In [2]:
import Gadfly
t = -4:0.01:4
Gadfly.plot(Gadfly.layer(x=[0], y=[0], Gadfly.Geom.point, Gadfly.Theme(default_color=color(colorant"orange"),default_point_size=4pt)),Gadfly.layer(x= cbrt(3.*t - t.^3 ), y = t, Gadfly.Geom.path()),Gadfly.Guide.title("Particular solution for y(0)=0"))
Out[2]:
We cannot explicitly write down an expression for $y$ as a function $y=\varphi(x)$ of $x$. The solution exists on an interval of values of $x$, which contains the initial point $x=0$, as long as $\frac{dy}{dx}$ and $y$ both exist. We know that $\frac{dy}{dx}$ ceases to exist the moment the implicit curve \eqref{eq:ODEpartcurve} develops a vertical tangent line. The graph above indicates presence of two such points, which are marked purple below.
In [3]:
import Gadfly
t = -4:0.01:4
Gadfly.plot(Gadfly.layer(x=[0], y=[0], Gadfly.Geom.point, Gadfly.Theme(default_color=color(colorant"orange"),default_point_size=4pt)),Gadfly.layer(x=[-2^(1/3),2^(1/3)], y=[-1,1], Gadfly.Geom.point, Gadfly.Theme(default_color=color(colorant"purple"),default_point_size=4pt)),Gadfly.layer(x= cbrt(3.*t - t.^3 ), y = t, Gadfly.Geom.path()),Gadfly.Guide.title("Particular solution for y(0)=0"),Gadfly.layer( xintercept=[-2^(1/3), 2^(1/3)], Gadfly.Geom.vline(color=colorant"purple", size=1pt)))
Out[3]:
Although we cannot express $y$ as a function of $x$, we can still see from the ODE that $\frac{dy}{dx}$ does not exist if $y=\pm 1$ (the denominator is zero). We use the implicit equation \eqref{eq:ODEpartcurve} to find the $x$-coordinates of the points at which there are vertical tangents. It follows that these points are
$$ \left(-{2}^{1/3},-1\right)~\text{and}~({2}^{1/3},1) $$Therefore particular solution we found exists on the interval $-{2}^{1/3} <x <{2}^{1/3}$.
Solve the IVP \begin{equation}\label{eq:IVP2} \frac{dy}{dx} = 2(1+x)(1+y^2), ~y(0)=0, \end{equation} and find the point where the solution attains its minimum.
This ODE is clearly separable: $p(x) = 2(1+x)$ and $q(y) = 1+y^2$ in the notation we used above, and hence it can be written as
\begin{equation}\label{eq:ODE2} \frac{1}{1+y^2}\frac{dy}{dx} -2(1+x) = 0. \end{equation}First observe that we can find an antiderivative (omitting the arbitrary constant, will add it at the end) of $\frac{1}{1+y^2}$ with respect to $y$:
$$ \frac{d}{dy} \arctan(y) =\frac{1}{1+y^2} $$again, treating $y$ as a function $y(x)$ of $x$ and using Chain Rule we see that
$$ \frac{d}{dx}\arctan(y(x))= \frac{d}{dy}\arctan(y)\cdot \frac{dy}{dx} = \left(\frac{1}{1+y^2}\right)\frac{dy}{dx} $$which is the first term in the ODE \eqref{eq:ODE2}. The second expression $2(1+x)$ has the antiderivative $2x+x^2$
$$ \frac{d}{dx}(2x+x^2) = 2(1+x). $$These imply that the ODE \eqref{eq:ODE2} we have at our hands is equivalent to
\begin{equation}\label{eq:ODE2total} \frac{d}{dx}\left(\arctan(y) - 2x - x^2 \right) = 0. \end{equation}This equation can now be directly integrated to get
\begin{equation}\label{eq:ODE2curve} \arctan(y) - 2x - x^2 = c, \end{equation}where $c$ is an arbitrary constant. Below is a plot of the integral curves given by \eqref{eq:ODE2total}. We can clearly see that solutions develop vertical tangents somewhere in the interval $(-3,-2)$ and in the interval $(0,1)$. We will find those points.
In [4]:
using Plots
plotly()
import Gadfly
dark_panel = Gadfly.Theme(
line_width=2.5pt,
guide_title_position=:center
)
Gadfly.push_theme(dark_panel)
Gadfly.plot(z=(x,y) -> y - tan(x^2+2*x),
x=linspace(-4,4,200), y=linspace(-20,20,500), Gadfly.Geom.contour(levels=-50:5:50), Gadfly.Guide.title("Integral Curves"),Gadfly.Guide.colorkey("c"))
Out[4]:
First let's use the initial condition to pick a particular solution that satisfies the IVP. Plugging $x=0$ and $y=0$ to \eqref{eq:ODE2curve} gives $c=0$. Thus the particular solution is
$$ \arctan(y) -x^2-2x =0, $$and explicitly:
$$ y = \tan(x^2+2x). $$This solution exists as long as the value of $x^2+2x$ is away from $-\pi/2$ and $\pi/2$ (in which case the tangent function $\tan(\cdot)$ is undefined.) Note that
$$ x^2+2x > -1 > \frac{-\pi}{2}. $$Therefore $x^2+2x \neq \frac{-\pi}{2}$ for all $x$. We now find when $x^2+2x$ equals $\frac{\pi}{2}$:
$$ x^2 + 2x = \frac{\pi}{2} $$has 2 real solutions $x_1$ and $x_2$ given by:
\begin{align} x_1 &= \frac{1}{2}\left(-2 - \sqrt{4+2\pi}\right)\approx -2.6033 \\ x_2 &= \frac{1}{2}\left(-2 + \sqrt{4+2\pi}\right)\approx 0.6033. \end{align}Clearly the initial value $x=0$ lies in the open interval $(-x_1,x_2)$. Therefore the solution $y=\varphi(x)=\tan(x^2+2x)$ which satisfies $\varphi(0)=0$ exists in the open interval $(-x_1,x_2)$ which is approximately $(-2.6033,0.6033)$. Below we see the plot of this solution where the initial data is marked orange.
In [5]:
import Gadfly
t = -2.59:0.0001:0.59
Gadfly.plot(Gadfly.layer(x=[0], y=[0], Gadfly.Geom.point, Gadfly.Theme(default_color=color(colorant"orange"),default_point_size=4pt)),Gadfly.layer(x= t, y = tan(t.^2+2*t), Gadfly.Geom.path()),Gadfly.Guide.title("Particular solution for y(0)=0"),Gadfly.layer( xintercept=[-2.6, 0.6], Gadfly.Geom.vline(color=colorant"purple", size=1pt)))
Out[5]:
We now find where the minimum of $\varphi(x)=\tan(x^2+2x)$ occurs on this interval. First note that $\varphi(x)$ is differentiable on its interval of existence and $x=-1$ is its only critical point: $\varphi'(-1)=0$. Second, direct differentiation shows that $\varphi''(x) >0$ on this interval. Therefore the solution $y=\varphi(x)$ attains its minimum at $x=-1$. Here is a close-up of this solution to illustrate the minimum (in green).
In [6]:
import Gadfly
t = -2:0.0001:0.5
Gadfly.plot(Gadfly.layer(x=[0], y=[0], Gadfly.Geom.point, Gadfly.Theme(default_color=color(colorant"orange"),default_point_size=4pt)),Gadfly.layer(x=[-1], y=[tan(-1)], Gadfly.Geom.point, Gadfly.Theme(default_color=color(colorant"green"),default_point_size=4pt)),Gadfly.layer(x= t, y = tan(t.^2+2*t), Gadfly.Geom.path()),Gadfly.Guide.title("Minimum of the particular solution"),Gadfly.layer( yintercept=[tan(-1)], Gadfly.Geom.hline(color=colorant"green", size=1pt)))
Out[6]:
In [ ]: