Section1.1Integrals as solutions

Note: 1 lecture (or less), §1.2 in [EP], covered in §1.2 and §2.1 in [BD]

A first order ODE is an equation of the form

\begin{equation*} \frac{dy}{dx} = f(x,y) , \end{equation*}

or just

\begin{equation*} y' = f(x,y) . \end{equation*}

In general, there is no simple formula or procedure one can follow to find solutions. In the next few lectures we will look at special cases where solutions are not difficult to obtain. In this section, let us assume that $f$ is a function of $x$ alone, that is, the equation is

$$y' = f(x) .\label{ias_inteq}\tag{1}$$

We could just integrate (antidifferentiate) both sides with respect to $x\text{.}$

\begin{equation*} \int y'(x) \,dx = \int f(x) \,dx + C , \end{equation*}

that is

\begin{equation*} y(x) = \int f(x) \,dx + C . \end{equation*}

This $y(x)$ is actually the general solution. So to solve (1), we find some antiderivative of $f(x)$ and then we add an arbitrary constant to get the general solution.

Now is a good time to discuss a point about calculus notation and terminology. Calculus textbooks muddy the waters by talking about the integral as primarily the so-called indefinite integral. The indefinite integral is really the antiderivative (in fact the whole one-parameter family of antiderivatives). There really exists only one integral and that is the definite integral. The only reason for the indefinite integral notation is that we can always write an antiderivative as a (definite) integral. That is, by the fundamental theorem of calculus we can always write $\int f(x) \,dx + C$ as

\begin{equation*} \int_{x_0}^x f(t) \,dt + C . \end{equation*}

Hence the terminology to integrate when we may really mean to antidifferentiate. Integration is just one way to compute the antiderivative (and it is a way that always works, see the following examples). Integration is defined as the area under the graph, it only happens to also compute antiderivatives. For sake of consistency, we will keep using the indefinite integral notation when we want an antiderivative, and you should always think of the definite integral as a way to write it.

Example1.1.1.

Find the general solution of $y' = 3 x^2\text{.}$

Elementary calculus tells us that the general solution must be $y = x^3 + C\text{.}$ Let us check by differentiating: $y' = 3x^2\text{.}$ We got precisely our equation back.

Normally, we also have an initial condition such as $y(x_0) = y_0$ for some two numbers $x_0$ and $y_0$ ($x_0$ is usually 0, but not always). We can then write the solution as a definite integral in a nice way. Suppose our problem is $y' = f(x)\text{,}$ $y(x_0) = y_0\text{.}$ Then the solution is

$$y(x) = \int_{x_0}^x f(s) \,ds + y_0 .\label{int_eqdef}\tag{2}$$

Let us check! We compute $y' = f(x)\text{,}$ via the fundamental theorem of calculus, and by Jupiter, $y$ is a solution. Is it the one satisfying the initial condition? Well, $y(x_0) = \int_{x_0}^{x_0} f(x)\,dx + y_0 = y_0\text{.}$ It is!

Do note that the definite integral and the indefinite integral (antidifferentiation) are completely different beasts. The definite integral always evaluates to a number. Therefore, (2) is a formula we can plug into the calculator or a computer, and it will be happy to calculate specific values for us. We will easily be able to plot the solution and work with it just like with any other function. It is not so crucial to always find a closed form for the antiderivative.

Example1.1.2.

Solve

\begin{equation*} y' = e^{-x^2}, \qquad y(0) = 1 . \end{equation*}

By the preceding discussion, the solution must be

\begin{equation*} y(x) = \int_0^x e^{-s^2} \,ds + 1 . \end{equation*}

Here is a good way to make fun of your friends taking second semester calculus. Tell them to find the closed form solution. Ha ha ha (bad math joke). It is not possible (in closed form). There is absolutely nothing wrong with writing the solution as a definite integral. This particular integral is in fact very important in statistics.

Using this method, we can also solve equations of the form

\begin{equation*} y' = f(y) . \end{equation*}

Let us write the equation in Leibniz notation.

\begin{equation*} \frac{dy}{dx} = f(y) . \end{equation*}

Now we use the inverse function theorem from calculus to switch the roles of $x$ and $y$ to obtain

\begin{equation*} \frac{dx}{dy} = \frac{1}{f(y)} . \end{equation*}

What we are doing seems like algebra with $dx$ and $dy\text{.}$ It is tempting to just do algebra with $dx$ and $dy$ as if they were numbers. And in this case it does work. Be careful, however, as this sort of hand-waving calculation can lead to trouble, especially when more than one independent variable is involved. At this point we can simply integrate,

\begin{equation*} x(y) = \int \frac{1}{f(y)} \,dy + C . \end{equation*}

Finally, we try to solve for $y\text{.}$

Example1.1.3.

Previously, we guessed $y' = ky$ (for some $k > 0$) has the solution $y=Ce^{kx}\text{.}$ We can now find the solution without guessing. First we note that $y=0$ is a solution. Henceforth, we assume $y\not= 0\text{.}$ We write

\begin{equation*} \frac{dx}{dy} = \frac{1}{ky} . \end{equation*}

We integrate to obtain

\begin{equation*} x(y) = x = \frac{1}{k} \ln \, \lvert y \rvert + D, \end{equation*}

where $D$ is an arbitrary constant. Now we solve for $y$ (actually for $\lvert y \rvert$).

\begin{equation*} \lvert y \rvert = e^{kx-kD} = e^{-kD} e^{k x} . \end{equation*}

If we replace $e^{-kD}$ with an arbitrary constant $C\text{,}$ we can get rid of the absolute value bars (which we can do as $D$ was arbitrary). In this way, we also incorporate the solution $y=0\text{.}$ We get the same general solution as we guessed before, $y = Ce^{kx}\text{.}$

Example1.1.4.

Find the general solution of $y' = y^2\text{.}$

First we note that $y=0$ is a solution. We can now assume that $y \not= 0\text{.}$ Write

\begin{equation*} \frac{dx}{dy} = \frac{1}{y^2} . \end{equation*}

We integrate to get

\begin{equation*} x = \frac{-1}{y} + C . \end{equation*}

We solve for $y = \frac{1}{C-x}\text{.}$ So the general solution is

Note the singularities of the solution. If for example $C=1\text{,}$ then the solution “blows up” as we approach $x=1\text{.}$ See Figure 2.1.5. Generally, it is hard to tell from just looking at the equation itself how the solution is going to behave. The equation $y' = y^2$ is very nice and defined everywhere, but the solution is only defined on some interval $(-\infty, C)$ or $(C, \infty)\text{.}$ Usually when this happens we only consider one of these the solution. For example if we impose a condition $y(0) = 1\text{,}$ then the solution is $y=\frac{1}{1-x}\text{,}$ and we would consider this solution only for $x$ on the interval $(-\infty,1)\text{.}$ In the figure, it is the left side of the graph.

Classical problems leading to differential equations solvable by integration are problems dealing with velocity, acceleration and distance. You have surely seen these problems before in your calculus class.

Example1.1.5.

Suppose a car drives at a speed $e^{t/2}$ meters per second, where $t$ is time in seconds. How far did the car get in 2 seconds (starting at $t=0$)? How far in 10 seconds?

Let $x$ denote the distance the car traveled. The equation is

\begin{equation*} x' = e^{t/2} . \end{equation*}

We just integrate this equation to get that

\begin{equation*} x(t) = 2 e^{t/2} + C . \end{equation*}

We still need to figure out $C\text{.}$ We know that when $t=0\text{,}$ then $x=0\text{.}$ That is, $x(0) = 0\text{.}$ So

\begin{equation*} 0 = x(0) = 2e^{0/2} + C = 2 + C . \end{equation*}

Thus $C = -2$ and

\begin{equation*} x(t) = 2 e^{t/2} - 2 . \end{equation*}

Now we just plug in to get where the car is at 2 and at 10 seconds. We obtain

\begin{equation*} x(2) = 2e^{2/2} - 2 \approx 3.44 \text{ meters} , \qquad x(10) = 2e^{10/2} - 2 \approx 294 \text{ meters} . \end{equation*}
Example1.1.6.

Suppose that the car accelerates at a rate of $\unitfrac[t^2]{m}{s^2}\text{.}$ At time $t=0$ the car is at the 1 meter mark and is traveling at 10 $\nicefrac{\text{m}}{\text{s}}\text{.}$ Where is the car at time $t=10\text{.}$

Well this is actually a second order problem. If $x$ is the distance traveled, then $x'$ is the velocity, and $x''$ is the acceleration. The equation with initial conditions is

\begin{equation*} x'' = t^2 , \qquad x(0) = 1 , \qquad x'(0) = 10 . \end{equation*}

What if we say $x' = v\text{.}$ Then we have the problem

\begin{equation*} v' = t^2, \qquad v(0) = 10 . \end{equation*}

Once we solve for $v\text{,}$ we can integrate and find $x\text{.}$

Subsection1.1.1Exercises

Exercise1.1.2.

Solve $\frac{dy}{dx} = x^2+x$ for $y(1)=3\text{.}$

Exercise1.1.3.

Solve $\frac{dy}{dx} = \sin (5x)$ for $y(0)=2\text{.}$

Exercise1.1.4.

Solve $\frac{dy}{dx} = \frac{1}{x^2-1}$ for $y(0)=0\text{.}$

Exercise1.1.5.

Solve $y' = y^3$ for $y(0)=1\text{.}$

Exercise1.1.6.

(little harder)   Solve $y' = (y-1)(y+1)$ for $y(0)=3\text{.}$

Exercise1.1.7.

Solve $\frac{dy}{dx} = \frac{1}{y+1}$ for $y(0)=0\text{.}$

Exercise1.1.8.

(harder)   Solve $y'' = \sin x$ for $y(0)=0\text{,}$ $y'(0) = 2\text{.}$

Exercise1.1.9.

A spaceship is traveling at the speed $2t^2+1$ $\nicefrac{\text{km}}{\text{s}}$ ($t$ is time in seconds). It is pointing directly away from earth and at time $t=0$ it is 1000 kilometers from earth. How far from earth is it at one minute from time $t=0\text{?}$

Exercise1.1.10.

Solve $\frac{dx}{dt} = \sin(t^2)+t\text{,}$ $x(0)=20\text{.}$ It is OK to leave your answer as a definite integral.

Exercise1.1.11.

A dropped ball accelerates downwards at a constant rate $9.8$ meters per second squared. Set up the differential equation for the height above ground $h$ in meters. Then supposing $h(0) = 100$ meters, how long does it take for the ball to hit the ground.

Exercise1.1.12.

Find the general solution of $y' = e^x\text{,}$ and then $y' = e^y\text{.}$

Exercise1.1.101.

Solve $\frac{dy}{dx} = e^x + x$ and $y(0) = 10\text{.}$

$y = e^x + \frac{x^2}{2} + 9$

Exercise1.1.102.

Solve $x' = \frac{1}{x^2}\text{,}$ $x(1)=1\text{.}$

$x = {(3t-2)}^{1/3}$

Exercise1.1.103.

Solve $x' = \frac{1}{\cos(x)}\text{,}$ $x(0)=\frac{\pi}{2}\text{.}$

$x = \sin^{-1} \bigl(t+1\bigr)$

Exercise1.1.104.

Sid is in a car traveling at speed $10t+70$ miles per hour away from Las Vegas, where $t$ is in hours. At $t=0\text{,}$ Sid is 10 miles away from Vegas. How far from Vegas is Sid 2 hours later?

170

Exercise1.1.105.

Solve $y' = y^n\text{,}$ $y(0) = 1\text{,}$ where $n$ is a positive integer. Hint: You have to consider different cases.

If $n \not= 1\text{,}$ then $y={\bigl((1-n)x+1\bigr)}^{1/(1-n)}\text{.}$ If $n=1\text{,}$ then $y = e^x\text{.}$

Exercise1.1.106.

The rate of change of the volume of a snowball that is melting is proportional to the surface area of the snowball. Suppose the snowball is perfectly spherical. Then the volume (in centimeters cubed) of a ball of radius $r$ centimeters is $\nicefrac{4}{3}\,\pi r^3\text{.}$ The surface area is $4 \pi r^2\text{.}$ Set up the differential equation for how $r$ is changing. Then, suppose that at time $t=0$ minutes, the radius is 10 centimeters. After 5 minutes, the radius is 8 centimeters. At what time $t$ will the snowball be completely melted.

The equation is $r' = -C$ for some constant $C\text{.}$ The snowball will be completely melted in 25 minutes from time $t=0\text{.}$
Find the general solution to $y''''= 0\text{.}$ How many distinct constants do you need?
$y = Ax^3 + Bx^2 + Cx + D\text{,}$ so 4 constants.