In the last three posts (see Snail Problem parts 1, 2, and 3), I tackled the following problem: a snail crawls along a twig of length *L _{0}* at 1 cm/d, and the twig grows 2 cm/d. Will the snail reach the end, and when?

The answer is *yes*, and it will reach the end in

I’m interested in solving this now for the general case, leaving the twig growth and snail velocities unspecified. Fellow blogger Ken Roberts has already solved this, but I still want to try my hand at it. I’ll follow his example and use *g* for the growth rate of the twig (I’m already using *t* for time), *s* for the inherent velocity of the snail, and I’ll continue using *L _{0}* for the initial length of the twig (and

*L*for its length at any time).

The length of the twig *L* is

,

since it grows at *g* cm/d and its grown for *t* days. The velocity at any point *x* is length is the fraction of the length of the twig,

times the twig’s overall growth rate, *g*:

.

The net velocity *v* of the snail is the sum of the growth of the twig at that point (which we just calculated) and its own inherent velocity, *s*:

Of course, *v* is the derivative of the snail’s position *x* with respect to time. Remember that *L _{0}*,

*g*, and

*s*are constants.

This is a linear first-order differential equation.

The way to solve this is to multiply by the following integrating factor (see part 2 for an explanation):

I actually might prefer doing this the other way (the longer method from the previous post), since integrating inside an exponent is inconvenient. Using sum and product rules for exponents:

I got rid of the absolute value because the quantity *gt* + *L _{0}* will always be positive, since it’s the length of the twig. And more generally, we can select a quantity for the constant that would have the appropriate sign. We just need one possible solution for this integrating factor, so I’ll select the one where the constant is equal to one.

Now we take this and multiply it by our prior differential equation.

The whole point of this diversion was to get the left side of the equation into a form that is the inverse of the product rule.

Integrating both sides with respect to *t* gives

We need to set up the inverse of the chain rule.

We can multiply through by *s*/*g*, and define a new constant. Also, I’ll remove the absolute value, since I’m only interested in positive *t*.

We can find the constant by noting that when *t*=0, *x*=0:

Dividing both sides by *L _{0}* gives

Substituting this back into our equation for *x*:

Let’s combine the natural logarithms and rearrange the terms for clarity:

That’s it! Noting that the quantity *gt*+*L _{0}* represents the current twig length,

*L*, we can say that

.

In other words, at any given time, the position of the snail is equal to the ratio of the snail’s inherent velocity to the twig growth velocity times the current twig length times the natural logarithm of the ratio of the twig’s current length to its original length. Keeping it in this form, using the general case rather than *s*=1 and *g*=2, certainly makes the formula more intuitive. I’ll solve for the time it takes to reach the end of the twig in the next post.