Skip to main content

Course Notes for Calculus I

Section 9.2 Solving Differential Equations

Subsection 9.2.1 Solving By Direct Integration

In Section 3.2, I talked about differential equations in order to understand derivatives as rates of changes. I looked at autonomous differential equations, particularly for populations models, and I used the qualitative technique of phase-line analysis to understand them.
Now that I know how to calculate derivatives and integrals in some detail, I can return to differential equations. With these techniques, I’ll actually try to solve the DEs, instead of using a qualitative approach. In the easiest case, the right side of a DE only involves the independent variable. (This is the opposite of the autonomous equation, where the right side only involved the dependent variable.)
\begin{equation*} \frac{df}{dx} = g(x) \end{equation*}
Since only the independant variable \(x\) appears on the right side, I can simply integrate both sides in \(x\text{.}\)
\begin{equation*} \int \frac{df}{dx} dx = \int g(x) dx \end{equation*}
On the left, the integral of the derivative is the original funciton \(f\text{.}\)
\begin{equation*} f(x) = \int g(x) dx \end{equation*}
In this case, solving the differential equation is just doing an integral. In some sense, solving most differential equations involves undoing the derivative, involves some kind of integral. However, it usually isn’t this straightforward. Usually, it is difficult (if not impossible) to find the right way to undo the derivative.

Subsection 9.2.2 Initial Value Problems

When I integrate to solve a DE, I will get a constant of integration. In order to determine that constant, I am often given an initial condition, such as \(f(0) = 0\text{.}\) Differential equations problems with initial conditions are often called initial value problems (IVPs).

Example 9.2.1.

Here is a differential equation with an initial condition provided. After integrating both sides to solve the differential equation, I replace \(x\) and \(y\) with the values from the initial condition to solve for the constant of integrate. This lets me state a unique solution at the end.
\begin{align*} \frac{df}{dx} \amp = x^3 \amp \amp f(0) = 7\\ \int \frac{df}{dx} dx \amp = \int x^3 dx \amp \amp \\ f \amp = \frac{x^4}{4} + c \amp \amp \\ 7 \amp = \frac{0^4}{4} + c \implies c = 7 \amp \amp \\ f(x) \amp = \frac{x^4}{4} + 7 \amp \amp \end{align*}

Example 9.2.2.

Here is another initial value problem. The process is the same: solve the differential equation by integration, replace \(x\) and \(y\) with their values from the initial value given, and then solve for the constant of integration.
\begin{align*} \frac{df}{dt} \amp = 6 \sin 3t \amp \amp f \left( \frac{\pi}{6} \right) = 6\\ \int \frac{df}{dt} dt \amp = \int 6 \sin 3t dt \amp \amp \\ f(x) \amp = \int 6 \sin 3t dt = -2\cos 3t + c \amp \amp \\ 6 \amp = -2\cos \frac{\pi}{2} + c = 0 + c \implies c=6 \amp \amp \\ f(x) \amp = -2 \cos 3t + 6 \amp \amp \end{align*}

Example 9.2.3.

Here is another initial value problem. The process is the same: solve the differential equation by integration, replace \(x\) and \(y\) with their values from the initial value given, and then solve for the constant of integration.
\begin{align*} \frac{df}{dx} \amp = \frac{1}{x^2+1} \amp \amp f(1) = \pi\\ \int \frac{df}{dx} dx \amp = \int \frac{1}{x^2+1} dx \amp \amp \\ f \amp = \int \frac{1}{x^2+1} dx = \arctan x + c \amp \amp \\ \pi \amp = \arctan(1) + c = \frac{\pi}{4} + c \implies c = \frac{3\pi}{4} \amp \amp \\ f(x) \amp = \arctan x + \frac{3\pi}{4} \amp \amp \end{align*}

Subsection 9.2.3 Separable Differential Equations

Solving DEs is a very difficult task in general; the previous examples were all artificially simple. For this course, I’m going to restrict to a specific type of DE called a separable equation. Let \(f(x)\) and \(g(y)\) be continuous functions in \(x\) and \(y\text{,}\) respectively. Separable differential equations are DEs where the dependent and independent variable can be separated by a product.
\begin{equation*} \frac{dy}{dx} = f(x) g(y) \end{equation*}
In particular, this includes the autonomous equations previously studied; if I set \(f=1\) in the previous expression, the resulting DE is an autonomous equation.
To solve these equations, I divide by \(g(y)\) to move that function to the the left side of the equation. Then I integrate in \(x\text{.}\)
\begin{align*} \frac{1}{g(y)} \frac{dy}{dx} \amp = f(x)\\ \int \frac{1}{g(y)} \frac{dy}{dx} dx \amp = f(x) dx \end{align*}
With a substitution \(y = y(x)\) (so that \(dy = \frac{dy}{dx} dx\)), I can change the left side of the integral into an integral in \(y\text{.}\) (This looks strange, but it’s really deciding to treat \(y\) as a variable, instead of as a function \(y(x)\)).
\begin{equation*} \int \frac{1}{g(y)} dy = \int f(x) dx + c \end{equation*}
I have now separated the problem into two integrals, hence calling this a separable equation. Now I try to integrate both sides. In the integral, I need a constant of integration (which I wrote as \(c\)) but it is sufficient to include it on just one side of the equation. After the integration is complete, I try to solve for \(y\) as a function of \(x\text{.}\) If I can, that function is the solution. Often I can’t, and I leave the result as an implicit expression in \(x\) and \(y\text{.}\)

Example 9.2.4.

Here is a separable initial value problem. First, I want to move all the \(y\) variables to the left. I can do that by simply multiplying by \(y\text{.}\)
\begin{align*} \frac{dy}{dx} \amp = \frac{\sin x}{y} \amp \amp y(0) = 1\\ \frac{dy}{dx} y \amp = \sin x \amp \amp \\ \int y dy \amp = \int \sin x dx \amp \amp \end{align*}
Using the substitution, I write the integral on the left as an integral in \(y\text{.}\) Then I integrate both sides and try to solve for \(y\text{.}\)
\begin{align*} \frac{y^2}{2} \amp = - \cos x + c \\ \frac{1^2}{2} \amp = - \cos 0 + c \implies c = \frac{3}{2} \\ \frac{y^2}{2} \amp = - \cos x + \frac{3}{2} \\ y \amp = \pm \sqrt{ 2 \left( \frac{3}{2} - \cos x \right)} = \pm \sqrt{3 - 2 \cos x} \end{align*}
After the integral and solving for \(y\text{,}\) I replace \(y\) and \(x\) with the values from the initial condition to solve for \(c\text{.}\) Determining the value of the constant, I could write the final solution to the initial value problem.

Example 9.2.5.

Here is another separable initial value problem. I proceed with the separation, moving \(y\) to the left side.
\begin{align*} \frac{dy}{dx} \amp = \frac{-x}{y} \amp \amp y(4) = 3 \\ \int y dy \amp = - \int x dx \amp \amp \end{align*}
Then I integrate both sides and try to solve for \(y\text{.}\) In this case, I could isolate \(y\text{,}\) but to do so would involve a square root and I would have to choose the positive or negative square root. To leave the solution without having to make that choice, I can leave the expression in \(x\) and \(y\) as it is, without isolating one variable. In that form, I can still input the initial values and solve for the constant of integration.
\begin{align*} \frac{y^2}{2} \amp = \frac{-x^2}{2} + c \\ y^2 + x^2 \amp = c \\ 4^2 + 3^2 \amp = c \implies c = 25\\ y^2 + x^2 \amp = 25 \end{align*}
This is the final, implicit form. I can notice that this is an equation of a circle, so the graph of the function must look like part of a circle. (If can’t be the whole circle, of course, since that doesn’t satisfy a vertical line test.) If I want it expressed as a function, I can still solve for \(y\) after this.
\begin{equation*} y = \pm \sqrt{25 - x^2} \end{equation*}

Example 9.2.6.

Here is one more separable initial value problem. I do the same thing and bring the \(y\) variables to the left to make an integral in \(y\text{.}\)
\begin{align*} \frac{dy}{dx} \amp = y^2 + 1 \amp \amp y(0) = 0 \\ \int \frac{1}{y^2+1} dy \amp = \int 1 dx \amp \amp \end{align*}
Then I do both integrals and solve for \(y\text{.}\) After solving, I input the initial values and solve for the constant of integration to get the final solution.
\begin{align*} \arctan y \amp = x + c \\ y \amp = \tan (x + c) \\ 0 \amp = \tan (0 + c) \implies c = 0 \\ y \amp = \tan (x) \end{align*}