Elementary Solution Methods for First-Order ODEs

Consider the first-order ODE $$y'=f(t,y)$$ describing the evolution of $y$ as a function of $t$. If we know initial conditions $y(t_{0})=y_{0}$, two questions immediately come to mind:

1. Does $y'=f(t,y)$, $y(t_{0})=y_{0}$ have a solution?

2. If so, can we find a formula for the solution?

The first question is easily addressed:

 Existence and Uniqueness Theorem Suppose that $f(t,y)$ and $\frac{\partial f(t,y)}{\partial y}$ are continumous on a closed rectangle $R$ of the $ty$-plane. If $(t_{0},y_{0}) \in R$, then the IVP $$y'=f(t,y), \quad y(t_{0})=y_{0}$$ has a unique solution $y(t)$ on some $t$-interval containing $t_{0}$.

The second question is much more difficult, and often we need to resort to numerical methods. However, in this tutorial we review four of the most commonly-used analytic solution methods for first-order ODES.

#### Separating the Variables

If an ODE can be written in the form $$\frac{\partial y}{\partial t}=\frac{g(t)}{h(y)},$$ then the ODE is said to be separable. In this case, a simple solution technique can be derived as follows:

Suppose $y=f(t)$ solves the ODE. Rewriting the ODE as $h(y)y'=g(t)$,

$\begin{array}{rcl} h(f(t))f'(t) &= &g(t) \\ \int h(f(t))f'(t)dt &= &\int g(t)dt +C \\ \int h(y)dy & = & \int g(t)dt +C. \end{array}$
 Since $y=f(t)$, $y'=f'(t)$.
 Integrating with respect to $t$ on each side.
 Since $dy=f'(t)dt$.

Upon integrating, we have our implicitly-defined general solution of the ODE, which we can often solve explicitly for $y(t)$.

#### Example

Let's solve the separable ODE $y' = \frac{4y}{t}$. Separating the variables and integrating,

$\begin{array}{rcl} \int \frac{dy}{4y} &= &\int \frac{dt}{t} +C_{1}, \\ \frac{1}{4} \ln |y| &= &\ln |t| +C_{1}, \\ \frac{1}{4} \ln |y| - \ln |t| &= &C_{1} \\ \ln \left| \frac{y^{1/4}}{t} \right| & = & C_{1} \\ e^{\ln \left| \frac{y^{1/4}}{t} \right|} & = & e^{C_{1}} \\ \left| \frac{y^{1/4}}{t} \right| & = & C_{2} \\ y^{1/4} & = & C_{2}t & \\ y & = & Ct^{4}. \end{array}$
 Recall that $r\ln a = \ln a^{r} \mathrm{~and~}$ $\ln a - \ln b = \ln \frac{a}{b}.$
 $e^{\ln a}= a$. Relabel $e^{C_{1}}$ as $C_{2}$.
 Relabel $C_{2}^{4}$ as $C$.

The general solution, $y=Ct^4$, defines a family of solution cuves corresponding to various initial conditions.

View Solutions

#### Using an Integrating Factor to solve a Linear ODE

If a first-order ODE can be written in the normal linear form $$y'+p(t)y= q(t),$$ the ODE can be solved using an integrating factor $\mu (t)= e^{\int p(t)dt}$:

$$\mu (t)\left[ y' + p(t)y \right] = \mu (t)q(t)$$
 Multiplying both sides of the ODE by $\mu (t)$.
$$\left( \mu (t)y \right) ' = \mu (t)q(t)$$
 $\left( \mu (t)y \right) ' = \mu (t)y' + \mu '(t)y$ and $\mu '(t) = p(t) \mu (t)$ using the chain rule to differentiate $\mu (t)= e^{\int p(t)dt}$.
$$\mu (t)y = \int \mu (t)q(t) dt + C.$$
 Integrating each side with respect to $t$.

Dividing through by $\mu (t)$, we have the general solution of the linear ODE.

#### Example

We can solve the linear ODE $y'-2ty=t$ using an integrating facter. Here, $p(t)=-2t$ and $q(t)=1$, so $$\mu (t) = e^{\int -2t dt}=e^{-t^{2}}$$ Multiplying both sides of the ODE by $\mu (t)$,

$\begin{array}{rcl} e^{-t^{2}}(y'-2ty) & = & te^{-t^{2}} \\ (e^{-t^{2}}y)' & = & te^{-t^{2}} \\ e^{-t^{2}}y & = & -\frac{1}{2}e^{-t^{2}}+C \\ y & = & Ce^{t^{2}}-\frac{1}{2}. \end{array}$
 You can verify that $(e^{-t^{2}}y)'=e^{-t^{2}}(y'-2ty)$ by using the Chain Rule to differentiate $e^{-t^{2}}y$
 Integrating each side with respect to $t$.
 Dividing through by $e^{-t^{2}}$.

So the general solution of $y'-2ty=t$ is $y(t)=Ce^{t^{2}}-\frac{1}{2}$.

For practice, solve $y' = \frac{4y}{t}$ by putting it in normal linear form and using an integrating factor. Verify that you get the same result as we did by separating the variables.

View Solutions

#### Using a Change of Variables

Often, a first-order ODE that is neither separable nor linear can be simplified to one of these types by making a change of variables. Here are some important examples:

• Homogeneous Equation of Order 0: $\frac{dy}{dx} = f(x,y)$ where $f(kx,ky)= f(x,y)$.

Use the change of variables $z=\frac{y}{x}$ to convert the ODE to $x\frac{dz}{dx} = f(1,z)-z$, which is separable.

• Bernoulli Equation: $\frac{dy}{dt}+p(t)y= q(t)y^{b} \quad (b \not= 0,1)$.

Use the change of variables $z=y^{1-b}$ to convert the ODE to $\frac{dz}{dt} + (1-b)p(t)z=(1-b)q(t)$, which is linear.

• Riccati Equation: $\frac{dy}{dt}=a(t)y+b(t)y^{2}+ F(t)$.

If one particular solution $g(t)$ is known, use the change of variables $z=\frac{1}{y-g}$ to convert the ODE to $\frac{dz}{dt}+ (a+2bg)z=-b$, which is linear.

When using a change of variables, solve the transformed ODE and then return to the original variables to obtain the general solution of the original ODE. Often, you will have to leave your solution in implicit form.

#### Example

Let's solve the ODE $\frac{dy}{dx}=\frac{y-x}{x-4y}$. To see that it is homogeneous of order 0, note that $$f(kx,ky)= \frac{ky-kx}{kx-4ky}=\frac{y-x}{x-4y}=f(x,y).$$

Let $z=\frac{y}{x}$. Then $y=xz$, so $\frac{dy}{dx}=x\frac{dz}{dx}+z$. The ODE becomes \begin{eqnarray*} x\frac{dz}{dx}+z &= & \frac{xz-x}{x-4xz} \\ x\frac{dz}{dx}+z &= & \frac{z-1}{1-4z}\\ x\frac{dz}{dx} & = & \frac{4z^{2}-1}{1-4z}, \end{eqnarray*} which is separable. Separating the variables and integrating,

\begin{eqnarray*} \int \frac{4z^{2}-1}{1-4z}dz &= & \int \frac{1}{x}dx \\ \int \left( \frac{-3/2}{2z+1} + \frac{-1/2}{2z-1} \right) dz & = & \int \frac{1}{x}dx \\ -\frac{3}{4} \ln |2z+1| - \frac{1}{4} \ln |2z-1| & = & \ln |x| + C_{1}\\ 3 \ln |2z+1| + \ln |2z-1| & = & -4\ln |x| + C_{2}\\ \ln \left| (2z+1)^{3}(2z-1)x^{4} \right| & = & C_{2}\\ e^{\ln \left| (2z+1)^{3}(2z-1)x^{4} \right|} & = & e^{C_{2}}\\ \left| (2z+1)^{3}(2z-1)x^{4} \right| & = & C\\ \left( 2\frac{y}{x}+1 \right) ^{3} \left( 2\frac{y}{x}-1 \right)x^{4} & = & C\\ (2y+x)^{3}(2y-x) & = & C. \end{eqnarray*}
 Using partial fractions.
 Multiplying through by $-4$ and relabelling $-4C_{1}$ as $C_{2}$.
 Returning to the original variables using $z=y/x$.

The general solution, $(2y+x)^{3}(2y-x) = C$, is written implicitly.

View Solutions

#### Finding an Integral for an Exact Equation

An ODE $N(x,y)y' + M(x,y) = 0$ is an exact equation if $\frac{\partial N}{\partial x} = \frac{\partial M}{\partial y}$ in a region of the $xy$-plane. If we can find a function $H(x,y)$ for which $\frac{\partial H}{\partial x}= M$ and $\frac{\partial H}{\partial y}= N$, then $H(x,y)$ is called an integral of the ODE and $H(x,y) = C$ is the general solution of the original ODE.

To find $H(x,y)$, note that $$H(x,y) = \int M(x,y)dx + g(y)$$ for some $g(y)$ since $\frac{\partial H}{\partial x}= M(x,y)$. To find $g(y)$, calculate $$\frac{\partial H}{\partial y}=\frac{\partial}{\partial y} \left[ \int M(x,y)dx \right] + g'(y)$$ and set it equal to $N(x,y)$. Solve for $g'(y)$ (which will be independent of $x$) and integrate with respect to $y$ to obtain $g(y)$, and so $H(x,y)$, explicitly. Notice that our solution $H(x,y) = C$ is written in implicit form. (Alternatively, we can start with $H(x,y) = \int N(x,y)dy + h(x)$ for some $h(x)$ and proceed accordingly.)

#### Example

The ODE $\left( 2yx^{2} + 4 \right) \frac{dy}{dx} + \left( 2y^{2}x -3 \right) = 0$ is exact, since for $N(x,y) = 2yx^{2} + 4$ and $M(x,y) = 2y^{2}x -3$, $$\frac{\partial N}{\partial x}=4xy=\frac{\partial M}{\partial y}.$$ Thus, there exists an integral $H(x,y)$ for which $$\frac{\partial H}{\partial x}= 2y^{2}x-3 \mathrm{~and~} \frac{\partial H}{\partial y}= 2yx^{2}+4.$$ From the first of these, \begin{eqnarray*} H(x,y) &= & \int \left( 2y^{2}x -3 \right) dx + g(y) \\ H(x,y) &= & y^{2}x^{2}-3x+g(y) . \end{eqnarray*} Then $\frac{\partial H}{\partial y}=2yx^{2} + g'(y)=2yx^{2}+4$, so $g'(y)=4$.

Integrating, $g(y)= 4y$, so $H(x,y)= y^{2}x^{2}-3x+4y$.

The general solution is given implicitly by $$y^{2}x^{2}-3x+4y =C.$$

View Solutions

### Key Concepts

•  • Separable ODES: $$\frac{dy}{dt}= \frac{g(t)}{h(y)}$$ $\qquad$ The general solution is given by integrating $\int h(y)dy = \int g(t)dt +C$.

•  • Linear First-Order ODEs: $$y' + p(t)y = g(t)$$ $\qquad$ Use an integrating factor $e^{\int p(t)dt}$.

•  • Homogeneous of Order Zero,   Bernoulli Equation,   Riccati Equation: $\qquad$ Use the appropriate change of variable to convert the original ODE into either a separable ODE or a linear ODE.

•  • Exact ODEs: $N(x,y)y'+ M(x,y)=0$, where $\displaystyle{\frac{\partial N}{\partial x}= \frac{\partial M}{\partial y}}$ $\qquad$ Find $H(x,y)$ such that $\frac{\partial H}{\partial x}= M$ and $\frac{\partial H}{\partial y} = N$. The general solution is given by $H(x,y)= C$.