# 1.E: First order ODEs (Exercises)

\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

These are homework exercises to accompany Libl's "Differential Equations for Engineering" Textmap. This is a textbook targeted for a one semester first course on differential equations, aimed at engineering students. Prerequisite for the course is the basic calculus sequence.

## 1.1: Integrals as solutions

**Exercise 1.1.1: **Solve for \(v\), and then solve for \(x\). Find \(x(10)\) to answer the question.

**Exercise 1.1.2:** Solve \(\dfrac{dy}{dx} = x^2 + x\) for \(y(1) = 3\).

**Exercise 1.1.3:** Solve \(\dfrac{dy}{dx} = \sin (5x)\) for \(y(0) = 2\).

**Exercise 1.1.4:** Solve \(\dfrac{dy}{dx} = \dfrac {1}{x^2 - 1}\) for \(y(0) = 0\).

**Exercise 1.1.5:** Solve \(y' = y^3\) for \(y(0) = 1\).

**Exercise 1.1.6 **(little harder)**:** Solve \(y' = \left({y-1}\right) \left({y + 1} \right)\) for \(y(0) = 3\).

**Exercise 1.1.7:** Solve \(\dfrac{dy}{dx} = \dfrac{1}{y+1}\) for \(y(0) = 0\).

**Exercise 1.1.8 **(harder)**:** Solve \(y'' = \sin x\) for \(y(0) =0\), \(y'(0) = 2\).

**Exercise 1.1.9:** A spaceship is traveling at the speed \(2t^2 + 1\) ^{km}/_{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\)?

**Exercise 1.1.10:** Solve \(\dfrac{dx}{dt} = \sin (t^2) + t\), \(x(0) = 20\). It is OK to leave your answer as a definite integral.

**Exercise 1.1.101:** Solve \(\dfrac{dy}{dx} = e^x + x\) and \(y(0) = 10\).

**Exercise 1.1.102:** Solve \(x' = \dfrac{1}{x^2}\), \(x(1) = 1\).

**Exercise 1.1.103:** Solve \(x' = \dfrac{1}{\cos (x)}\), \(x(0) = \dfrac{\pi}{2}\).

**Exercise 1.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\)the Sid is 10 miles away from Vegas. How far from Vegas is Sid 2 hours later?

**Exercise 1.1.105:** Solve \(y' = y''\), \(y(0) = 1\), where \(n\) is a positive integer. Hint: You have to consider different cases.

## 1.2: Slope fields

**Exercise 1.2.1:** Sketch slope field for \(y' = e^{x-y}\). How do the solutions behave as \(x\) grows? Can you guess a particular solution by looking at the slope field?

**Exercise 1.2.2:** Sketch slope field for \(y' = x^2\).

**Exercise 1.2.3:** Sketch slope field for \(y' = y^2\).

**Exercise 1.2.4:** Is it possible to solve the equation \(y' = \frac {xy}{\cos {x}} \) for \(y (0) = 1\)? Justify.

**Exercise 1.2.5:** Is it possible to solve the equation \( y' = y \sqrt {\left \vert x \right \vert}\) for \( y(0) = 0 \)? Is the solution unique? Justify.

**Exercise 1.2.6:** Match equations \(y' = 1 - x\), \(y' = x - 2y\), \( y' = x(1 - y) \) to slope fields. Justify.

a) b) c)

**Exercise 1.2.7** (challenging)**:** Take \(y' = f(x, y)\), \( y(0) = 0\), where \( f(x, y) > 1 \) for all \(x\) and \(y\). If the solution exists for all \(x\), can you say what happens to \(y(x)\) as \(x\) goes to positive infinity? Explain.

**Exercise 1.2.8** (challenging)**:** Take \( (y - x)y' = 0\), \( x(0) = 0 \). a) Find two distinct solutions. b) Explain why this does not violate Picard’s theorem.

**Exercise 1.2.101:** Sketch the slope field of \( y' = y^3 \). Can you visually find the solution that satisfies \( y(0) = 0\)?

**Exercise 1.2.102:** Is it possible to solve \( y' = xy \) for \( y(0) = 0 \)? Is the solution unique?

**Exercise 1.2.103:** Is it possible to solve \( y' = \frac {x}{x^2 - 1}\) for \( y(1) = 0 \)?

**Exercise 1.2.104:** Match equations \( y' = \sin x\), \(y' = \cos y\), \(y' = y \cos (x)\) to slope fields. Justify.

a) b) c)

## 1.3: Separable Equations

**Exercise 1.3.1:** Solve \(y' = \frac {x}{y}\).

**Exercise 1.3.2:** Solve \(y' = x^2y\).

**Exercise 1.3.3:** Solve \( \frac{dx}{dt} = \left ( x^2 -1 \right ) \), for \( x(0) = 0\).

**Exercise 1.3.4:** Solve \( \frac{dx}{dt} = x \sin (t)\), for \(x(0) = 1\).

**Exercise 1.3.5:** Solve \( \frac {dy}{dx} = xy + x + y + 1 \). Hint: Factor the right hand side.

**Exercise 1.3.6:** Solve \( xy' = y + 2x^2y\), where \(y(1) = 1\).

**Exercise 1.3.7:** Solve \( \frac {dy}{dx} = \frac {y^2 + 1}{x^2 + 1} \), for \(y (0) = 1\).

**Exercise 1.3.8:** Find an implicit solution for \( \frac {dy}{dx} = \frac {x^2 + 1}{y^2 + 1} \), for \(y (0) = 1\).

**Exercise 1.3.9:** Find an explicit solution for \( y' = xe^{-y}\), \(y(0) = 1\).

**Exercise 1.3.10:** Find an explicit solution for \( xy' = e^{-y}\), for \(y(1) = 1\).

**Exercise 1.3.11:** Find an explicit solution for \( y' = ye^{-x^2}\), \(y(0) = 1\). It is alright to leave a definite integral in your answer.

**Exercise 1.3.12:** Suppose a cup of coffee is at 100 degrees Celsius at time \(t =0\), it is at 70 degrees at \(t = 10\) minutes, and it is at 50 degrees at \(t = 20\) minutes. Compute the ambient temperature.

**Exercise 1.3.101:** Solve \( y' = 2xy\).

**Exercise 1.3.102:** Solve \( x' = 3xt^2 - 3t^2\), \( x(0) = 2 \).

**Exercise 1.3.103:** Find an implicit solution for \(x' = \frac {1}{3x^2 + 1}\) \( x(0) = 1\).

**Exercise 1.3.104:** Find an explicit solution to \( xy' = y^2\), \(y(1) = 1\).

**Exercise 1.3.105:** Find an implicit solution to \(y' = \frac {\sin (x)}{ \cos (y)}\).

**Exercise 1.3.106:** Take **Exercise 1.3.3 **with the same numbers: 89 degrees at \( t =0\), 85 degrees at \(t =1\), and ambient temperature of 22 degrees. Suppose these temperatures were measured with precision of \( \pm 0.5\) degrees. Given this imprecision, the time it takes the coffee to cool to (exactly) 60 degrees is also only known in a certain range. Find this range. Hint: Think about what kind of error makes the cooling time longer and what shorter.

## 1.4: Linear equations and the integrating factor

In the exercises, feel free to leave answer as a definite integral if a closed form solution cannot be found. If you can find a closed form solution, you should give that.

**Exercise 1.4.4:** Solve \( y' + xy = x\).

**Exercise 1.4.5:** Solve \( y' + 6y = e^x\).

**Exercise 1.4.6:** Solve \(y' +3x^2y = \sin(x)\,e^{-x^3}\) with \( y(0)=1\).

**Exercise 1.4.7:** Solve \(y' + \cos(x)\,y =\cos(x) \).

**Exercise 1.4.8:** Solve \( \frac{1}{x^2+1}y'+xy = 3\) with \( y(0)=0\).

**Exercise 1.4.9:** Suppose there are two lakes located on a stream. Clean water flows into the first lake, then the water from the first lake flows into the second lake, and then water from the second lake flows further downstream. The in and out flow from each lake is 500 liters per hour. The first lake contains 100 thousand liters of water and the second lake contains 200 thousand liters of water. A truck with 500 kg of toxic substance crashes into the first lake. Assume that the water is being continually mixed perfectly by the stream.

- a) Find the concentration of toxic substance as a function of time in both lakes.
- b) When will the concentration in the first lake be below 0.001 kg per liter?
- c) When will the concentration in the second lake be maximal?

**Exercise 1.4.10:** Newton’s law of cooling states that \(\frac{dx}{dt} = -k(x-A)\) where \(x\) is the temperature, \(t\) is time, \(A\) is the ambient temperature, and \(k>0\) is a constant. Suppose that \(A=A_0 \cos(\omega t)\) for some constants \(A_0\) and \(\omega\). That is, the ambient temperature oscillates (for example night and day temperatures). a) Find the general solution. b) In the long term, will the initial conditions make much of a difference? Why or why not?

**Exercise 1.4.11:** Initially 5 grams of salt are dissolved in 20 liters of water. Brine with concentration of salt 2 grams of salt per liter is added at a rate of 3 liters a minute. The tank is mixed well and is drained at 3 liters a minute. How long does the process have to continue until there are 20 grams of salt in the tank?

**Exercise 1.4.12:** Initially a tank contains 10 liters of pure water. Brine of unknown (but constant) concentration of salt is flowing in at 1 liter per minute. The water is mixed well and drained at 1 liter per minute. In 20 minutes there are 15 grams of salt in the tank. What is the concentration of salt in the incoming brine?

**Exercise 1.4.101:** Solve \(y' + 3x^2y + x^2\).

**Exercise 1.4.102:** Solve \(y' + 2\sin(2x)y=2\sin(2x)\) with \(y(\pi/2)=3\).

**Exercise 1.4.103:** Suppose a water tank is being pumped out at 3 ^{L}/_{min}. The water tank starts at 10 L of clean water. Water with toxic substance is flowing into the tank at 2 ^{L}/_{min}, with concentration \(20t\)^{g}/_{L} at time \(t\). When the tank is half empty, how many grams of toxic substance are in the tank (assuming perfect mixing)?

**Exercise 1.4.104:** Suppose we have bacteria on a plate and suppose that we are slowly adding a toxic substance such that the rate of growth is slowing down. That is, suppose that \(\frac{dP}{dt}=(2-0.1\, t)P\). If \(P(0)=1000\) , find the population at \(t=5\).

## 1.5: Substitution

Hint: Answers need not always be in closed form.

**Exercise 1.5.1:** Solve \( y' + y(x^2 - 1) + xy^6 = 0 \), with \( y(1) = 1\).

**Exercise 1.5.2:** Solve \( 2yy' + 1 = y^2 + x \), with \( y(0) = 1 \).

**Exercise 1.5.3:** Solve \( y' + xy = y^4 \), with \( y(0) = 1 \).

**Exercise 1.5.4:** Solve \( yy' + x = \sqrt {x^2 + y^2} \).

**Exercise 1.5.5:** Solve \( y' = {(x +y -1)}^2 \).

**Exercise 1.5.6:** Solve \( y' = \dfrac {x^2 - y^2}{xy} \), with \( y(1) = 2 \).

**Exercise 1.5.101:** Solve \(xy' + y + y^2 = 0\), \(y(1) = 2\).

**Exercise 1.5.102:** Solve \( xy' + y + x = 0 \), \(y(1) = 1\).

**Exercise 1.5.103:** Solve \( y^2y' = y^3 - 3x\), \(y(0) = 2\).

**Exercise 1.5.104:** Solve \( 2yy' = e^{y^2 - x^2} + 2x \).

^{2}There are several things called Bernoulli equations, this is just one of them. The Bernoullis were a prominent Swiss family of mathematicians. These particular equations are named for Jacob Bernoulli (1654 – 1705).

## 1.6: Autonomous equations

**Exercise 1.6.3**: Let \(x' = x^2\). a) Draw the phase diagram, find the critical points and mark them stable or unstable. b) Sketch typical solutions of the equation. c) Find \(\lim \limits_{t\to\infty} x(t)\) for the solution with the initial condition \(x(0) = -1\).

**Exercise 1.6.4**: Let \(x' = \sin x\). a) Draw the phase diagram for \(-4\pi \leq x \leq 4\pi \). On this interval mark the critical points stable or unstable. b) Sketch typical solutions of the equation. c) Find \(\lim \limits_{t\to\infty} x(t)\) for the solution with the initial condition \(x(0) = 1\).

**Exercise 1.6.5: **Suppose \(f(x)\) is positive for \(0 < x < 1\), it is zero when \(x=0\) and \(x=1\), and it is negative for all other \(x\). a) Draw the phase diagram for \(x' = f(x)\), find the critical points and mark them stable or unstable. b) Sketch typical solutions of the equation. c) Find \(\lim \limits_{t\to\infty} x(t)\) for the solution with the initial condition \(x(0) = 0.5\).

**Exercise 1.6.6**: Start with the logistic equation \(\frac{dx}{dt} = kx (M -x)\). Suppose that we modify our harvesting. That is we will only harvest an amount proportional to current population. In other words we harvest \(hx\) per unit of time for some \(h > 0\) (Similar to earlier example with \(h\) replaced with \(hx\)). a) Construct the differential equation. b) Show that if \(kM > h\), then the equation is still logistic. c) What happens when \(kM < h\)?

**Exercise 1.6.101**: Let \(x' = (x-1)(x-2)x^2\). a) Sketch the phase diagram and find critical points. b) Classify the critical points. c) If \(x(0) = 0.5\) then find \(\lim \limits_{t\to\infty} x(t)\).

**Exercise 1.6.102: **Let \(x' = e^{-x}\). a) Find and classify all critical points. b) Find \(\lim \limits_{t\to\infty} x(t)\) given any initial condition.

**Exercise 1.6.103**: Assume that a population of fish in a lake satisfies\(\frac{dx}{dt} = kx (M -x)\). Now suppose that fish are continually added at \(A\) fish per unit of time. a) Find the differential equation for \(x\). b) What is the new limiting population?[1]

^{3}The unstable points that have one of the arrows pointing towards the critical point are sometimes called semistable.

## 1.7: Numerical methods: Euler’s method

**Exercise 1.7.3**: Consider \(\frac{dx}{dt} = (2t - x)^2\), \(x(0) = 2\). Use Euler’s method with step size \(h = 0.5\) to approximate \(x(1)\).

**Exercise 1.7.4**: Consider \(\frac{dx}{dt} = t -x \), \(x(0) = 1\). a) Use Euler’s method with step sizes \(h = 1, \frac{1}{2}, \frac{1}{4}, \frac{1}{8}\) to approximate \(x(1)\). b) Solve the equation exactly. c) Describe what happens to the errors for each \(h\) you used. That is, find the factor by which the error changed each time you halved the interval.

**Exercise 1.7.5**: Approximate the value of \(e\) by looking at the initial value problem \(y' = y\) with \(y(0) = 1\) and approximating \(y(1)\) using Euler’s method with a step size of \(0.2\).

**Exercise 1.7.6**: Example of numerical instability: Take \(y' = -5y\), \(y(0) = 1\). We know that the solution should decay to zero as \(x\) grows. Using Euler’s method, start with \(h =1\) and compute \(y_1, y_2, y_3, y_4\) to try to approximate \(y(4)\). What happened? Now halve the interval. Keep halving the interval and approximating \(y(4)\) until the numbers you are getting start to stabilize (that is, until they start going towards zero). Note: You might want to use a calculator.

The simplest method used in practice is the Runge-Kutta method. Consider \(\frac{dy}{dx} = f(x, y)\), \(y(x_0) = y_0\) and a step size \(h\). Everything is the same as in Euler’s method, except the computation of \(y_{i+1}\) and \(x_{i+1}\).

\[k_1 = f(x_i, y_i),\]

\[k_2 = f(x_i + \frac{h}{2}, y_i +k_1 \frac{h}{2}) ~~~~~~~~ x_{i+1} = x_i + h,\]

\[k_3 = f(x_i + \frac{h}{2}, y_i +k_2 \frac{h}{2}) ~~~~~~~~ y_{i+1} = y_i + \dfrac{k_1 + 2k_2 + 2k_3 + k_4}{6}h,\]

\[k_4 = f(x_i + h, y_i +k_3h).\]

**Exercise 1.7.7**: Consider \(\frac{dy}{dx} = yx^2\), \(y(0) = 1\). a) Use Runge-Kutta (see above) with step sizes \(h = 1\) and \(h = \frac{1}{2}\) to approximate \(y(1)\). b) Use Euler’s method with \(h = 1\) and \(h = \frac{1}{2}\). c) Solve exactly, find the exact value of \(y(1)\), and compare.

**Exercise 1.7.101**: Let \(x' = \sin (xt)\), and \(x(0) = 1\). Approximate \(x(1)\) using Euler’s method with step sizes 1, 0.5, 0.25. Use a calculator and compute up to 4 decimal digits.

**Exercise 1.7.102**: Let \(x' = 2t\), and \(x(0) = 0\). a) Approximate \(x(4)\) using Euler’s method with step sizes 4, 2, and 1. b) Solve exactly, and compute the errors. c) Compute the factor by which the errors changed.

**Exercise 1.7.103**: Let \(x' = xe^{xt+1}\), and \(x(0) = 0\). a) Approximate \(x(4)\) using Euler’s method with step sizes 4, 2, and 1. b) Guess an exact solution based on part a) and compute the errors.

^{4}Named after the Swiss mathematician Leonhard Paul Euler (1707 – 1783). Do note the correct pronunciation of the name sounds more like “oiler.”