Good Question 6: 2000 AB 4

2000 AB 4 Water tankAnother of my favorite questions from past AP exams is from 2000 question AB 4. If memory serves it is the first of what became known as an “In-out” question. An “In-out” question has two rates that are working in opposite ways, one filling a tank and the other draining it.

In subsequent years we saw a question with people entering and leaving an amusement park (2002 AB2/BC2), sand moving on and off a beach (2005 AB 2), another tank (2007 AB2), an oil leak being cleaned up (2008 AB 3), snow falling and being plowed (2010 AB 1), gravel being processed (2013 AB1/BC1), and most recently water again flowing in and out of a pipe (2015 AB1/BC1). The in-between years saw rates in one direction only but featured many of the same concepts.

The questions give rates and ask about how the quantity is changing. As such, they may be approached as differential equation initial value problems, but there is an easier way. This easier way is that a differential equation that gives the derivative as a function of a single variable, t, with an initial point \left( {{t}_{0}},y\left( {{t}_{0}} \right) \right) always has a solution of the form

y\left( t \right)=y\left( {{t}_{0}} \right)+\int_{{{t}_{0}}}^{t}{{y}'\left( x \right)dx}.

This is sometimes called the “accumulation equation.” The integral of a rate of change {y}'\left( t \right) gives the net amount of change over the interval of integration [{{t}_{0}},t]. When this is added to the initial amount the result is an expression that gives the amount at any time t.

In a motion context, this same idea is that the position at any time t, is the initial position plus the displacement:

\displaystyle s\left( t \right)=s\left( {{t}_{0}} \right)+\int_{{{t}_{0}}}^{t}{v\left( x \right)dx} where v\left( t \right)={s}'\left( t \right)

The scoring standard gave both forms of the solution. The ease of the accumulation form over the differential equation solution was evident and subsequent standards only showed this one.

2000 AB 4

The question concerned a tank that initially contained 30 gallons of water. We are told that water is being pumped into the tank at a constant rate of 8 gallons per minute and the water is leaking out at the rate of \sqrt{t+1} gallons per minute.

Part a asked students to compute the amount of water that leaked out in the first three minutes. There were two solutions given. The second solves the problem as an initial value differential equation:

Let L(t) be the amount that leaks out in t minutes then

\displaystyle \frac{dL}{dt}=\sqrt{t+1}

L\left( t \right)=\frac{2}{3}{{\left( t+1 \right)}^{3/2}}+C

L\left( 0 \right)=\frac{2}{3}{{\left( 0+1 \right)}^{3/2}}+C=0 since nothing has leaked out yet, so C = -2/3

L\left( t \right)=\frac{2}{3}{{\left( t+1 \right)}^{3/2}}-\frac{2}{3}

L\left( 3 \right)=\frac{14}{3}

The first method, using the accumulation idea takes a single line:

\displaystyle L\left( 3 \right)=\int_{0}^{3}{\sqrt{t+1}dt}=\left. \frac{2}{3}{{\left( t+1 \right)}^{3/2}} \right|_{0}^{3}=\frac{2}{3}{{\left( 4 \right)}^{3/2}}-\frac{2}{3}{{\left( 1 \right)}^{3/2}}=\frac{14}{3}

I think you’ll agree this is easier and more direct.

Part b asked how much water was in the tank at t = 3 minutes.  We have 30 gallons to start plus 8(3) gallons pumped in and 14/3 gallons leaked out gives 30 + 24 – 14/3 = 148/3 gallons.

This part, worth only 1 point, was a sort of hint for the next part of the question.

Part c asked students to write an expression for the total number of gallons in the tank at time t.

Following part b the accumulation approach gives either

\displaystyle A\left( t \right)=30+8t-\int_{0}^{t}{\sqrt{x+1}dx}  or

\displaystyle A\left( t \right)=30+\int_{0}^{t}{\left( 8-\sqrt{x+1} \right)dx}.

The first form is not a simplification of the second, but rather the second form is treating the difference of the two rates, in minus out, as the rate to be integrated.

The differential equation approach is much longer and looks like this:

\displaystyle \frac{dA}{dt}=8-\sqrt{t+1}

A\left( t \right)=8t-\frac{2}{3}{{\left( t+1 \right)}^{3/2}}+C

A\left( 0 \right)=30=8(0)-\frac{2}{3}{{\left( 0+1 \right)}^{3/2}}+C, so C=\frac{92}{3}

A\left( t \right)=8t-\frac{2}{3}{{\left( t+1 \right)}^{3/2}}+\frac{92}{3}

Again, this is much longer. In recent years when asking student to write an expression such as this, the directions included a phrase such as “write an equation involving one or more integrals that gives ….” This pretty much leads students away from the longer differential equation initial value problem approach.

Part d required students to find the time when in the interval 0\le t\le 120 minutes the amount of water in the tank was a maximum and to justify their answer. The usual method is to find the derivative of the amount, A(t), set it equal to zero, and then solve for the time.

{A}'\left( t \right)=8-\sqrt{t+1}

Notice that this is the same regardless of which of the three forms of the expression for A(t) you start with. Thus, an excellent example of the Fundamental Theorem of Calculus used to find the derivative of a function defined by an integral. Or you could just start here without reference to the forms above: the overall rate in the rate in minus the rate out.

{A}'\left( t \right)=0 when t = 63

This is a maximum by the First Derivative Test since for 0 < t < 63 the derivative of A is positive and for 63 < t <120 the derivative of A is negative.

There is an additional idea on this part of the question in the Teaching Suggestions below.


I like this question because it is a nice real (as real as you can hope for on an exam) situation and for the way the students are led through the problem. I also like the way it can be used to compare the two methods of solution.  Then the way they both lead to the same derivative in part d is nice as well. I use this one a lot when working with teachers in workshops and summer institutes for these very reasons.

Teaching Suggestions

  • Certainly, have your students work through the problem using both methods. They need to learn how to solve an initial value problem (IVP) and this is good practice. Additionally, it may help them see how and when to use one method or the other.
  • Be sure the students understand why the three forms of A(t) in part c give the same derivative in part d. This makes an important connection with the Fundamental theorem of Calculus.
  • Like many good AP questions part d can be answered without reference to the other parts. The question starts with more water being pumped in than leaking out. This will continue until the rate at which the water leaks out overtakes the rate at which it is being pumped in. At that instant the rate “in” equals the rate “out” so you could start with 8=\sqrt{t+1}. After finding that t = 63, the answer may be justified by stating that before this time more water is being pumped in than is leaking out and after this time the rate at which water leaks out is greater than the rate at which it is pumped in, so the maximum must occur at t = 63.
  • And as always, consider the graph of the rates.

2000 AB 4

I used this question as the basis of a lesson in the current AP Calculus Curriculum Module entitled Integration, Problem Solving and Multiple Representations © 2013 by the College Board. The lesson gives a Socratic type approach to this question with a number of questions for each part intended to help the teacher not only work through this problem but to bring out related ideas and concepts that are not in the basic question. The module is currently available at AP sponsored workshops and AP Summer Institutes. Eventually, it will be posted at AP Central on the AB and BC Calculus Home Pages.

Euler’s Method for Making Money

Chip Rollinson is a teacher at Buckingham Browne & Nichols School in Cambridge, Massachusetts. Today’s post is a note he sent to the AP Calculus Community bulletin board that I found interesting. I will share it with you with his permission. I made some minor edits. Chip wrote on February 5, 2015:

I had an epiphany today about the relationship between Euler’s Method and compounding growth. I had never made the connection before. I thought it was cool so I decided I needed to share it.

Consider the differential equation \frac{dA}{dt}=rA with the condition A(0) = P. Solving this equation gives A\left( t \right)=P{{e}^{rt}}, but let’s ignore this for now.

Let’s look at this differential equation using Euler’s Method.

Leonhard Euler1707 - 1783

Leonhard Euler
1707 – 1783

Let’s start with a step size of \tfrac{1}{12} and use (0, P) as the “starting point.”

After one step, you arrive at the point \displaystyle \left( \tfrac{1}{12},P+\tfrac{r}{12}P \right)=\left( \tfrac{1}{12},P\left( 1+\tfrac{r}{12} \right) \right)

After 2 steps, you arrive at the point \displaystyle \left( \tfrac{2}{12},P+\tfrac{2}{12}P+\tfrac{{{r}^{2}}}{144}P \right)=\left( \tfrac{2}{12},P{{\left( 1+\tfrac{r}{12} \right)}^{2}} \right)

After 3 steps, you arrive at the point \displaystyle \left( \tfrac{3}{12},P+\tfrac{3}{12}rP+\tfrac{3}{144}{{r}^{2}}P+P\tfrac{3}{1728}{{r}^{3}} \right)=\left( \tfrac{3}{12},P{{\left( 1+\tfrac{r}{12} \right)}^{3}} \right)

After 4 steps, you arrive at the point \displaystyle \left( \tfrac{4}{12},P{{\left( 1+\tfrac{r}{12} \right)}^{4}} \right)

And so on …

After 12 steps, you arrive at the point \displaystyle \left( 1,P{{\left( 1+\tfrac{r}{12} \right)}^{12}} \right)

After 120 steps, you arrive at the point \displaystyle \left( 10,P{{\left( 1+\tfrac{r}{12} \right)}^{120}} \right)

After 12t steps, you arrive at the point \displaystyle \left( t,P{{\left( 1+\tfrac{r}{12} \right)}^{12t}} \right)

Do these y-values look familiar? It’s the amount you’d have if you were compounding monthly with a yearly interest rate of r for a year, 10 years, and t years.

If the step size were \displaystyle \tfrac{1}{365} instead, you would arrive at the points

\displaystyle \left( 1,P{{\left( 1+\tfrac{r}{365} \right)}^{365}} \right), and \left( 10,P{{\left( 1+\tfrac{r}{365} \right)}^{3650}} \right), and \displaystyle \left( t,P{{\left( 1+\tfrac{r}{365} \right)}^{365t}} \right).

These y-values are the amount you’d have if you were compounding daily for a year, 10 years, and t years.

If the step size were \tfrac{1}{n}, the point after t years is \displaystyle \left( t,P{{\left( 1+\tfrac{r}{n} \right)}^{nt}} \right)

If n went to infinity, you would arrive at the point \displaystyle \left( t,P{{e}^{rt}} \right), the y-value for continuously compounding. This is the solution of  the differential equation mentioned above.

I’d never made this connection before, but it makes perfect sense now.

The actual problem that got me thinking about all of this was:

Suppose that you now have $6000, you expect to save an additional $3000 during each year, and all of this is deposited in a bank paying 4% interest compounded continuously.

This generates the differential equation: \displaystyle \frac{dA}{dt}=0.04t+3000

This was a fun one to do out. I started with a step size of 1/12 and then made them smaller. I derived the solution from Euler’s Method!


So writes Chip Rollinson. He included the following links to his computations: here and here

Then there were some interesting comments from others.

1. Mark Howell pointed out that if \displaystyle \frac{dy}{dx}=f\left( x \right), that is if the derivative is a function of x only, then Euler’s method is the same as a left Riemann sum approximation.

This would make a good exercise for your students to show given a derivative, a starting point, and a small number of steps. Try \frac{dy}{dx}={{x}^{3}}, and use Euler’s Method with 4 steps starting at (0, 0) and then a left-Riemann sum with 4 terms to approximate \int_{0}^{1}{{{x}^{3}}dx},  (Answer: \tfrac{9}{64})

2. Dan Teague went further and pointed out that this is really the development of the Fundamental Theorem of Calculus for a particular function. He contributed this development of the concept.

So Thank You Chip for this and the several other comments you’ve contributed to other post on this blog. And thank you Mark and Dan for your contributions.


A Family of Functions

Good Question 2, continued. 

Today we continue looking at Good Question 2 from our last post. The jumping off place was the BC calculus exam question 5 from 2002. We looked at the differential equation \displaystyle \frac{dy}{dx}=2y-4x and its slope field and discussed the questions asked on the exam. Then we saw how to actually solve the equation and found the general solution to be y\left( x \right)=C{{e}^{2x}}+2x+1.

The general solution of a differential equation contains a constant and therefore defines a family of functions all of whom satisfy the differential equation; they have similar, but slightly different graphs. Let’s look at and discuss the similarities and differences.

In using this with a class I suggest you present it step by step with lots of questions (more than I have here) to help them find the way to the full description of the family of functions. Alternatively, you could be very general and ask them to discuss (and justify) end behavior and the location of any extreme values or other interesting features individually or in small groups.

The Rule of Four says that all mathematical situations should be looked at analytically (i.e. with equations), graphically, numerically and verbally. In the previous post the analytic considerations were foremost and the slope field accounted for the graphical aspect. Euler’s method was numerical. Today the numerical comes to the forefront to help us discuss the graph. (Fro the verbal, well, I’ve never been accused of not being verbose, writing-wise.)

The two numbers that need to be considered are the parameter C and numerical size of e2x.

When C = 0 the solution reduces to y = 2x + 1. This is a line. If we rewrite the general solution as y\left( x \right)=\left( 2x+1 \right)+C{{e}^{2x}} and realize that e2x is always positive, we can see that solutions with C > 0 lie above the line and those with C < 0 lie below.

Left end behavior

Look at the x-values moving from the origin to the left; where x is negative and getting larger in absolute value. Here e2x will get very small and the solution will all get closer to the line y = 2x + 1. If C > 0 the solutions will be a little above the line and if C < 0 they will lie just below the line.

Therefore, the left end behavior is that the functions approach y = 2x + 1 as a slant asymptote.

Maximum Points

In the previous post we determined that the origin was a maximum point of the solution that contained the origin (C = –1).  Are there extreme points for any other solutions?

The maximums occur where \displaystyle \frac{dy}{dx}=0, that is where 2y-4x=0 or y=2x. We know they are maximums by the second derivative test: \displaystyle \frac{{{d}^{2}}y}{d{{x}^{2}}}=2\frac{dy}{dx}-4=4C{{e}^{2x}}-2<0 when C  < 0. All the curves with C < 0 are concave down on their entire domain.

What does this mean? It means that for all the members of the family of solutions that have C < 0 have a maximum point, and that maximum point will be on the line y=2x.

Which members of the family can have maximums? Since y=2x lies below y=2x+1 only those with C < 0 will have maximums.

"Thirty

The graph above shows 30 members of the family with C = –3 (bottom curve) to C = –0.1 (top curve). The equation of the black line is y= 2x and the equation of the blue line is y= 2x + 1. Note that all the maximum points lie on the line y= 2x.

The curves with C > 0 lie above the line y= 2x + 1. For these curves \displaystyle \frac{{{d}^{2}}y}{d{{x}^{2}}}=2\frac{dy}{dx}-4=2\left( 2y-4x \right)-4=4y-8x-4

This expression will be positive when 4y-8x-4>0 or y>2x+1. In other words, when the curve lies above the line y= 2x + 1, exactly those with C > 0.

Therefore, all of these members of the family are concave up everywhere and since there is nowhere where their derivative is zero, there are no minimum points. See the graph below

Ten family members from C=0.3 (bottom curve) to C = 30 (top)

Ten family members
from C = 0.3 (bottom curve) to C = 30 (top)

Right end behavior

From what we have determined above for C > 0 \displaystyle \underset{x\to \infty }{\mathop{\lim }}\,y\left( x \right)=\infty , and for C < 0, \displaystyle \underset{x\to \infty }{\mathop{\lim }}\,y\left( x \right)=-\infty .


When graphing calculators were first required on the AP calculus exams (1995) there were, for a few years, questions asking students to analyze some aspect of a family of functions. See for example 1995 BC 5, 1996 AB4/BC4, 1997 AB 4, 1997 BC 4, 1998 AB2/BC2. They seem to have stopped asking such questions. Too bad; there is some interesting calculus to be had in family of function questions.

Good Question 2: 2002 BC 5

This is the second in my occasional series on good questions, good from the point of view of teaching about the concepts involved. This one is about differential equations and slope fields. The question is from the 2002 BC calculus exam. Question 5. while a BC question, all but part b are suitable for AB classes.

2002 BC 5

The stem presented the differential equation \displaystyle \frac{dy}{dx}=2y-4x. Now the only kind of differential equation that AP calculus students are expected to be able to solve are those that can be separated. This one cannot be separated, so some other things must be happening.

Part a concerns slope fields. Often on the slope field questions students are asked to draw a slope field of a dozen or so points. While drawing a slope field by hand is an excellent way to help students learn what a slope fields is, in “real life” slope fields are rarely drawn by hand. The real use of slope fields is to investigate the properties of a differential equation that perhaps you cannot solve. It allows you to see something about the solutions. And that is what happens in this question.

In the first part of the question students were asked to sketch the solutions that contained the points (0, 1) and (0, –1). These points were marked on the graph. The solutions are easy enough to draw.

But the question did not stop there, as we shall see, using the slope field could help in other parts of the question.

Part c: Taking these out of order, we will return to part b in a moment. Part c told students that there was a number b for which y = 2x + b is a solution to the differential equation. Students were required to find the value of b and (of course) justify their answer.

There are two approaches. Since y = 2x + b is a solution, we can substitute it into the differential equation and solve for b. Since for this solution dy/dx = 2 we have

2=2\left( 2x+b \right)-4x

2=4x+2b-4x

1=b

So b = 1 and the solution serves as the justification.

The other method, I’m happy to report, had some students using the slope field. They noticed that the solution through the point (0, 1) is, or certainly appears to be, the line y = 2x + 1. So students guessed that b  = 1 and then checked their guess by substituting y = 2x + 1 into the differential equation:

2=2\left( 2x+1 \right)-4x

2=4x+2=4x

2=2

The solution checks and the check serves as the justification.

I like the second solution much better, because it uses the slope field as slope field are intended to be used.

Incidentally, this part was included because readers noticed in previous years that many students did not understand that the solution to a differential equation could be substituted into the differential equation to obtain a true equation as was necessary using either method for part b.

There is yet another approach. Since the solution is given as linear the second derivative must by 0. So

\displaystyle \frac{{{d}^{2}}y}{d{{x}^{2}}}=2\frac{dy}{dx}-4=2\left( 2y-4x \right)-4

2\left( 2y-4x \right)-4=0

4y-8x-4=0

4y=8x+4

y=2x+1

And again b = 1

Returning to part b.

Part b asked students to do an Euler’s method approximation of f(0.2) with two equal steps  of the solution of the differential equation through (0, 1). The computation looks like this:

f\left( 0.1 \right)\approx 1+\left( 2\left( 1 \right)-4\left( 0 \right) \right)\left( 0.1 \right)=1.2

f\left( 0.2 \right)\approx 1.2+\left( 2\left( 1.2 \right)-4\left( 0.1 \right) \right)\left( 0.1 \right)=1.4

So far so good. But this is is about the solution through the point (0, 1). Again referring to the slope field, there is no reason to approximate (except that students were specifically told to do so). Substituting into y = 2x + 1, f(0.2) = 1.4 exactly!

Part d: In the last part of the question students were asked to consider a solution of the differential,  g, that satisfied the initial condition g(0) = 0, a solution containing the origin. Students were asked to determine if g(x) had a local extreme at the origin and, if so, to tell what kind (maximum or minimum), and to justify their answer.

Looking again at the slope field it certainly appears that there is a maximum at the origin, and since substituting (0, 0) into the differential equation gives dy/dx = 2(0) – 4(0) = 0, it appears there could be an extreme there. So now how do we determine and justify if this is a maximum or minimum? We cannot use the Candidates’ Test (Closed Interval Test) since we do not have a closed interval, nor can we easily determine if there are any other points nearby where the derivative is zero (there are). Therefore, the First Derivative Test does not help. That leaves the Second Derivative Test.

To use the Second Derivative Test we must use implicit differentiation. (Notice that two unexpected topics now appear extending the scope of the question in a new direction).

\displaystyle \frac{{{d}^{2}}y}{d{{x}^{2}}}=2\frac{dy}{dx}-4

At the origin dy/dx = 0 as we already determined, so

\displaystyle \frac{{{d}^{2}}y}{d{{x}^{2}}}=2\left( 0 \right)-4<0

Therefore, since at x = 0, the first derivative is zero and the second derivative is negative the function g(x) has a maximum value at (0, 0) by the Second Derivative Test .

More: Can we solve the differential equation? Yes. The solution has two parts. First we solve the homogeneous differential equation \frac{dy}{dx}=2y, ignoring the –4x for the moment. This is easily solved by separating the variables y=C{{e}^{2x}}, which can be checked by substituting.

Because the differential equation contains x and y and ask ourselves what kind of function might produce a derivative of 2y – 4x? Then we assume there is a solution of the form y = Ax + B where A and B are to be determined and proceed as follows.

\displaystyle \frac{dy}{dx}=2y-4x

A=2\left( Ax+B \right)-4x=\left( 2A-4 \right)x+2B

Equating the coefficients of the like terms we get the system of equations:

A=2B

0=2A-4

A=2\text{ and }B=1

Putting the two parts together the solution is y=C{{e}^{2x}}+2x+1. This may be checked by substituting. Notice that when C = 0 the particular solution is y = 2x + 1, the line through the point (0, 1).

(Extra: It is not unreasonable to think that instead of y = Ax + B we should assume that the solution might be of the form y = Ax2 + Bx + C. Substitute this into the differential equation and show why this is not the case; i.e. show that A = 0, B = 2 and C = 1 giving the same solution as just found.)

Using a graphing program like Winplot, we can consider all the solutions. Below the slope field is graphed using a slider for C to animate the different solutions. The video below shows this with the animation pausing briefly at the two solutions from part a. Notice the maximum point as the graphs pass through the origin.

Slope field

But wait! There’s more!

The next post will take this question further – Look for it soon.

Update June 27, 2015. Third solution to part c added.

Euler’s Method

Differential Equations 3 – Euler’s Method

Since not all differential equation initial values problems (IVP) can be solved, it is often necessary to approximate the solution. There are several ways of doing this. The one that AP students are required to know is Euler’s Method.

The idea behind Euler’s Method is to first write the equation of the line tangent to the solution at the initial condition point. To find the approximate value of the solution near the initial condition, then take short steps from the initial point to the point with the x-value you need.

Since you have the initial point and the differential equation will give you the slope, it is easy to write the equation of the tangent line. You then approximate the point on the solution by using the point on this line a short distance (called the step-size or \Delta x) from the initial point. The first step is exactly the local linear approximation idea.

Next, you write the equation of another line through the approximated point using the differential equation to give you the slope at the approximated point (i.e. not the point on the curve which you do not know). This gives you a second (approximate) point.

Then you repeat the process (called iteration) until you get to the x-value you need.

The equations look like this:

x_{n}={{x}_{n-1}}+\Delta x

{{y}_{n}}={{y}_{n-1}}+{f}'({{x}_{n-1}},{{y}_{n-1}})\Delta x

The first equation says that the x-values increase by the same amount each time. \Delta x may be negative if the required value is at an x-value to the left of the initial point.

The second equation gives the y-value of a point on the line through the previous point where the slope, {f}'({{x}_{n-1}},{{y}_{n-1}}), is found by substituting the coordinates of the previous point into the differential equation. It has the form of the equation of a line.

Example: Let f be the solution of the differential equation \displaystyle \frac{dy}{dx}=3x-2y with the initial point (1, 3). Approximate the value of f(2) using Euler’s method with two steps of equal size.

Solution: At the initial point \displaystyle \frac{dy}{dx}=3(1)-2(3)=-3. Then

{{x}_{1}}=1.5 and {{y}_{1}}=3+(3(1)-2(3))(0.5)=1.5

Now using the point (1.5, 0.5) where \displaystyle \frac{dy}{dx}=3(1.5)-2(0.5)=3.5

{{x}_{2}}=2 and {{y}_{2}}=0.5+(3.5)(0.5)=2.25

Therefore, \left( 2 \right)\approx 2.25. The exact value is 2.5545. A better approximation could be found using smaller steps.

Some textbooks and some teachers make tables to organize this procedure. This is fine, but not necessary on the AP exams. Showing the computations as above will earn the credit. It is easy to remember: you are just writing the equation of a line.

There are calculator programs available on-line that will compute successive iterations of Euler’s method and others that will compute and graph the values so you can examine the approximate solution graph. Of course in real situations computers using this or more advanced techniques can produce approximate numerical solutions to initial value problems.

Here is a graphical look at what Euler’s Method does. Consider this easy IVP: \displaystyle \frac{dy}{dx}={{e}^{x}} with the initial condition y\left( 0 \right)=1. The screen is two units wide extending from x = 0 to x = 2.  The calculator graph below shows three graphs. The top graph is the particular solution y={{e}^{x}}. (I said it was easy.) The lower graph shows an approximate solution with the rather large step size of \Delta x=1 with the two points connected; look closely and you will see the two segments. The middle graph has a step size of \Delta x=0.25. There are 8 segments, but they appear to be a smooth curve approximating the solution. Notice it is closer to the actual solution graph. An even smaller step size would show an even smoother graph closer to the particular solution.Euler

Slope Fields

Differential Equation 2 – Slope Fields

Of course, we always want to see the graph of an equation we are studying. The graph of a differential equation is a slope field.  A first derivative expressed as a function of x and y gives the slope of the tangent line to the solution curve that goes through any point in the plane.

Slope fields make use of this by imposing a grid of points evenly spaced across the Cartesian plane. At each point the value of the derivative is calculated and a short segment with that slope is drawn. These segments graphed together form the slope field.

Here is the slope field for the differential equation \displaystyle \frac{dy}{dx}=-\frac{x}{y}

Slope field 1

A good way to introduce slope fields to your class is to put or project a coordinate system on the board. Give each student one or two points (1, –3), (1, –2), (1, –1), (1, 1), (1, 2), etc. Have them calculate the derivative at their point(s) and then come to the board and draw a short segment through their point(s) with the slope they calculated. The result will be a slope field.  (This is, in fact, a common free-response question on the AP exams. Students are given a graph with 9 – 12 points plotted and they are asked to use them to draw a slope field for a given differential equation.)

The big idea with slope fields is to use them to get an idea of what the solutions look like, especially if the differential equation cannot be solved.  The solutions are lurking in the slope field. What do they look like in the figure? Circles of course. We solved this differential equation in the last post. The general solution is {{x}^{2}}+{{y}^{2}}={{C}^{2}}. Of course, they are not all that simple.

Since the solution graphs are lurking in the slope field, the next thing to do is to use the slope field to sketch a particular solution.  After plotting the initial condition (a point) students should draw a curve through the point that follows the slope field from edge to edge in both directions.

In the previous post (example 2) we found the particular solution of  \displaystyle \frac{dy}{dx}=-\frac{x}{y} with the initial condition point (4, –3) to be y=-\sqrt{25-{{x}^{2}}}. This is shown drawn on the slope field in the next graph. The black dot is the point (4, –3). Notice how the solution graph follows the slope field, but does not necessarily hit any of the segments. The solution will touch a segment only if the midpoint of the segment happens to be on the solution – this is not usually the case.

Slope field 2

Slope fields are tedious and time-consuming to draw by hand. It’s a job for computers. There are various graphing calculator programs available on the internet. Calculator screens are not the best for seeing slope fields; they are too small, and you should be sure to always be in a square window (or the slopes will not look right).

There are many websites that will draw slope fields and solution curves for you.  You can try this one. The figures in this post were done with Winplot (of course, my favorite). The good ones let you draw and animate solution curves over the slope field. (I have not found a good slope field generator app for iPads; if anyone makes apps, consider this a hint.)

Here is a brief example that shows how powerful an animated graph can be. In Winplot, follow the path Window > 2-dim > Equa > differential > dy/dx.  Enter the differential equation in the box and adjust the other settings as necessary.  Be sure you are in a square window (CTRL+Q).

The example below is from the 2002 BC exam question 5: dy/dx=2y-4x. Notice that this equation is not separable; students were not expected to solve it. They were asked to draw the solution curves through the two points (0, 1) and (0, –1) shown here in blue. These points are marked on the graph (Equa > point > (x,y)). The general solution, found by CAS, is y=C{{e}^{2x}}+2x+1. Enter this (Equa > 1.Explicit) and open the C slider (Anim > individual > C).

In the video below the C values go from –5 to 5. They stop momentarily at the two initial condition points (C = –2 for (0,–1) and C = 0 for (0, 1)). These are what the students were expected to sketch.

Slope field

The point is to see how the different values of C affect the equation, each giving its own particular solution, and to see the different solution hiding in the slope field.

Winplot may be downloaded here.

A DESMOS program that will draw slope fields is here.

Differential Equations

Differential Equations 1

The next several posts will cover the fundamentals of the topic of differential equations at least as far as is needed for an AP Calculus course. We will begin at the beginning.

What is a differential equation?

A differential equation is an equation with one or more derivatives in it. It may be very simple such as \displaystyle \frac{dy}{dx}=2x, or more complicated such as \displaystyle \frac{{{d}^{2}}y}{d{{x}^{2}}}+3\frac{dy}{dx}-4y=\cos \left( x \right) or even more complicated.

Why do we need differential equations?

It is often not possible to determine directly a regular function that applies to a real situation. However, we may be able to measure how something is changing with respect to time. The change with respect to time is a derivative and gives us a differential equation. Once in college, as you may remember, there are entire courses devoted to using and solving differential equations. Power series (a BC topic) are often used to approximate or find the solution to a differential equation.

What is the solution to a differential equation?

The solution of a differential equation is not a number. For the first equations we will consider the short answer is that a solution is a function that when substituted into the differential equation along with its derivatives produces a true statement (an identity).

As you may suspect differential equations, at least the easy ones, are solved by integrating. Thus the solution of \frac{dy}{dx}=2x  first appears to be y={{x}^{2}}. But we quickly realize that y={{x}^{2}}+17 and  also y={{x}^{2}}+2\pi  check when substituted into the given equation. In fact any equation with the form y={{x}^{2}}+C, where C is any constant will check. Because of this we first define the general solution of a differential equation as a function with one or more constants that satisfies the given differential equation.

In order to evaluate the constant(s) we are often given an initial condition. An initial condition is the value of the solution function for a particular value of the independent variable, in other words, a point on the solution’s graph. Once the constant is evaluated, we have what’s called a particular solution.

So if the solution of \frac{dy}{dx}=2x contains the point (4, 7), then the particular solution is y={{x}^{2}}-9. A differential equation with an initial condition is called an initial value problem or an IVP.

How do you solve a differential equation?

There is no one method that will let you solve any differential equation. They are not all as simple as the example above. That’s why entire courses are devoted to solving differential equations. AP Calculus students are expected to know only one of the many methods. (This is because there is only time for the briefest introduction of the topic.) The method is called separation of variables. Not all differential equations can be solved by this method; the second example at the top for example requires a much different approach (that is not tested on the AP calculus exams).

To use the method of separation of variables follow these steps:

(1) by multiplying and dividing rewrite, the equation with the x and dx factors on one side and the y and dy factors on the other side.

(2) Then integrate both sides and

(3) Include a constant of integration.

(4) Use the initial condition to evaluate the constant and

(5) Give the particular solution solved for y.

Example 1: For the very simple example we have been using the work looks like this:

Step 1 Separate the variables: dy=2xdx

Steps 2 and 3 Integrate and include the constant of integration. Note that there is a different constant on both sides, but they are immediately combined into one constant that is usually put with the x-terms: y={{x}^{2}}+C

Step 4 Use the initial condition to find C7={{4}^{2}}+C;\quad C=-9

Stem 5 Write the solution by solving for yy={{x}^{2}}-9

Example 2: An average difficulty question. Find the particular solution of the differential equation \displaystyle \frac{dy}{dx}=-\frac{x}{y} such that the point (4, –3) lies on the solution.

Step 1: ydy=-xdx

Step 2 and 3: \displaystyle \frac{1}{2}{{y}^{2}}=-\frac{1}{2}{{x}^{2}}+C  or {{y}^{2}}=-{{x}^{2}}+C.  Multiplying by 2 to simplify things, The constant in the second form is not the same as in the first. However, it is just another constant so it is okay to call it C again.

Step 4: {{(-3)}^{3}}=-{{\left( 4 \right)}^{2}}+C so C=25

Step 5: {{y}^{2}}=-{{x}^{2}}+25 and y=-\sqrt{25-{{x}^{2}}}

Since the solution must be a function it is necessary to solve for y by taking the square root of both sides. The negative sign is chosen because the initial condition requires a negative value for y. The solution is a semi-circle, the bottom half of the full circle.

Example 3: A bit more difficult, but the steps are the same. Find the particular solution of the differential equation \displaystyle \frac{dy}{dx}=\frac{y-1}{{{x}^{2}}} with the initial condition f\left( 2 \right)=0. (From the 2008 AB calculus exam question 5c.)

Step 1:\displaystyle \frac{dy}{y-1}=\frac{dx}{{{x}^{2}}}

Steps 2 and 3: \displaystyle \ln \left| y-1 \right|=-\frac{1}{x}+C

Step 4: When x = 2, y =0  so \displaystyle \ln \left| 0-1 \right|=-\frac{1}{2}+C;\quad C=\frac{1}{2}

Step 5: Solve for y: \displaystyle \ln \left| y-1 \right|=-\frac{1}{x}+\frac{1}{2}

Raise e to the power on each side to remove the natural logarithm. (Students like to call this “E-ing.”)

\displaystyle {{e}^{\ln }}^{\left| y-1 \right|}={{e}^{-\frac{1}{x}+\frac{1}{2}}}

\displaystyle \left| y-1 \right|={{e}^{-\frac{1}{x}+\frac{1}{2}}}

Near the initial point (2, 0) \left( y-1 \right)<0, so \left| y-1 \right|=-\left( y-1 \right)=1-y, so

\displaystyle 1-y={{e}^{-\frac{1}{x}+\frac{1}{2}}}

\displaystyle y=1-{{e}^{-\frac{1}{x}+\frac{1}{2}}}

The graph of the solution is the part of the graph shown below for which x>0. See note 2 below:

DEq graph

Two final notes:

  1. The business with the absolute values is important. Students seem to prefer just ignoring the absolute values, but of course you cannot do that. A similar thing occurred in example 2: since you need the square root of one side you must decide, based on the initial condition, whether to use a plus or a minus sign with the radical. Some practice with both these situations is needed.
  2. Since \left( y-1 \right)<0,\quad y<1. In order to make this so, x>0. This is the domain of the solution. Technically, the domain of the particular solution of a differential equation must be an open interval that contains the initial condition, and on which the differential equation is true. Practically, this means that the graph must go through the initial condition point but may not cross an asymptote or contain a point where the function is not defined. The solution in the example is undefined at x = 0. It approaches the y-axis as a vertical asymptote from the left and approaches the point (0,1) from the right. AP students were not required to sort all this out, but a simple graph of the solution will show what’s happening. For more on the domain (which is not really tested) click here.
  3. For you techies: The graph was made on an iPad using an app called Good Grapher Pro. This is an excellent grapher for 2D and 2D graphs that zoom easily by pinching the screen (of course).