<?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>Some stuff &#187; backtracks</title>
	<atom:link href="http://blog.yhuang.org/?feed=rss2&#038;tag=backtracks" rel="self" type="application/rss+xml" />
	<link>https://blog.yhuang.org</link>
	<description>here.</description>
	<lastBuildDate>Wed, 27 Aug 2025 08:50:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
		<item>
		<title>A little Markovian problem</title>
		<link>https://blog.yhuang.org/?p=12</link>
		<comments>https://blog.yhuang.org/?p=12#comments</comments>
		<pubDate>Sun, 29 Oct 2006 20:18:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[backtracks]]></category>
		<category><![CDATA[coin]]></category>
		<category><![CDATA[digraph]]></category>
		<category><![CDATA[heads and tails]]></category>
		<category><![CDATA[hht]]></category>
		<category><![CDATA[player]]></category>
		<category><![CDATA[player player]]></category>
		<category><![CDATA[sequence context]]></category>
		<category><![CDATA[state]]></category>
		<category><![CDATA[transition]]></category>

		<guid isPermaLink="false">http://scripts.mit.edu/~zong/wpress/?p=12</guid>
		<description><![CDATA[Here it is:  A has a fair coin and B has a fair coin. They flip coins together, but only keep track of their own sequences of heads and tails. A stops if the sequence &#8220;HHT&#8221; appears. B stops if the sequence &#8220;HTH&#8221; appears. Which player is more likely to stop first? While it would [...]]]></description>
			<content:encoded><![CDATA[<p>Here it is: </p>
<blockquote><p>A has a fair coin and B has a fair coin. They flip coins together, but only keep track of their own sequences of heads and tails. A stops if the sequence &#8220;HHT&#8221; appears. B stops if the sequence &#8220;HTH&#8221; appears. Which player is more likely to stop first?</p></blockquote>
<p><span id="more-12"></span></p>
<p>While it would first appear that any 3-flip sequence is equally likely and so neither A nor B is more likely to stop before the other, this is wrong. The eight 3-flip sequences are only equally likely when taken independently of the remaining sequence context. By context, I mean there is a time origin in this problem and there is memory from the stopping 3-flip sequence that leads all the way back to it.</p>
<p>The answer is found if we draw the state diagram of the game for each player.</p>
<p>Player A<br />
<img align="bottom" alt="Input: digraph G {
graph [rankdir=LR]
{0 H HH HHT [shape=doublecircle]}
0 -&gt; H [label=H]
0 -&gt; 0 [label=T]
H -&gt; HH [label=H]
H -&gt; 0 [label=T]
HH -&gt; HH [label=H]
HH -&gt; HHT [label=T]
}" src="wp-content/cache/f151847dd4f5adb6d5a138ee4e318e12.png" /></p>
<p>Player B<br />
<img align="bottom" alt="Input: digraph G {
graph [rankdir=LR]
{0 H HT HTH [shape=doublecircle]}
0 -&gt; H [label=H]
0 -&gt; 0 [label=T]
H -&gt; H [label=H]
H -&gt; HT [label=T]
HT -&gt; HTH [label=H]
HT -&gt; 0 [label=T]
}" src="wp-content/cache/df43149372f6033610ee6b9ee0c87df5.png" /></p>
<p>They are pretty much the same, except A&#8217;s diagram has a transition that backtracks by one state where the analogous transition on B&#8217;s diagram backtracks by two. So indeed, A is more likely to stop first.</p>
<p>An interesting thing happens if we let A and B continue flipping even after they are supposed to stop. This changes the destination of one transition in each state diagram. Now the two diagrams look more similar.</p>
<p>Player A<br />
<img align="bottom" alt="Input: digraph G {
graph [rankdir=LR]
{0 H HH}
0 -&gt; H [label=H]
0 -&gt; 0 [label=T]
H -&gt; HH [label=H]
H -&gt; 0 [label=T]
HH -&gt; HH [label=H]
HH -&gt; 0 [label=T color=blue]
}" src="wp-content/cache/1f05e52fe69f93b1f3ca986f4916b9b8.png" /></p>
<p>Player B<br />
<img align="bottom" alt="Input: digraph G {
graph [rankdir=LR]
{0 H HT}
0 -&gt; H [label=H]
0 -&gt; 0 [label=T]
H -&gt; H [label=H]
H -&gt; HT [label=T]
HT -&gt; H [label=H color=blue]
HT -&gt; 0 [label=T]
}" src="wp-content/cache/2485278455bd040486cf9dd6cb8c2592.png" /></p>
<p>In fact, they are equivalent (after a rotational shift of the states). So asymptotically, the sequence &#8220;HTH&#8221; occurs just as frequently as &#8220;HHT&#8221;.</p>
<p>If we look at this a little more carefully, we find that it takes on average 8 flips to see the first &#8220;HHT&#8221; while it takes an average of 10 flips to see the first &#8220;HTH&#8221;. After that, however, both subsequences occur at a rate of every 8 flips (overlapping frames allowed), which of course makes perfect sense, since there are 8 such 3-flip sequences.</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.yhuang.org/?feed=rss2&#038;p=12</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
