# Lagrange multipliers word problem

How do i approach this word problem?

Say that you are in a pirate ship that is traveling along a curved river (which roughly follows the equation $y_1=x_1(sin(x_1)+1)$) as you travel from the south-west and you head to the north-east (from $-\infty<x_1<\infty$). The cannons out of the side of your ship can only fire perpendicular to the direction that the ship is pointing. Ahead, you see a castle tower (the outer walls of the castle are given by the parametric equation $(x_2,y_2)=(cos(t)-1,sin(t)+3)$ or the implicit equation $(y_2-3)^2+(x_2+1)^2=1$). As you float down the river you know that you might only get a few chances to fire on the castle and you want to do that from the closest possible points. The object of this problem is to find those points where you should fire on the tower.

Determine the points as you pass along the river where you will get the best shot on the castle tower. Do this by minimizing the equation of the distance between a point on the river and a point on the castle tower subject to the constraint that the slope of the line between the points must be perpendicular to the river. Make clear what function you are trying to minimize and what your constraint equation is.

Also, determine the points along the curve following the river and the points on the castle tower that you will hit. Determine if your points are maxima or minima and pick out the ones that minimize the distance.

-
I'd take everything that comes from an author or instructor who writes "minimizing the equation of the distance" with a grain of salt. It's the distance that's to be minimized, not the equation. –  joriki Nov 4 '12 at 14:07
Also, there's no need for minimization here; the line of fire has to be perpendicular to both curves, and you can determine the points from that requirement alone. –  joriki Nov 4 '12 at 14:09
Note that if you write out function names like $\cos$ and $\sin$ in letters as you've done here, they get interpreted as juxtaposed variable names and are italicized and spaced accordingly. To get the right formatting, you need to use the predefined commands \cos, \sin etc., or, if you need a name for which there's no predefined command, use \operatorname{name}. –  joriki Nov 4 '12 at 14:11
Also it's not the slope of the line that's perpendicular to the river, but the line itself. –  joriki Nov 4 '12 at 14:39
@joriki Thanks again. Also, how would i solve this using Lagrange multipliers? –  user48146 Nov 4 '12 at 15:51

The tangent vectors of the river and the wall are $(1,x_1\cos x_1+\sin x_1)$ and $(-\sin t,\cos t)$, respectively, and the direction of fire is $(x_1-\cos t+1,x_1(\sin x_1+1)-\sin t-3)$. Thus the conditions that the direction is perpendicular to both tangents are

$$x_1-\cos t+1+(x_1(\sin x_1+1)-\sin t-3)(x_1\cos x_1+\sin x_1)=0$$

and

$$-(x_1-\cos t+1)\sin t+(x_1(\sin x_1+1)-\sin t-3)\cos t=0\;.$$

Eliminating $x_1-\cos t+1$ and dividing through by $x_1(\sin x_1+1)-\sin t-3$ yields

$$(x_1\cos x_1+\sin x_1)\sin t+\cos t=0\;,$$

which could also be derived as the condition that the tangents are colinear. Using this in the first equation simplifies it to

$$x_1+1+(x_1(\sin x_1+1)-3)(x_1\cos x_1+\sin x_1)=0\;.$$

This is a transcendental equation for $x_1$ that you can solve numerically. What a terrible, terrible problem to pose.

-
Thank you so much but i have a question, how did you come up with direction of fire? –  user48146 Nov 4 '12 at 14:57
Strange, it seems you already deleted your account again. Anyway, the direction of fire is just the difference between the two positions. –  joriki Nov 5 '12 at 5:59