Math Insight

Ordinary differential equation examples

Example 1

Solve the ordinary differential equation (ODE) $$\diff{x}{t} = 5x -3$$ for $x(t)$.

Solution: Using the shortcut method outlined in the introduction to ODEs, we multiply through by $dt$ and divide through by $5x-3$: $$\frac{dx}{5x-3} = dt.$$ We integrate both sides \begin{align*} \int \frac{dx}{5x-3} &= \int dt\\ \frac{1}{5} \log |5x-3| &= t + C_1\\ 5x-3 &= \pm \exp(5t+5C_1)\\ x &= \pm \frac{1}{5}\exp(5t+5C_1) + 3/5 . \end{align*} Letting $C = \frac{1}{5}\exp(5C_1)$, we can write the solution as $$x(t) = Ce^{5t}+ \frac{3}{5}.$$

We check to see that $x(t)$ satisfies the ODE: \begin{gather*} \diff{x}{t} = 5Ce^{5t}\\ 5x-3 = 5Ce^{5t}+ 3-3 = 5Ce^{5t}. \end{gather*} Both expressions are equal, verifying our solution.

Example 2

Solve the ODE combined with initial condition: \begin{align*} \diff{x}{t} &= 5x -3\\ x(2) &= 1. \end{align*}

Solution: This is the same ODE as example 1, with solution $$x(t) = Ce^{5t}+ \frac{3}{5}.$$ We just need to use the initial condition $x(2)=1$ to determine $C$.

$C$ must satisfy \begin{align*} 1 = Ce^{5\cdot 2}+ \frac{3}{5}, \end{align*} so it must be \begin{align*} C = \frac{2}{5} e^{-10}. \end{align*}

Our solution is $$x(t) = \frac{2}{5}e^{5(t-2)}+ \frac{3}{5}.$$ You can verify that $x(2)=1$.

Example 3

Solve the ODE with initial condition: \begin{align*} \diff{y}{x} &= 7y^2x^3\\ y(2) &= 3. \end{align*}

Solution: We multiply both sides of the ODE by $dx$, divide both sides by $y^2$, and integrate: \begin{align*} \int y^{-2}dy &= \int 7x^3 dx\\ - y^{-1} &= \frac{7}{4}x^4 +C\\ y & = \frac{-1}{\frac{7}{4}x^4 +C}. \end{align*} The general solution is \begin{align*} y(x) & = \frac{-1}{\frac{7}{4}x^4 +C}. \end{align*}

Verify the solution: \begin{align*} \diff{y}{x} &= \diff{}{x}\left(\frac{-1}{\frac{7}{4}x^4 +C}\right)\\ &=\frac{7x^3}{(\frac{7}{4}x^4 +C)^2}. \end{align*} Given our solution for $y$, we know that \begin{align*} y(x)^2 & = \left(\frac{-1}{\frac{7}{4}x^4 +C}\right)^2 = \frac{1}{(\frac{7}{4}x^4 +C)^2}. \end{align*} Therefore, we see that indeed \begin{align*} \diff{y}{x} &= \frac{7x^3}{(\frac{7}{4}x^4 +C)^2} = 7x^3y^2. \end{align*} The solution satisfies the ODE.

To determine the constant $C$, we plug the solution into the equation for the initial conditions $y(2) = 3$: \begin{align*} 3 & = \frac{-1}{\frac{7}{4}2^4 +C}. \end{align*} The constant $C$ is \begin{align*} C = -28\frac{1}{3}= -\frac{85}{3}, \end{align*} and the final solution is \begin{align*} y(x) & = \frac{-1}{\frac{7}{4}x^4 -\frac{85}{3}}. \end{align*}