Catching a Pig
Date: 05/09/97 at 07:57:08 From: Udo Guenthner Subject: When does the farmer catch the swine Hi, This question is from Martin Gardner's book: A farmer wants to catch a pig which is x meters away from him. They start running at the same time. The pig runs straight ahead, perpendicular to the line farmer-pig, at constant speed. The farmer always runs in the direction where he sees the pig (also at constant speed). If we know the speed of the farmer and the pig and the distance x between them, how long does it take the farmer to catch the pig? _ ---------------------> pig | .> farmer | . | . x . | . | . _ . The solution in Martin Gardner's book was: calculate the time when the pig runs straight up, then calculate the time when the pig runs straight down and take the average. That's it! So my question: Why is it exactly the average? What if the pig runs at an angle of 73 degrees? In other words, what is the underlying equation? I tried to solve this using differential calculus and complex numbers with no success.
Date: 05/09/97 at 11:33:18 From: Doctor Anthony Subject: Re: When does the farmer catch the swine I would prefer to use x as a variable and also to give some constant ratio for the speed of the man and the pig (say 3:1). Draw the following figure to see how I do the calculation. Let the pig start at O the origin and move along the x axis. Let the man start at point B on the y axis such that OB = b At time t the pig will have moved to the point T on the x-axis, and the man will have moved along the arc BP such that the tangent to the arc at P is directed at the point T. Let s = arc length of BP. Because of the relative speeds, the arc BP will be three times the length of OT (arc BP = 3(OT)). Draw the perpendicular PN from P to the x axis. If (x,y) are the coordinates of the man, we have NP/NT = -dy/dx since the slope of curve is given by NP/NT and the slope is negative. Then OT = ON + NT = ON + NP(NT/NP) = x - y(dx/dy) (note dx/dy not dy/dx) OT = (1/3)s = x - y(dx/dy) s = 3(x-y(dx/dy)) If we differentiate with respect to y: ds/dy = 3(dx/dy - dx/dy - y.d^2x/dy^2) = - 3y.d^2x/dy^2 But ds/dy = -sqrt(1+(dx/dy)^2), the minus being taken because y decreases as s increases. If we write q for dx/dy this gives: sqrt(1+q^2) = 3y.dq/dy dy/3y = dq/sqrt(1+q^2) Integrating (1/3)ln(ky) = sinh^(-1)(q) k is constant of integration When y = b, q = 0, so kb = 1 or k = 1/b. Therefore, q = sinh[ln(y/b)^(1/3)] sinh(x) = (e^x - e^-x)/2 2q = (y/b)^(1/3) - (y/b)^(-1/3) Since q = dx/dy a second integration gives: 2(x+c) = (3/4)b^(-1/3)y^(4/3) - (3/2)b^(1/3)y^(2/3) When x = 0, y = b, so that 2c = -(3/4)b and the equation of the curve becomes: b^(1/3)(8x-3b) = 3(y^(4/3)-2b^(2/3)*y^(2/3)) The man catches the pig when y = 0, that is when 8x-3b = 0 or x = (3/8)b If you know the actual speed of the pig, say u m/sec, then the time to catch the pig is given by (3/8)b/u (b is the initial distance they are apart). This result of course depends on the ratio of their speeds. This ratio must be greater than 1 if the man is to catch the pig at all. If the ratio is near to 1 the time will increase without limit. -Doctor Anthony, The Math Forum Check out our web site! http://mathforum.org/dr.math/
Date: 05/10/97 at 06:16:29 From: Doctor Mitteldorf Subject: Re: When does the farmer catch the swine Dear Udo, I wrote this before reading Dr. Anthony's reply. He has gotten much further with the problem than I have, but I'm sending my reply along in case you find my approach interesting as well. Does Martin Gardner tell you any more about why the answer comes out to the average of the two times (pig runs toward farmer) and (pig runs away from farmer)? It's not obvious to me why this should be so, but it's a reasonable hypothesis. I say it's reasonable because in simple cases it gives the right answer: If the farmer moves much faster than the pig, it clearly gives the right answer. If the farmer moves the same speed as the pig, then the answer comes out infinite, as it should. In problems like this, there's a brute force method and there's the "aha!" method. The brute force method always works. The aha! method can save you a lot of time if you can see through to something about the question that's being asked that makes it simpler than it at first appears. I must admit that I have yet to have my aha! experience for this puzzle, so I have approached it with brute force. The answer I get seems to confirm Gardner's averaging rule, but I can't tell you why. Incidentally, Gardner has a book of puzzles called _Aha!_ in which is included a similar problem: Four turtles begin at the corners of a square. Each turtle proceeds to walk at constant speed toward the turtle on his right. Gradually, the square twists and shrinks until the turtles meet at the center of the square. How long does it take for the turtles to meet? This puzzle has a simple answer that depends on a somewhat sophisticated insight: since the turtles are always in the shape of a square, and since each one is always walking perpendicular to the direction of his pursuer's approach, he neither hinders nor helps the pursuer in reaching him. Therefore the time to the center is the same as the time it takes one turtle to walk across a side of the square. This insight doesn't apply to the farmer and the pig, and I haven't thought of any way to make that problem simple, so I've taken the brute force approach: Let the pig start at t = 0, x = 0, y = 0 and proceed to run at speed v along the x-axis, so x = vt. Let the farmer start at t = 0, x = 0, y = -b with a constant speed w. I'll represent the x speed as x' = dx/dt and y' = dy/dt. Then we have two equations for x' and y': x'^2 + y'^2 = w^2 y'/x' = y/(vt-x) The first equation says that the vector sum of the x and y velocities has constant magnitude w, and the second equation says that the velocity of the farmer is always directed along a line from the farmer's position (x,y) to the pig's position (vt,0). Now, having taken the brute force approach and written these differential equations, I must admit further that I don't know how to solve them! So again I've taken the brute force approach and written a computer program to solve the equations numerically. The program just starts with the initial positions, calculates the x and y velocities at each step, and moves the farmer along with increments dx = x'dt and dy = y'dt in each time step dt. I think you'll be able to follow it even if you're not familiar with Pascal. I've used the variable R to mean y/(vt-x), and solved the two equations simultaneously to give: x' = w / sqrt(1+R^2) and y' = wR / sqrt(1+R^2) The program gives an answer in a fraction of a second, and to an accuracy of three decimal places it agrees with Gardner's averaging rule for the two cases I've tried (farmer runs two times pig speed and three times pig speed). Please write again if you have any more insight into this puzzle, or if there's anything else in Gardner's account of it that might help us toward an aha! -Doctor Mitteldorf, The Math Forum Check out our web site! http://mathforum.org/dr.math/
Search the Dr. Math Library:
Ask Dr. MathTM
© 1994- The Math Forum at NCTM. All rights reserved.