# 1.E: First order ODEs (Exercises)

- Last updated

- Save as PDF

- Page ID
- 32177

- Jiří Lebl
- Associate Professor (Mathematics) at Oklahoma State University

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 \(\PageIndex{1.1.1}\)

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

Exercise \(\PageIndex{1.1.2}\)

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

Exercise \(\PageIndex{1.1.3}\)

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

Exercise \(\PageIndex{1.1.4}\)

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

Exercise \(\PageIndex{1.1.5}\)

Solve \(y' = y^3\) for \(y(0) = 1\).

Exercise \(\PageIndex{1.1.6}\): (little harder)

Solve \(y' = \left({y-1}\right) \left({y + 1} \right)\) for \(y(0) = 3\).

Exercise \(\PageIndex{1.1.7}\)

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

Exercise \(\PageIndex{1.1.8}\): (harder)

Solve \(y'' = \sin x\) for \(y(0) =0\), \(y'(0) = 2\).

Exercise \(\PageIndex{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 \(\PageIndex{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 \(\PageIndex{1.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\text{ meters}\), how long does it take for the ball to hit the ground.

Exercise \(\PageIndex{1.1.12}\)

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

Exercise \(\PageIndex{1.1.13}\)

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

**Answer**-
\(y=e^{x}+\frac{x^{2}}{2}+9\)

Exercise \(\PageIndex{1.1.14}\)

Solve \(x' = \dfrac{1}{x^2}\), \(x(1) = 1\).

**Answer**-
\(x=(3t-2)^{1/3}\)

Exercise \(\PageIndex{1.1.15}\)

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

**Answer**-
A\(x=\sin ^{-1}(t+1)\)

Exercise \(\PageIndex{1.1.16}\)

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?

**Answer**-
\(170\)

Exercise \(\PageIndex{1.1.17}\)

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

**Answer**-
If \(n\neq 1\), then \(y=((1-n)x+1)^{1/(1-n)}\). If \(n=1\), then \(y=e^{x}\).

Exercise \(\PageIndex{1.1.18}\)

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. The volume (in centimeters cubed) of a ball of radius \(r\) centimeters is \(\frac{4}{3})\pi r^{3}\). The surface area is \(4\pi r^{2}\). Set up the differential equation for how the radius \(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?

**Answer**-
The equation is \(r'=-C\) for some constant \(C\). The snowball will be completely melted in \(25\) minutes from time \(t=0\).

Exercise \(\PageIndex{1.1.19}\)

Find the general solution to \(y''''=0\). How many distinct constants do you need?

**Answer**-
\(y=Ax^{3}+Bx^{2}+Cx+D\), so \(4\) constants.

## 1.2: Slope fields

Exercise \(\PageIndex{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 \(\PageIndex{1.2.2}\)

Sketch slope field for \(y' = x^2\).

Exercise \(\PageIndex{1.2.3}\)

Sketch slope field for \(y' = y^2\).

Exercise \(\PageIndex{1.2.4}\)

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

Exercise \(\PageIndex{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 \(\PageIndex{1.2.6}\)

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

Exercise \(\PageIndex{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 \(\PageIndex{1.2.8}\): (challenging)

Take \( (y - x)y' = 0\), \( x(0) = 0 \).

- Find two distinct solutions.
- Explain why this does not violate Picard’s theorem.

Exercise \(\PageIndex{1.2.9}\)

Suppose \(y'=f(x,y)\). What will the slope field look like, explain and sketch an example, if you know the following about \(f(x,y)\):

- \(f\) does not depend on \(y\).
- \(f\) does not depend on \(x\).
- \(f,(t,t)=0\) for any number \(t\).
- \(f(x,0)=0\) and \(f(x,1)=1\) for all \(x\).

Exercise \(\PageIndex{1.2.10}\)

Find a solution to \(y'=|y|\), \(y(0)=0\). Does Picard’s theorem apply?

Exercise \(\PageIndex{1.2.11}\)

Take an equation \(y'=(y-2x)g(x,y)+2\) for some function \(g(x,y)\). Can you solve the problem for the initial condition \(y(0)=0\), and if so what is the solution?

Exercise \(\PageIndex{1.2.12}\): (challenging)

Suppose \(y'=f(x,y)\) is such that \(f(x,1)=0\) for every \(x,f\) is continuous and \(\frac{\partial f}{\partial y}\) exists and is continuous for every \(x\) and \(y\).

- Guess a solution given the initial condition \(y(0)=1\).
- Can graphs of two solutions of the equation for different initial conditions ever intersect?
- Given \(y(0)=0\), what can you say about the solution. In particular, can \(y(x)>1\) for any \(x\)? Can \(y(x)=1\) for any \(x\)? Why or why not?

Exercise \(\PageIndex{1.2.13}\)

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

**Answer**-
\(y=0\) is a solution such that \(y(0)=0\)

Exercise \(\PageIndex{1.2.14}\)

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

**Answer**-
Yes a solution exists. The equation is \(y'=f(x,y)\) where \(f(x,y)=xy\). The function \(f(x,y)\) is continuous and \(\frac{\partial f}{\partial y}=x\), which is also continuous near \((0, 0)\). So a solution exists and is unique. (In fact, \(y=0\) is the solution.)

Exercise \(\PageIndex{1.2.15}\)

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

**Answer**-
No, the equation is not defined at \((x,y) = (1, 0)\).

Exercise \(\PageIndex{1.2.16}\)

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

**Answer**-
- \(y'=\cos y\)
- \(y'=y\cos (x)\)
- \(y'=\sin x\)

Justification left to reader.

Exercise \(\PageIndex{1.2.17}\): (tricky)

Suppose

\[f(y)=\left\{\begin{array}{cc}{0}&{if\: y>0,} \\ {1}&{if\: y\leq 0.}\end{array}\right.\nonumber\]

Does \(y'=f(y)\), \(y(0)=0\) have a continuously differentiable solution? Does Picard apply? Why, or why not?

**Answer**-
Picard does not apply as \(f\) is not continuous at \(y=0\). The equation does not have a continuously differentiable solution. Suppose it did. Notice that \(y'(0)=1\). By the first derivative test, \(y(x)>0\) for small positive \(x\). But then for those \(x\) we would have \(y'(x)=0\), so clearly the derivative cannot be continuous.

Exercise \(\PageIndex{1.2.18}\)

Consider an equation of the form \(y'=f(x)\) for some continuous function \(f\), and an initial condition \(y(x_{0})=y_{0}\). Does a solution exist for all \(x\)? Why or why not?

**Answer**-
The solution is \(y(x)=\int_{x_{0}}^{x}f(s)ds+y_{0}\), and this does indeed exist for every \(x\).

## 1.3: Separable Equations

Exercise \(\PageIndex{1.3.1}\)

Solve \(y' = \frac {x}{y}\).

Exercise \(\PageIndex{1.3.2}\)

Solve \(y' = x^2y\).

Exercise \(\PageIndex{1.3.3}\)

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

Exercise \(\PageIndex{1.3.4}\)

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

Exercise \(\PageIndex{1.3.5}\)

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

Exercise \(\PageIndex{1.3.6}\)

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

Exercise \(\PageIndex{1.3.7}\)

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

Exercise \(\PageIndex{1.3.8}\)

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

Exercise \(\PageIndex{1.3.9}\)

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

Exercise \(\PageIndex{1.3.10}\)

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

Exercise \(\PageIndex{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 \(\PageIndex{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 \(\PageIndex{1.3.13}\)

Solve \( y' = 2xy\).

**Answer**-
\(y=Ce^{x^{2}}\)

Exercise \(\PageIndex{1.3.14}\)

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

**Answer**-
\(y=e^{t^{3}}+1\)

Exercise \(\PageIndex{1.3.15}\)

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

**Answer**-
\(x^{3}+x=t+2\)

Exercise \(\PageIndex{1.3.16}\)

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

**Answer**-
\(y=\frac{1}{1-\ln x}\)

Exercise \(\PageIndex{1.3.17}\)

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

**Answer**-
\(\sin (y)=-\cos (x)+C\)

Exercise \(\PageIndex{1.3.18}\)

Take Example 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.

**Answer**-
The range is approximately \(7.45\) to \(12.15\) minutes.

Exercise \(\PageIndex{1.3.19}\)

A population \(x\) of rabbits on an island is modeled by \(x'=x-(\frac{1}{1000})x^{2}\), where the independent variable is time in months. At time \(t=0\), there are \(40\) rabbits on the island.

- Find the solution to the equation with the initial condition.
- How many rabbits are on the island in \(1\) month, \(5\) months, \(10\) months, \(15\) months (round to the nearest integer)

**Answer**-
- \(x=\frac{1000e^{t}}{e^{t}+24}\).
- \(102\) rabbits after one month, \(861\) after \(5\) months, \(999\) after \(10\) months, \(1000\) after \(15\) months.

## 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 \(\PageIndex{1.4.1}\)

Solve \( y' + xy = x\).

Exercise \(\PageIndex{1.4.2}\)

Solve \( y' + 6y = e^x\).

Exercise \(\PageIndex{1.4.3}\)

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

Exercise \(\PageIndex{1.4.4}\)

Solve \(y' + \cos(x)\,y =\cos(x) \).

Exercise \(\PageIndex{1.4.5}\)

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

Exercise \(\PageIndex{1.4.6}\)

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.

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

Exercise \(\PageIndex{1.4.7}\)

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).

- Find the general solution.
- In the long term, will the initial conditions make much of a difference? Why or why not?

Exercise \(\PageIndex{1.4.8}\)

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 \(\PageIndex{1.4.9}\)

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 \(\PageIndex{1.4.10}\)

Solve \(y' + 3x^2y + x^2\).

**Answer**-
\(y=Ce^{-x^{3}}+\frac{1}{3}\)

Exercise \(\PageIndex{1.4.11}\)

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

**Answer**-
\(y=2e^{\cos (2x)+1}+1\)

Exercise \(\PageIndex{1.4.12}\)

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

**Answer**-
\(250\) grams

Exercise \(\PageIndex{1.4.13}\)

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\).

**Answer**-
\(P(5)=1000e^{2\times 5-0.05\times 5^{2}}=1000e^{8.75}\approx 6.31\times 10^{6}\)

Exercise \(\PageIndex{1.4.14}\)

A cylindrical water tank has water flowing in at \(I\) cubic meters per second. Let \(A\) be the area of the cross section of the tank in meters. Suppose water is flowing from the bottom of the tank at a rate proportional to the height of the water level. Set up the differential equation for \(h\), the height of the water, introducing and naming constants that you need. You should also give the units for your constants.

**Answer**-
\(Ah'=I-kh\), where \(k\) is a constant with units \(\frac{\text{m}^{2}}{\text{s}}\).

## 1.5: Substitution

Hint: Answers need not always be in closed form.

Exercise \(\PageIndex{1.5.1}\)

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

Exercise \(\PageIndex{1.5.2}\)

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

Exercise \(\PageIndex{1.5.3}\)

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

Exercise \(\PageIndex{1.5.4}\)

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

Exercise \(\PageIndex{1.5.5}\)

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

Exercise \(\PageIndex{1.5.6}\)

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

Exercise \(\PageIndex{1.5.7}\)

Solve \(xy' + y + y^2 = 0\), \(y(1) = 2\).

**Answer**-
\(y=\frac{2}{3x-2}\)

Exercise \(\PageIndex{1.5.8}\)

Solve \( xy' + y + x = 0 \), \(y(1) = 1\).

**Answer**-
\(y=\frac{3-x^{2}}{2x}\)

Exercise \(\PageIndex{1.5.9}\)

Solve \( y^2y' = y^3 - 3x\), \(y(0) = 2\).

**Answer**-
\(y=\left(7e^{3x}+3x+1\right)^{1/3}\)

Exercise \(\PageIndex{1.5.10}\)

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

**Answer**-
\(y=\sqrt{x^{2}-\ln (C-x)}\)

## 1.6: Autonomous equations

Exercise \(\PageIndex{1.6.1}\)

Consider \(x' = x^2\).

- Draw the phase diagram, find the critical points and mark them stable or unstable.
- Sketch typical solutions of the equation.
- Find \(\lim \limits_{t\to\infty} x(t)\) for the solution with the initial condition \(x(0) = -1\).

Exercise \(\PageIndex{1.6.2}\)

Let \(x' = \sin x\).

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

Exercise \(\PageIndex{1.6.3}\)

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\).

- Draw the phase diagram for \(x' = f(x)\), find the critical points and mark them stable or unstable.
- Sketch typical solutions of the equation.
- Find \(\lim \limits_{t\to\infty} x(t)\) for the solution with the initial condition \(x(0) = 0.5\).

Exercise \(\PageIndex{1.6.4}\)

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\)).

- Construct the differential equation.
- Show that if \(kM > h\), then the equation is still logistic.
- What happens when \(kM < h\)?

Exercise \(\PageIndex{1.6.5}\)

A disease is spreading through the country. Let \(x\) be the number of people infected. Let the constant \(S\) be the number of people susceptible to infection. The infection rate \(\frac{dx}{dt}\) is proportional to the product of already infected people, \(x\), and the number of susceptible but uninfected people, \(S-x\).

- Write down the differential equation.
- Supposing \(x(0) > 0\), that is, some people are infected at time \(t=0\), what is \(\displaystyle \lim_{t\to\infty} x(t)\).
- Does the solution to part b) agree with your intuition? Why or why not?

Exercise \(\PageIndex{1.6.6}\)

Let \(x' = (x-1)(x-2)x^2\).

- Sketch the phase diagram and find critical points.
- Classify the critical points.
- If \(x(0) = 0.5\) then find \(\lim \limits_{t\to\infty} x(t)\).

**Answer**-
- \(0,\: 1,\: 2\) are critical points.
- \(x=0\) is unstable (semistable), \(x=1\) is stable, and \(x=2\) is unstable.
- \(1\)

Exercise \(\PageIndex{1.6.7}\)

Let \(x' = e^{-x}\).

- Find and classify all critical points.
- Find \(\lim \limits_{t\to\infty} x(t)\) given any initial condition.

**Answer**-
- There are no critical points.
- \(\infty\)

Exercise \(\PageIndex{1.6.8}\)

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.

- Find the differential equation for \(x\).
- What is the new limiting population?

**Answer**-
- \(\frac{dx}{dt}=kx(M-x)+A\)
- \(\frac{kM+\sqrt{(kM)^{2}+4Ak}}{2k}\)

Exercise \(\PageIndex{1.6.9}\)

Suppose \(\frac{dx}{dt} = (x-\alpha)(x-\beta)\) for two numbers \(\alpha < \beta\).

- Find the critical points, and classify them.

For b), c), d), find \(\displaystyle \lim_{t\to\infty} x(t)\) based on the phase diagram.

- \(x(0) < \alpha\),
- \(\alpha < x(0) < \beta\),
- \(\beta < x(0)\).

**Answer**-
- \(\alpha\) is a stable critical point, \(\beta\) is an unstable one.
- \(\alpha\)
- \(\alpha\)
- \(\infty\) or DNE.

## 1.7: Numerical methods: Euler’s method

Exercise \(\PageIndex{1.7.1}\)

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 \(\PageIndex{1.7.2}\)

Consider \(\frac{dx}{dt} = t -x \), \(x(0) = 1\).

- Use Euler’s method with step sizes \(h = 1, \frac{1}{2}, \frac{1}{4}, \frac{1}{8}\) to approximate \(x(1)\).
- Solve the equation exactly.
- 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 \(\PageIndex{1.7.3}\)

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 \(\PageIndex{1.7.4}\)

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}\).

\[\begin{align}\begin{aligned} 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).\end{aligned}\end{align}\]

Exercise \(\PageIndex{1.7.5}\)

Consider \(\frac{dy}{dx} = yx^2\), \(y(0) = 1\).

- Use Runge-Kutta (see above) with step sizes \(h = 1\) and \(h = \frac{1}{2}\) to approximate \(y(1)\).
- Use Euler’s method with \(h = 1\) and \(h = \frac{1}{2}\).
- Solve exactly, find the exact value of \(y(1)\), and compare.

Exercise \(\PageIndex{1.7.6}\)

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.

**Answer**-
Approximately: \(1.0000,\: 1.2397,\: 1.382\)

Exercise \(\PageIndex{1.7.7}\)

Let \(x' = 2t\), and \(x(0) = 0\).

- Approximate \(x(4)\) using Euler’s method with step sizes \(4\), \(2\), and \(1\).
- Solve exactly, and compute the errors.
- Compute the factor by which the errors changed.

**Answer**-
- \(0,\: 8,\: 12\)
- \(x(4) = 16,\) so errors are: \(16,\: 8,\: 4\).
- Factors are \(0.5,\: 0.5,\: 0.5\).

Exercise \(\PageIndex{1.7.8}\)

Let \(x' = xe^{xt+1}\), and \(x(0) = 0\).

- Approximate \(x(4)\) using Euler’s method with step sizes \(4\), \(2\), and \(1\).
- Guess an exact solution based on part a) and compute the errors.

**Answer**-
- \(0,\: 0,\: 0\)
- \(x=0\) is a solution so errors are: \(0,\: 0,\: 0\).

There is a simple way to improve Euler’s method to make it a second order method by doing just one extra step. Consider \(\frac{dy}{dx}=f(x,y)\), \(y(x_0) = y_0\), and a step size \(h\). What we do is to pretend we compute the next step as in Euler, that is, we start with \((x_i,y_i)\), we compute a slope \(k_1 = f(x_i,y_i)\), and then look at the point \((x_i+h,y_i + k_1h)\). Instead of letting our new point be \((x_i+h,y_i + k_1h)\), we compute the slope at that point, call it \(k_2\), and then take the average of \(k_1\) and \(k_2\), hoping that the average is going to be closer to the actual slope on the interval from \(x_i\) to \(x_i+h\). And we are correct, if we halve the step, the error should go down by a factor of \(2^2 = 4\). To summarize, the setup is the same as for regular Euler, except the computation of \(y_{i+1}\) and \(x_{i+1}\).

\[\begin{align}\begin{aligned} & k_1 = f(x_i,y_i) , & & x_{i+1} = x_i + h , \\ & k_2 = f(x_i + h,y_i + k_1h) , & & y_{i+1} = y_i + \frac{k_1+k_2}{2}\,h .\end{aligned}\end{align}\]

Exercise \(\PageIndex{1.7.9}\)

Consider \(\dfrac{dy}{dx} = x+y\), \(y(0)=1\).

- Use the improved Euler’s method (see above) with step sizes \(h=\frac{1}{4}\) and \(h=\frac{1}{8}\) to approximate \(y(1)\).
- Use Euler’s method with \(h=\frac{1}{4}\) and \(h=\frac{1}{8}\).
- Solve exactly, find the exact value of \(y(1)\).
- Compute the errors, and the factors by which the errors changed.

**Answer**-
- Improved Euler: \(y(1)\approx 3.3897\) for \(h=1/4\), \(y(1)\approx 3.4237\) for \(h=1/8\),
- Standard Euler: \(y(1)\approx 2.8828\) for \(h=1/4\), \(y(1)\approx 3.1316\) for \(h=1/8\),
- \(y=2e^{x}-x-1\), so \(y(2)\) is approximately \(3.4366\).
- Approximate errors for improved Euler: \(0.046852\) for \(h=1/4\), and \(0.012881\) for \(h=1/8\). For standard Euler: \(0.55375\) for \(h=1/4\), and \(0.30499\) for \(h=1/8\). Factor is approximately \(0.27\) for improved Euler, and \(0.55\) for standard Euler.

## 1.8 Exact Equations

Exercise \(\PageIndex{1.8.1}\)

Solve the following exact equations, implicit general solutions will suffice:

- \((2 xy + x^2) \, dx + (x^2+y^2+1) \, dy = 0\)
- \(x^5 + y^5 \frac{dy}{dx} = 0\)
- \(e^x+y^3 + 3xy^2 \frac{dy}{dx} = 0\)
- \((x+y)\cos(x)+\sin(x) + \sin(x)y' = 0\)

Exercise \(\PageIndex{1.8.2}\)

Find the integrating factor for the following equations making them into exact equations:

- \(e^{xy} \, dx + \frac{y}{x} e^{xy} \, dy = 0\)
- \(\frac{e^x+y^3}{y^2} \, dx + 3x \, dy = 0\)
- \(4(y^2+x) \, dx + \frac{2x+2y^2}{y} \, dy = 0\)
- \(2\sin(y) \, dx + x\cos(y)\, dy = 0\)

Exercise \(\PageIndex{1.8.3}\)

Suppose you have an equation of the form: \(f(x) + g(y) \frac{dy}{dx} = 0\).

- Show it is exact.
- Find the form of the potential function in terms of \(f\) and \(g\).

Exercise \(\PageIndex{1.8.4}\)

Suppose that we have the equation \(f(x) \, dx - dy = 0\).

- Is this equation exact?
- Find the general solution using a definite integral.

Exercise \(\PageIndex{1.8.5}\)

Find the potential function \(F(x,y)\) of the exact equation \(\frac{1+xy}{x}\, dx + \bigl(\frac{1}{y} + x \bigr) \, dy = 0\) in two different ways.

- Integrate \(M\) in terms of \(x\) and then differentiate in \(y\) and set to \(N\).
- Integrate \(N\) in terms of \(y\) and then differentiate in \(x\) and set to \(M\).

Exercise \(\PageIndex{1.8.6}\)

A function \(u(x,y)\) is said to be a if \(u_{xx} + u_{yy} = 0\).

- Show if \(u\) is harmonic, \(-u_y \, dx + u_x \, dy = 0\) is an exact equation. So there exists (at least locally) the so-called function \(v(x,y)\) such that \(v_x = -u_y\) and \(v_y = u_x\).

Verify that the following \(u\) are harmonic and find the corresponding harmonic conjugates \(v\):

- \(u = 2xy\)
- \(u = e^x \cos y\)
- \(u = x^3-3xy^2\)

Exercise \(\PageIndex{1.8.7}\)

Solve the following exact equations, implicit general solutions will suffice:

- \(\cos(x)+ye^{xy} + xe^{xy} y' = 0\)
- \((2x+y)\, dx + (x-4y) \, dy = 0\)
- \(e^x + e^y \frac{dy}{dx} = 0\)
- \((3x^2+3y)\,dx + (3y^2+3x)\, dy = 0\)

**Answer**-
- \(e^{xy}+\sin (x)=C\)
- \(x^{2}+xy-2y^{2}=C\)
- \(e^{x}+e^{y}=C\)
- \(x^{3}+3xy+y^{3}=C\)

Exercise \(\PageIndex{1.8.8}\)

Find the integrating factor for the following equations making them into exact equations:

- \(\frac{1}{y}\, dx + 3y \, dy = 0\)
- \(dx - e^{-x-y} \, dy = 0\)
- \(\bigl( \frac{\cos(x)}{y^2} + \frac{1}{y} \bigr) \, dx + \frac{x}{y^2} \, dy = 0\)
- \(\bigl( 2y + \frac{y^2}{x} \bigr) \, dx + ( 2y+x )\, dy = 0\)

**Answer**-
- Integrating factor is \(y\), equation becomes \(dx+3y^{2}dy=0\).
- Integrating factor is \(e^{x}\), equation becomes \(e^{x}dx-e^{-y}dy=0\).
- Integrating factor is \(y^{2}\), equation becomes \((\cos(x)+y)dx+xdy=0\).
- Integrating factor is \(x\), equation becomes \((2xy+y^{2})dx+(x^{2}+2xy)dy=0\).

Exercise \(\PageIndex{1.8.9}\)

- Show that every separable equation \(y' = f(x)g(y)\) can be written as an exact equation, and verify that it is indeed exact.
- Using this rewrite \(y' = xy\) as an exact equation, solve it and verify that the solution is the same as it was in Example 1.3.1.

**Answer**-
- The equation is \(-f(x)dx+\frac{1}{g(y)}dy\), and this is exact because \(M=-f(x)\), \(N=\frac{1}{g(y)}\), so \(M_{y}=0=N_{x}\).
- \(-xdx+\frac{1}{y}dy=0\), leads to potential function \(F(x,y)=-\frac{x^{2}}{2}+\ln|y|\), solving \(F(x,y)=C\) leads to the same solution as the example.

## 1.9: First Order Linear PDE

Exercise \(\PageIndex{1.9.1}\)

Solve

- \(u_t +9u_x = 0\), \(u(x,0) = \sin(x)\),
- \(u_t -8u_x = 0\), \(u(x,0) = \sin(x)\),
- \(u_t +\pi u_x = 0\), \(u(x,0) = \sin(x)\),
- \(u_t + \pi u_x + u = 0\), \(u(x,0) = \sin(x)\).

Exercise \(\PageIndex{1.9.2}\)

Solve \(u_t +3u_x = 1\), \(u(x,0) = x^2\).

Exercise \(\PageIndex{1.9.3}\)

Solve \(u_t +3u_x = x\), \(u(x,0) = e^x\).

Exercise \(\PageIndex{1.9.4}\)

Solve \(u_x+u_t+xu = 0\), \(u(x,0) = \cos(x)\).

Exercise \(\PageIndex{1.9.5}\)

- Find the characteristic coordinates for the following equations:

\(u_x+u_t + u = 1\), \(u(x,0) = \cos(x)\), ) \(2u_x+2u_t +2u = 2\), \(u(x,0) = \cos(x)\). - Solve the two equations using the coordinates.
- Explain why you got the same solution, although the characteristic coordinates you found were different.

Exercise \(\PageIndex{1.9.6}\)

Solve \((1+x^2) u_t + x^2 u_x + e^x u = 0\), \(u(x,0) = 0\). Hint: Think a little out of the box.

Exercise \(\PageIndex{1.9.7}\)

Solve

- \(u_t - 5u_x = 0\), \(u(x,0) = \frac{1}{1+x^2}\),
- \(u_t + 2u_x = 0\), \(u(x,0) = \cos(x)\).

**Answer**-
- \(u=\frac{1}{1+(x+5t)^{2}}\)
- \(u=\cos (x-2t)\)

Exercise \(\PageIndex{1.9.8}\)

Solve \(u_x+u_t+tu = 0\), \(u(x,0) = \cos(x)\).

**Answer**-
\(u=\cos (x-t)e^{-t^{2}/2}\)

Exercise \(\PageIndex{1.9.9}\)

Solve \(u_x+u_t = 5\), \(u(x,0) = x\).

**Answer**-
\(u=x+4t\)