{"id":1052,"date":"2016-08-19T21:45:08","date_gmt":"2016-08-20T02:45:08","guid":{"rendered":"http:\/\/www.laurentlessard.com\/bookproofs\/?p=1052"},"modified":"2017-01-01T18:03:14","modified_gmt":"2017-01-02T00:03:14","slug":"can-you-outrun-the-angry-ram","status":"publish","type":"post","link":"https:\/\/laurentlessard.com\/bookproofs\/can-you-outrun-the-angry-ram\/","title":{"rendered":"Can you outrun the angry ram?"},"content":{"rendered":"<p>The <a href=\"http:\/\/fivethirtyeight.com\/features\/can-you-outrun-the-angry-ram-coming-right-for-oh-god\/\">Riddler puzzle<\/a> this week appears simple at first glance, but I promise you it&#8217;s not!<\/p>\n<blockquote><p>\nYou, a hard-driving sheep farmer, are tucked into the southeast corner of your square, fenced-in sheep paddock. There are two gates equidistant from you: one at the southwest corner and one at the northeast corner. An angry, recalcitrant ram enters the paddock from the southwest gate and charges directly at you at a constant speed. You run \u2014 obviously! \u2014 at a constant speed along the eastern fence toward the northeast gate in an attempt to escape. The ram keeps charging, always directly at you.<\/p>\n<p>How much faster than you does the ram have to run so that he catches you just as you reach the gate?\n<\/p><\/blockquote>\n<p>Here is a very simple solution by <a href=\"https:\/\/twitter.com\/HectorPefo\">Hector Pefo<\/a>. Minimal calculus required!<br \/>\n<a href=\"javascript:Solution('soln_ram2','toggle_ram2')\" id=\"toggle_ram2\">[Show Solution]<\/a><\/p>\n<div id=\"soln_ram2\" style=\"display: none\">\nSuppose the southeast corner where the farmer starts is at $(1,0)$, and the farmer moves north with unit speed. So the farmer&#8217;s position at time $t$ is $(1,t)$. Meanwhile, suppose the ram moves with speed $v$. We&#8217;d like to find $v$ such that the ram and farmer both reach the northeast gate $(1,1)$ at $t=1$. If the ram starts in the southwest corner $(0,0)$, it turns out $v$ is precisely the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Golden_ratio\">Golden Ratio<\/a>, or <b>roughly 1.618<\/b>. Suppose from now on that the ram starts at $(a,b)$ instead. We&#8217;ll derive a formula for $v$ in terms of $a$ and $b$. See below for a diagram.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2016\/08\/ram_diagram2.png\" alt=\"ram_diagram2\" width=\"1512\" height=\"964\" class=\"aligncenter size-full wp-image-1145\" srcset=\"https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2016\/08\/ram_diagram2.png 1512w, https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2016\/08\/ram_diagram2-300x191.png 300w, https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2016\/08\/ram_diagram2-768x490.png 768w, https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2016\/08\/ram_diagram2-1024x653.png 1024w, https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2016\/08\/ram_diagram2-1200x765.png 1200w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><br \/>\nSuppose the path of the ram at time $t$ makes an angle $\\alpha(t)$ with the path of the farmer. First, note that the total $y$-distance covered by the ram must be $1-b$. But we can also find this by projecting the path of the ram onto the $y$-axis. In other words:<br \/>\n\\[<br \/>\n1-b = \\int_0^1 v\\,\\cos\\alpha(t)\\,dt<br \/>\n\\]Second, change reference frame so we imagine the ram moving in a straight line, always with the farmer in its sights. One component of the farmer&#8217;s motion contributes to shrinking his distance to the ram, while the other doesn&#8217;t affect the distance. The total distance traveled by the farmer <em>in the direction of the ram<\/em> can be found by projecting the farmer&#8217;s (now curved) path onto the ram&#8217;s path. The difference in the ram&#8217;s distance $v$ and the projected distance covered by the farmer is equal to the initial distance separating them since they ultimately reach the same spot:<br \/>\n\\[<br \/>\n\\sqrt{(1-a)^2+b^2} = v-\\int_0^1\\cos\\alpha(t)\\,dt<br \/>\n\\]Even though we don&#8217;t know $\\alpha(t)$, we can substitute one equation into the other to eliminate the integral and solve for $v$! The result is the equation:<br \/>\n\\[<br \/>\nv^2-\\sqrt{(1-a)^2+b^2}\\,v-(1-b) = 0<br \/>\n\\]Solving this quadratic equation for $v$ (discard the negative solution, since the ram&#8217;s speed is positive), we obtain the solution:<br \/>\n\\[<br \/>\nv_\\text{ram}=\\frac{1}{2} \\left(\\sqrt{(1-a)^2+b^2}+\\sqrt{(1-a)^2+(2-b)^2}\\right)<br \/>\n\\]If we specialize this formula to the ram starting at the southwest gate by setting $a=b=0$, we obtain the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Golden_ratio\">Golden Ratio<\/a>:<\/p>\n<p style=\"text-align: center;\"><span style=\"background-color: #AFC8E6; padding: 20px 10px 25px 10px;\">$\\displaystyle<br \/>\n(\\text{Ram speed}) = \\frac{1+\\sqrt{5}}{2} \\approx 1.618<br \/>\n$<\/span><\/p>\n<\/div>\n<p>And here is my solution, which finds an equation for the path of the ram but requires knowledge of calculus and differential equations.<br \/>\n<a href=\"javascript:Solution('soln_ram','toggle_ram')\" id=\"toggle_ram\">[Show Solution]<\/a><\/p>\n<div id=\"soln_ram\" style=\"display: none\">\n<p>I&#8217;ll derive the equations for the pursuit curves first, and then I&#8217;ll show some pretty pictures &#8212; hang on!<\/p>\n<h3>Solution details<\/h3>\n<p>We&#8217;ll use the same coordinate setup as in the first solution, again assuming the ram starts at $(a,b)$. Suppose the ram&#8217;s position at time $t$ is $(x(t),y(t))$. From now on, we&#8217;ll simply write $x$ and $y$ to keep the notation clean. We are given two pieces of information: the ram always moves towards the farmer, and the ram&#8217;s speed is constant (let&#8217;s call it $v$). We can write these as:<br \/>\n\\[<br \/>\n\\frac{dy}{dx} = \\frac{t-y}{1-x}<br \/>\n\\qquad\\text{and}\\qquad<br \/>\nv\\, t = \\int_a^x \\sqrt{1 + \\left(\\frac{dy}{d\\xi}\\right)^2}\\,d\\xi<br \/>\n\\]The first equation forms the slope (see diagram above) while the second equation says that the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Arc_length#Finding_arc_lengths_by_integrating\">arc length<\/a> of the curve traced out by the ram should be $v$ times the distance traveled by the farmer. One might be <a href=\"http:\/\/i.giphy.com\/3ornka9rAaKRA2Rkac.gif\">tempted<\/a> to substitute and eliminate $\\frac{dy}{dx}$, but the remaining equation will still have $x,$ $y,$ and $t,$ so that doesn&#8217;t help us. Instead, isolate $t$ from the first equation and substitute it into the second equation to obtain<br \/>\n\\[<br \/>\ny+(1-x)\\frac{dy}{dx} = \\frac{1}{v}\\int_a^x \\sqrt{1 + \\left(\\frac{dy}{d\\xi}\\right)^2}\\,d\\xi<br \/>\n\\]We now have a single equation that relates $y$ and $x$ with no $t$-dependence! Differentiate both sides with respect to $x$ and let $w=\\frac{dy}{dx}$. The result is the following <a href=\"https:\/\/en.wikipedia.org\/wiki\/Separation_of_variables\">separable ordinary differential equation<\/a><br \/>\n\\[<br \/>\n(1-x)\\frac{dw}{dx} = \\frac{1}{v}\\sqrt{1+w^2}<br \/>\n\\]The general solution of this ODE has the form<br \/>\n\\[<br \/>\nw = \\frac{1}{2}\\left( C(1-x)^{-1\/v}-C^{-1}(1-x)^{1\/v}\\right)<br \/>\n\\]Where $C$ is a constant that depends on the initial condition. We can solve for $C$ using the fact that when $t=0$, we have $x=a$ and $w=b\/(a-1)$. The result is that<br \/>\n\\[<br \/>\nC=(1-a)^{-1+1\/v}\\left(-b+\\sqrt{(1-a)^2+b^2}\\right)<br \/>\n\\]Now recall that $w = \\frac{dy}{dx}$ so we can integrate once more to obtain $y$ as a function of $x$, i.e. the path of the ram. We also have the initial condition $y(a)=b$. I&#8217;ll spare you the algebra&#8230; The result is<br \/>\n\\begin{align}<br \/>\ny = b &#038;+ \\frac{1}{2}\\left[<br \/>\n\\frac{ b-\\sqrt{b^2+(1-a)^2}}{1-1\/v} \\left(\\left( \\frac{1-x}{1-a} \\right)^{1-1\/v} &#8211; 1\\right)\\right.\\\\<br \/>\n&#038;\\qquad\\qquad+\\left.\\frac{ b+\\sqrt{b^2+(1-a)^2}}{1+1\/v} \\left(\\left( \\frac{1-x}{1-a} \\right)^{1+1\/v} &#8211; 1\\right)<br \/>\n\\right]<br \/>\n\\end{align}So now we know everything! To figure out where the ram intercepts the farmer, set $x=1$ and obtain<br \/>\n\\[<br \/>\ny_\\text{final}=\\frac{-b+v\\sqrt{(1-a)^2+b^2}}{v^2-1}<br \/>\n\\]If we know that the ram barely makes it to the northeast gate $(1,1)$ on time, set $y_\\text{final}=1$ and solve for $v$. The simplified result is<br \/>\n\\[<br \/>\nv_\\text{ram}=\\frac{1}{2} \\left(\\sqrt{(1-a)^2+b^2}+\\sqrt{(1-a)^2+(2-b)^2}\\right)<br \/>\n\\]This is precisely the same result we found using the first method!<\/p>\n<h3>Cool pictures!<\/h3>\n<p>Since we have an explicit formula for $y$ in terms of $x$, we can see what the ram&#8217;s path might look like for a variety of starting points. In the figure below, the farmer moves from the southeast corner to the northeast corner at a uniform speed, and each curve is a different ram&#8217;s path that starts along the western gate. Note: each ram chases the farmer, and each has a different speed that has been tuned to meet the farmer right at the end of his run.<br \/>\n<a href=\"https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2016\/08\/ram_trajectories.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2016\/08\/ram_trajectories.png\" alt=\"ram_trajectories\" width=\"2078\" height=\"1494\" class=\"aligncenter size-full wp-image-1136\" \/><\/a><br \/>\nFinally, suppose we know the speed of the ram. What is the &#8220;safe zone&#8221; outside of which the ram can&#8217;t reach the farmer in time? If you look at the formula for $v$, you&#8217;ll notice that it&#8217;s actually the average of two distances: the initial distance between the ram and the farmer, and the initial distance between the ram and the farmer&#8217;s reflection across the north fence. So if we fix the ram&#8217;s speed, the set of starting points $(a,b)$ describes an <a href=\"https:\/\/en.wikipedia.org\/wiki\/Ellipse\">ellipse<\/a> with the farmer and his reflection as the foci! See below for an illustration of the safe zones for different ram speeds.<br \/>\n<a href=\"https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2016\/08\/ram_contours.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2016\/08\/ram_contours.png\" alt=\"ram_contours\" width=\"2190\" height=\"1578\" class=\"aligncenter size-full wp-image-1134\" \/><\/a><br \/>\nI should point out that these trajectories are known as <a href=\"http:\/\/mathworld.wolfram.com\/PursuitCurve.html\">pursuit curves<\/a>. Another notable example is circular pursuit, which was covered in a <a href=\"http:\/\/fivethirtyeight.com\/features\/will-the-dog-catch-the-duck\/\">previous Riddler problem<\/a>!<\/p>\n<h3>Infinite pursuit<\/h3>\n<p>If the ram and the farmer have identical speeds, something interesting happens&#8230; As you might imagine, the ram never catches the farmer. But it turns out that if the farmer continues forever in a straight line, the ram will end up directly behind the farmer, always a <em>constant<\/em> distance away! The equations we derived for $y$ aren&#8217;t helpful in this case, so we must return the the beginning. Rearranging the equation for the slope gives us:<br \/>\n\\[<br \/>\nt-y = (1-x)\\frac{dy}{dx}<br \/>\n\\]Now $t-y$ is precisely what we&#8217;re after; it&#8217;s the vertical distance separating the farmer from the ram. Substituting our expression for $\\frac{dy}{dx}$ into this equation and setting $v=1$, we find<br \/>\n\\begin{align}<br \/>\nt-y &#038;= (1-x)\\left( \\frac{1}{2}\\left( C(1-x)^{-1\/v}-C^{-1}(1-x)^{1\/v}\\right) \\right) \\\\<br \/>\n&#038;= \\frac{1}{2}\\left( C-C^{-1}(1-x)^{2}\\right)<br \/>\n\\end{align}And in the limit $x\\to 1$, this is simply<br \/>\n\\[<br \/>\n\\text{(limiting distance)} = \\frac{1}{2}C = \\frac{\\sqrt{(1-a)^2+b^2}-b}{2}<br \/>\n\\]So if the ram starts at $(0,0)$, the limiting distance between the farmer and ram will be $\\frac{1}{2}$. Neat! If we ask for the set of all possible starting ram locations that yield a limiting distance of $\\frac{1}{2}$, we get a different conic section: a parabola this time. Here is a plot showing the possible starting points for various limiting distances.<br \/>\n<a href=\"https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2016\/08\/ram_contours3.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/laurentlessard.com\/bookproofs\/wp-content\/uploads\/2016\/08\/ram_contours3.png\" alt=\"ram_contours3\" width=\"2166\" height=\"1478\" class=\"aligncenter size-full wp-image-1135\" \/><\/a><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>The Riddler puzzle this week appears simple at first glance, but I promise you it&#8217;s not! You, a hard-driving sheep farmer, are tucked into the southeast corner of your square, fenced-in sheep paddock. There are two gates equidistant from you: one at the southwest corner and one at the northeast corner. An angry, recalcitrant ram &hellip; <a href=\"https:\/\/laurentlessard.com\/bookproofs\/can-you-outrun-the-angry-ram\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Can you outrun the angry ram?&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[7],"tags":[28,11,2],"class_list":["post-1052","post","type-post","status-publish","format-standard","hentry","category-riddler","tag-calculus","tag-conic-sections","tag-riddler"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/posts\/1052","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/comments?post=1052"}],"version-history":[{"count":81,"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/posts\/1052\/revisions"}],"predecessor-version":[{"id":1725,"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/posts\/1052\/revisions\/1725"}],"wp:attachment":[{"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/media?parent=1052"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/categories?post=1052"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/laurentlessard.com\/bookproofs\/wp-json\/wp\/v2\/tags?post=1052"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}