I had a similar problem in my calc class.
A passenger on a cruise ship located 5 miles from shore at point A needs to travel to point B located 30 miles down the coast from point O. He can take a water taxi to any point P on shore, then travel by land taxi from P to B. If the water taxi charges $10 per mile and the land taxi charges $6 per mile, write a cost function for the trip, then find the value of x that minimizes the cost of the trip.
Basically you have two triangles
You are at this point in the ocean (point A)
..|\
..|.\\
..|..\.\ The distance to the shore is going to be the hypotenuse and will be in between straight down and straight to the destination
5|...\...\
..|....\....\
..|.....\.....\
..|.......\.....\
..|_____\___\your destination is at this corner (Point B)
..<--x-><30-x> the left corner is Point O and where ever x is will be Point P
..<----30----->
You also have three options.
1) You can go straight down 5 miles by boat then to the right 30 by taxi
2) You can go straight to the point by boat using the hypotenuse
3) you can go at an angle to land which will be longer than 5 by boat and then go less than 30 to the right by taxi
the formula for the cost is going to be C= 10(distance in the water) + 6(distance on land)
then find the minimum by finding and using critical points then verifying that they are indeed a minimum
I have to go to work but see if you can fill in the blanks or if someone else can help out.