<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>thinking &#187; solution</title>
	<atom:link href="http://tylerneylon.com/b/archives/tag/solution/feed" rel="self" type="application/rss+xml" />
	<link>http://tylerneylon.com/b</link>
	<description>[life, games, movies, philosophy, math, coding, pizza, &#38;c.]</description>
	<lastBuildDate>Thu, 02 Feb 2012 22:27:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>The pirate-catching solution</title>
		<link>http://tylerneylon.com/b/archives/80</link>
		<comments>http://tylerneylon.com/b/archives/80#comments</comments>
		<pubDate>Fri, 07 May 2010 14:52:40 +0000</pubDate>
		<dc:creator>Tyler</dc:creator>
				<category><![CDATA[puzzles]]></category>
		<category><![CDATA[pirate]]></category>
		<category><![CDATA[puzzle]]></category>
		<category><![CDATA[solution]]></category>

		<guid isPermaLink="false">http://tylerneylon.com/b/?p=80</guid>
		<description><![CDATA[This is the solution for the pirate-catching puzzle I posted a few days ago. Here&#8217;s the general idea: It&#8217;s helpful to put things into a coordinate system where the starting position of the pirate ship is (0,0), and the government ship is at (3,0).  This works because we know they start 3 km apart, so [...]]]></description>
			<content:encoded><![CDATA[<p>This is the solution for <a href="http://tylerneylon.com/b/?p=78">the pirate-catching puzzle</a> I posted a few days ago.</p>
<p>Here&#8217;s the general idea:</p>
<p><a href="http://tylerneylon.com/b/wp-content/uploads/2010/05/chasing_pirates12.png"><img class="alignnone size-full wp-image-83" title="chasing_pirates1" src="http://tylerneylon.com/b/wp-content/uploads/2010/05/chasing_pirates12-e1273240921892.png" alt="" width="400" height="283" /></a></p>
<p>It&#8217;s helpful to put things into a coordinate system where the starting position of the pirate ship is (0,0), and the government ship is at (3,0).  This works because we know they start 3 km apart, so any two points at distance 3 are fine as starting points.  In the picture above, the blue line is the path of the pursuing government ship, and the red line is one possible straight line the pirates could take.</p>
<p>The strategy is in two parts:</p>
<ol>
<li>Start by travelling straight toward the pirate ship for 2 km.  If, by luck, the pirates are headed directly toward the government ship, they&#8217;ll meet at this point, since the pirates will have travelled 1 km in the same time (1 minute).</li>
<li>After that, go in an expanding spiral around the origin.  Think in polar coordinates.  You know the pirates are going directly away from (0,0) at constant speed 1 km/min, so their distance <em>r</em> from the origin is the same as the time <em>t</em> that has passed since the start.  Your ship (the government one) just needs to keep at the same radius as the pirate ship, while sweeping its angle around in a circle.  The government ship has to meet the pirate ship by the time it completes 360 degrees.</li>
</ol>
<p>This strategy is possible because the government ship is going faster than the pirates.  That gives us a general idea of how to solve the puzzle &#8211; but it&#8217;s still a little vague.  We still don&#8217;t know the <em>exact</em> spiral to take, or how long it will take at most to catch them.</p>
<p>That&#8217;s where the real fun starts.  Let&#8217;s find the spiral&#8217;s equation, using <img src='http://s.wordpress.com/latex.php?latex=%28r%2C%5Ctheta%29&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='(r,\theta)' title='(r,\theta)' class='latex' /> as the coordinates of the government ship at time <img src='http://s.wordpress.com/latex.php?latex=t&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='t' title='t' class='latex' /> (where <img src='http://s.wordpress.com/latex.php?latex=t%3D0&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='t=0' title='t=0' class='latex' /> is the instant they spotted the pirates and went for them).</p>
<p>We have two constraints:</p>
<ul>
<li><img src='http://s.wordpress.com/latex.php?latex=r%3Dt&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='r=t' title='r=t' class='latex' />, and</li>
<li>speed <img src='http://s.wordpress.com/latex.php?latex=s%3D2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='s=2' title='s=2' class='latex' />.</li>
</ul>
<p>We also know that the angle <img src='http://s.wordpress.com/latex.php?latex=%5Ctheta&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\theta' title='\theta' class='latex' /> and radius <img src='http://s.wordpress.com/latex.php?latex=r&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='r' title='r' class='latex' /> are increasing over time.  To put this all together, we can use this equation for the speed of the government ship as a derivative of time:</p>
<img src='http://s.wordpress.com/latex.php?latex=s%20%3D%20%5Csqrt%7B%28%5Cfrac%7Bdr%7D%7Bdt%7D%29%5E2%2Br%5E2%28%5Cfrac%7Bd%5Ctheta%7D%7Bdt%7D%29%5E2%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='s = \sqrt{(\frac{dr}{dt})^2+r^2(\frac{d\theta}{dt})^2}' title='s = \sqrt{(\frac{dr}{dt})^2+r^2(\frac{d\theta}{dt})^2}' class='latex' />
<p>Where did that equation come from?  Well, it&#8217;s basically the derivative (with respect to <em>t</em>) of <a href="http://tutorial.math.lamar.edu/Classes/CalcII/PolarArcLength.aspx">arc length in polar coordinates</a>.  We know <img src='http://s.wordpress.com/latex.php?latex=s%3D2&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='s=2' title='s=2' class='latex' />, so</p>
<img src='http://s.wordpress.com/latex.php?latex=%5Csqrt%7B%28%5Cfrac%7Bdr%7D%7Bdt%7D%29%5E2%2Br%5E2%28%5Cfrac%7Bd%5Ctheta%7D%7Bdt%7D%29%5E2%7D%20%3D%202&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\sqrt{(\frac{dr}{dt})^2+r^2(\frac{d\theta}{dt})^2} = 2' title='\sqrt{(\frac{dr}{dt})^2+r^2(\frac{d\theta}{dt})^2} = 2' class='latex' />
<p>We also know that <img src='http://s.wordpress.com/latex.php?latex=r%3Dt&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='r=t' title='r=t' class='latex' /> and therefore <img src='http://s.wordpress.com/latex.php?latex=%5Cfrac%7Bdr%7D%7Bdt%7D%3D1&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\frac{dr}{dt}=1' title='\frac{dr}{dt}=1' class='latex' />, so</p>
<img src='http://s.wordpress.com/latex.php?latex=%5Csqrt%7B1%2Bt%5E2%28%5Cfrac%7Bd%5Ctheta%7D%7Bdt%7D%29%5E2%7D%20%3D%202&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\sqrt{1+t^2(\frac{d\theta}{dt})^2} = 2' title='\sqrt{1+t^2(\frac{d\theta}{dt})^2} = 2' class='latex' />
<img src='http://s.wordpress.com/latex.php?latex=1%20%2B%20t%5E2%28%5Cfrac%7Bd%5Ctheta%7D%7Bdt%7D%29%5E2%20%3D%204&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='1 + t^2(\frac{d\theta}{dt})^2 = 4' title='1 + t^2(\frac{d\theta}{dt})^2 = 4' class='latex' />
<img src='http://s.wordpress.com/latex.php?latex=t%5E2%28%5Cfrac%7Bd%5Ctheta%7D%7Bdt%7D%29%5E2%20%3D%203&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='t^2(\frac{d\theta}{dt})^2 = 3' title='t^2(\frac{d\theta}{dt})^2 = 3' class='latex' />
<img src='http://s.wordpress.com/latex.php?latex=%5Cfrac%7Bd%5Ctheta%7D%7Bdt%7D%20%3D%20%5Cfrac%7B%5Csqrt%7B3%7D%7D%7Bt%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\frac{d\theta}{dt} = \frac{\sqrt{3}}{t}' title='\frac{d\theta}{dt} = \frac{\sqrt{3}}{t}' class='latex' />
<img src='http://s.wordpress.com/latex.php?latex=%5Ctheta%20%3D%20%5Csqrt%7B3%7D%5Clog%20t&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\theta = \sqrt{3}\log t' title='\theta = \sqrt{3}\log t' class='latex' />
<p>Almost got it!  Using that <img src='http://s.wordpress.com/latex.php?latex=r%3Dt&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='r=t' title='r=t' class='latex' /> again, we see that <img src='http://s.wordpress.com/latex.php?latex=%5Ctheta%20%3D%20%5Csqrt%7B3%7D%5Clog%20r&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\theta = \sqrt{3}\log r' title='\theta = \sqrt{3}\log r' class='latex' />, so solve for <img src='http://s.wordpress.com/latex.php?latex=r&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='r' title='r' class='latex' /> to get</p>
<img src='http://s.wordpress.com/latex.php?latex=r%20%3D%20e%5E%7B%5Ctheta%2F%5Csqrt%7B3%7D%7D&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='r = e^{\theta/\sqrt{3}}' title='r = e^{\theta/\sqrt{3}}' class='latex' />
<p>That&#8217;s the path of the government ship, which looks like this:</p>
<p><a href="http://tylerneylon.com/b/wp-content/uploads/2010/05/chasing_pirates2.png"><img class="alignnone size-full wp-image-84" title="chasing_pirates2" src="http://tylerneylon.com/b/wp-content/uploads/2010/05/chasing_pirates2-e1273243359962.png" alt="" width="400" height="264" /></a></p>
<p>How long does it take to traverse?  The highest the angle can get is arbitrarily close to 360 degrees.  Our equations use radians (for example, the speed equation assumes <img src='http://s.wordpress.com/latex.php?latex=%5Ctheta&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\theta' title='\theta' class='latex' /> is in radians), so we can just plug in <img src='http://s.wordpress.com/latex.php?latex=2%5Cpi&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='2\pi' title='2\pi' class='latex' /> for <img src='http://s.wordpress.com/latex.php?latex=%5Ctheta&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='\theta' title='\theta' class='latex' /> to find out the answer to our puzzle.  The longest time is exactly</p>
<p><img src='http://s.wordpress.com/latex.php?latex=e%5E%7B2%5Cpi%2F%5Csqrt%7B3%7D%7D%20%5Capprox%2037.622&#038;bg=ffffff&#038;fg=000000&#038;s=0' alt='e^{2\pi/\sqrt{3}} \approx 37.622' title='e^{2\pi/\sqrt{3}} \approx 37.622' class='latex' /> minutes.</p>
<p>As a mathematician, I think this is a great answer to such a simple-to-state problem!</p>
]]></content:encoded>
			<wfw:commentRss>http://tylerneylon.com/b/archives/80/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

