Knowledge Node - First Order Differential Equations

return to Knowledge Node index

Separation of Variables

Differential Equations are all about continuous rates of change.  DE's are useful to describe a lot of physical phenomenon, and they're absolutely essential in every aspect of engineering.

First, a classic example that can be solved with simple calculus.

Suppose a 500 gallon tank has 100 pounds of salt dissolved in it.  A pipe feeds the tank with 10 gallons of fluid per minute.  The incoming fluid has 1/2 pound of salt in every gallon.  A second pipe allows fluid to leave the tank at a rate of 10 gallons per minute.  What is the amount of salt in the tank at any given time?  To solve this problem, we have to make one simple assumption: the tank is perfectly mixed at all times.

For salt tanks, the problem can always be setup up as the change is equal to the rate in minus the rate out.

Let's make x the amount of salt in the solution, and t be time.  x(t) will be the function of the amount of salt with respect to time.

Now the formula.  Our change in solution, dx/dt (the change in salt, divided by the change in time), is equal to the following equation.

In other words, we have 10 gallons going in with a 1/2 pound of salt in each gallon.  That means a total of 5 pounds of salt is going in per minute.  The rate that the salt is going out, is the rate that the fluid exits (10) times the total amount of salt in the tank (x) divided by the total amount of solution or volume in the tank (500).

Like earlier said, this can be solved with simple separation of variables.  The solution can be found by divide the right side over to the left and multiplying the dt to the right...

... and integrating both sides...

... to get our equation in terms of x's and t's.  c1 and c2 are constants of integration.

Since they're two unknown constants, we can get rid of one by subtracting it to the other side.  Two unknown constants added or subtracted to each other, makes a single unknown constant.

We further juggle the numbers by dividing the -50 to the right side of the equation.

Now we raise e to both sides of the equation to cancel out the natural log.

Finally, we subtract the 5, and multiply by -50.  We now how a function in the form x(t).

Unfortunately we still don't know what c is.  To solve for c, we know that at the initial time t=0, the salt tank contains 100 pounds of salt.  If we plug this number in and juggle our equation around, we can solve for our unknown constant c.

Substituting the value for c back into the equation, we have the final equation:

Plotted, this looks like the following.  Notice that the final amount slowly levels off at 250 pounds of salt.  Once again, it's a 500 gallon tank, and our input is 1/2 pounds per gallon.  This makes sense that over a long period of time, all the solution in the tank has the density 1/2 pound per gallon!

Integrating Factor

Let's solve the same problem, only this time the amount of fluid exiting is larger than the amount flowing in.  This means the amount of fluid in the tank is steadily decreasing.

The only change to our equation, is that the total volume is equal to 500-5t. For every minute that occurs, the total volume decreases by 5.

A quick aside.  The method we're going to use to solve this problem is called the integrating factor.  The common form for the integrating factor uses a different format than rate-in minus rate-out.

Add the rate-out to the other side of the equation.  There, that's the integrating factor form.  This will be apparent why in a moment.

If we multiply an arbitrary constant u to both sides, we have the following.

If we allow u to be e^P(t) (P(t) is integrated p(t)).

Then our formula looks like this.

Enough with the generic variables! Our rate in is q(t) and our rate out is x*p(t)

First we'll solve what the integrating factor is.

Since the integral of 1/t = LN t, e^LN simplifies itself out.  The LN and the e disappear!  Our integration factor is therefore:

Now, if we'll make one supposedly obvious observation.  This is where math majors really shine, they find weird stuff like this. (the dash is a derivative)

Instead of putting e^P(t) over and over, I'm going to go back to using u for the next few pictures.  Anyway, now that we have our simplification, the only thing stopping us from having an equation of x(t), is that derivative sign on the left side of the equation.

To get rid of a derivative, integrate!

The integral and derivative cancel each other out, giving a very simple left side.

Substituting the I.F. we found earlier up above back into the equation, we have the following.

Multiply the stuff on the left over to the right, and we have an equation of x(t).

Once again, we use our initial conditions to solve for the constant of integration.

And our final equation is as follows.

Note that the equation is only good in the range t=0..100.  Seeing as at t=100, 500 gallons will have drained from the tank, this makes sense.  Initially the amount of salt climbs towards 250 pounds like the previous example, but before that can happen too much water drains from the tank until there is none left.

Differential Equations

Another way to solve differential equations is using the characteristic equation.  This time we'll solve the first problem again (since it's impossible to solve the second using this method).

Once again, just showing our picture and our equation.

We're not sure what our final result is going to be, but we can guess.  It turns out that all differential equations have the following form.

Therefore, we can use that form and figure out the equation x(t)!  If we substitute this in, we have the following.  Note that we remove the 5 because it's part of the particular solution.  We're only looking at the homogenous.  (The derivative of e^rt with respect to t is re^rt.)

Now if we divide both sides of the equation by e^rt we can solve for r.

If we plug that value for r back into our guess, we have the homogenous part of our equation.

The particular is just a constant, the 5.  If it were t^n, we would have a polynomial of order A*t^0+B*t^1+...?*t^n.

We substitute this particular form of x(t) into our original equation. The derivative of a constant is zero, so the left-side of the equation is zero. 

Solving for c, we get:

Therefore the particular part of the problem is the following.

Since the solution is always of the form:

We have a solution of:

We still need to find alpha.  As twice before, we use our initial conditions to find the value of the constant.

We now have our final solution! Note that this looks exactly like the answer we got on the first problem (as we should).

Once again, here's a graph of our results.  Note, exactly the same shaped curve as before.

Laplace Transforms

The Laplace Transform converts a function f(t) into F(s).  The conversion looks like this:

Why the heck would you want to do that? Check this out.  Let's do the same problem again!  Here's our equation...

Let's take the Laplace Transform of it!

Oh look, an x(0). Let's put x(0)=100 there, just like we have for all the other problems.

Now lets solve for the Laplace part of the equation.

Now let's take the inverse Laplace Transform.  Bam! We're done! I'm pretty sure any differential equation can be solved using the Laplace Transform in just four easy steps.

And here's the exact same graph!

You'll notice that each method was shorter than the previous.  And the Laplace Transform method was the shortest of all!  Go figure that they'd teach this one last...

Clumsy Purdue Students

Alright, all that was easy! Time for some practical application!

Let's say, our tank is setup exactly like we had it before. But wait! Suppose at t=100 minutes, a clumsy Purdue student comes along, trips, and knocks a 100 pound bag of salt into the tank!  Meanwhile, another Purdue student is tinkering with the faucet providing the incoming salt, and accidentally shuts it off at t=200 minutes.  He's able to get it back on at t=300 minutes, but it oscillates between 0 and 2 pounds per gallon every ten minutes.  We can model this comical situation with the following equation.

Phew! Nasty sucker.  The Dirac delta function looks like a spike, that's used for when the bag of salt falls into the tank.  The Heaviside functions are step functions, equal to zero until the step and then one.  To solve this monster, we take the Laplace Transform of the whole thing...

Substitute x(0)=100 (our initial conditions) in...

Solve the equation for the Laplace of x(t)...

And take the inverse Laplace Transform! Bam! We're done! Here is our final solution below.  All I gotta say is, thank God for math programs! Yeah, I could do this by hand, but it'd take upwards of an hour.

Here is that baby plotted.  At t=100 minutes there's a sudden jump in the amount of salt.  Notice that the amount of salt jumps to above 250 pounds, the equilibrium amount.  So instead of the amount climbing, it slowly decreases towards 250 pounds.  At t=200 minutes the salt gets shut off completely, and pure water floods the tank.  The amount of salt drops dramatically, until it gets turned back on at t=300 minutes.  Since it oscillates between 0 and 2 pounds per gallon, it averages off at the mean value, 1 pound per gallon.  Since it's a 500 gallon tank, it averages out to around 500 pounds of salt.

Talk about insanity.  Darn those Purdue students!

just curious... added 5/4/04

Some interesting references:

return to Knowledge Node index


return to the main page