# Optimization problem solved two ways (algebra or calculus)

## Homework Statement

A life guard sitting on a beach at point A needs to get to point B (Hasselhoff fell out his inflatable rocking chair) as soon as possible. The lifeguard (Pamela Anderson) can run (on the shore in slow-motion, like in Baywatch) at a rate of 3 m/s and can swim at a rate of 1.5 m/s. How far along the beach should the lifeguard run in slow motion?

http://img208.imageshack.us/img208/8902/beachprob1.jpg [Broken]

## Homework Equations

We have the Pythagorean Theorem, which is...

$$a^2\,+\,b^2\,=\,c^2$$

Also, distance is speed times time.

$$d\,=\,r\,*\,t$$

We also have differentiation. Specifically the power rule:

$$\frac{d}{dx}\,x^n\,=\,n\,x^{n\,-\,1},\,n\,\ne\,0$$

## The Attempt at a Solution

First, the problem requests the distance "d" needed to run (in slow-mo) along the shore to get to point B in the shortest time. So we need an equation relating that distance along the shore "d" to the total time to arrive at point B. So, this is essentially an optimization problem. The wikipedia entry is advanced, but reading the first paragraph should suffice to get an idea of what optimization is all about.

So, let's assume that the lifeguard runs a distance "d" along the shore. That makes the x-direction she must travel in the water to be "100 - d".

http://img33.imageshack.us/img33/2702/beachprob2.jpg [Broken]

Now, we need to construct the equations with which we will solve this problem.

Since we know that distance is speed multiplied by time, we can use that to get an expression for time in terms of distance.

$$d\,=\,r\,*\,t$$

$$t\,=\,\frac{d}{r}$$

The rate (or speed) is given for water and shore in the problem.

$$r_w\,=\,1.5\,\frac{m}{s}$$

$$r_s\,=\,3\,\frac{m}{s}$$

Now we use...

$$t\,=\,\frac{d}{r}$$

to get

$$t_s\,=\,\frac{d_s}{r_s}$$

The distance traveled (in slow motion) on the shore is simply "d", so...

$$t_s\,=\,\frac{d_s}{3}$$

What about the distance traveled in water? We need to use Pythagorean Theorem for that.

We'll take side a to be "100 - d" and side b to be "60" and we find the value of side c in terms of "d" traveled on shore (in slow motion).

$$a^2\,+\,b^2\,=\,c^2$$

$$\left(100\,-\,d\right)^2\,+\,\left(60\right)^2\,=\,c^2$$

$$c\,=\,\sqrt{\left(100\,-\,d\right)^2\,+\,60^2}$$

Here, c is just the distance traveled in the water. So we can plug it into here:

$$t\,=\,\frac{d}{r}$$

$$t_w\,=\,\frac{\sqrt{\left(100\,-\,d\right)^2\,+\,60^2)}}{1.5}$$

Now we have an expression for TOTAL time that it will take to get from A to B.

$$t\,=\,t_s\,+\,t_w\,=\,\frac{d}{3}\,+\,\frac{\sqrt{\left(100\,-\,d\right)^2\,+\,60^2}}{1.5}$$

Above is the formula you need to solve this problem. If you have a graphing calculator, you can plug this in and find the point where the y-coordinate (the time) is the lowest. This is where you want to find the x-value, which would be the distance "d" asked for in the problem. Here is what that plot looks like:

http://img337.imageshack.us/img337/7339/beachprob3.jpg [Broken]

The MATlab (highly suggest learning this software) code to produce that plot:

d = [0:0.001:100];
t=d/3+sqrt(60^2+(100-d).^2)/1.5;
plot(d,t);
xlabel('Distance, d [m]');
ylabel('time, t ');

So obviously, from the graph, the distance d = 65m.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
We can solve this using calculus.

Here we want to take the derivative with respect to distance of the equation we produced above.

$$t\,=\,t_s\,+\,t_w\,=\,\frac{d}{3}\,+\,\frac{\sqrt{\left(100\,-\,d\right)^2\,+\,60^2}}{1.5}$$

Let's change the d's to x's for notation simplicity's sake...

$$\frac{d}{dx}\,\left[\frac{x}{3}\,+\,\frac{\sqrt{\left(100\,-\,x\right)^2\,+\,60^2}}{1.5}\right]$$

$$\frac{d}{dx}\,\left[\frac{x}{3}\right]\,+\,\frac{d}{dx}\,\left[\frac{\sqrt{\left(100\,-\,x\right)^2\,+\,60^2}}{1.5}\right]$$

The first term is easy to differentiate...

$$\left[\frac{1}{3}\right]\,+\,\frac{d}{dx}\,\left[\frac{\sqrt{\left(100\,-\,x\right)^2\,+\,60^2}}{1.5}\right]$$

what about the second term? Let's simplify it a little first...

$$\left[\frac{1}{3}\right]\,+\,\frac{d}{dx}\,\left[\frac{2}{3}\,\sqrt{x^2\,-\,200\,x\,+\,13600}\right]$$

But a square root is really just an expression raised to the 1/2 power...

$$\left[\frac{1}{3}\right]\,+\,\frac{d}{dx}\,\left[\frac{2}{3}\,\left(x^2\,-\,200\,x\,+\,13600\right)^{\frac{1}{2}}\right]$$

Well, now we use the power rule for differentiation:

$$\frac{d}{dx}\,x^n\,=\,n\,x^{n\,-\,1},\,n\,\ne\,0$$

$$\left[\frac{1}{3}\right]\,+\,\frac{2}{3}\,\left[\left(x\,+\,100\right)\,\left(x^2\,-\,200\,x\,+\,13600\right)^{-\frac{1}{2}}\right]$$

Now we want to solve this equation for zero in order to get the place where the rate of change is zero. We want to find the zeros because that is either a high or a low, in this case a low for the amount of time it will take Pamela to reach Hasselhoff.

$$\left[\frac{1}{3}\right]\,+\,\frac{2}{3}\,\left[\left(x\,+\,100\right)\,\left(x^2\,-\,200\,x\,+\,13600\right)^{-\frac{1}{2}}\right]\,=\,0$$

$$x\,=\,65.359$$

Last edited by a moderator: