<?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>João Ferreira &#187; Science</title>
	<atom:link href="http://www.joaoff.com/category/science/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.joaoff.com</link>
	<description>Programming, Algorithms, and Mathematics</description>
	<lastBuildDate>Wed, 09 Jun 2010 10:41:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Probabilities in Proofreading</title>
		<link>http://www.joaoff.com/2009/09/14/probabilities-in-proofreading/</link>
		<comments>http://www.joaoff.com/2009/09/14/probabilities-in-proofreading/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 14:04:36 +0000</pubDate>
		<dc:creator>jff</dc:creator>
				<category><![CDATA[Algorithms]]></category>
		<category><![CDATA[Computing Science]]></category>
		<category><![CDATA[Education]]></category>
		<category><![CDATA[Mathematics]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Science]]></category>
		<category><![CDATA[calculational]]></category>
		<category><![CDATA[polya]]></category>
		<category><![CDATA[probabilities]]></category>
		<category><![CDATA[probability]]></category>
		<category><![CDATA[proof]]></category>
		<category><![CDATA[proofreading]]></category>
		<category><![CDATA[proofs]]></category>

		<guid isPermaLink="false">http://www.joaoff.com/?p=267</guid>
		<description><![CDATA[Suppose you write a program and you send the source code to two of your friends, and . Your two friends read the code and when they finish, A errors are detected by , B errors are detected by , and C errors are detected by both. So, in total, A+B-C errors are detected and [...]]]></description>
			<content:encoded><![CDATA[<p>Suppose you write a program and you send the source code to two of your friends, <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/c9f921b61d2fff93afaa651d353c1795.png' title="LaTeX Formula" alt="LaTeX Formula" /> and <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/42cf2846c21109921b17709ef41d2489.png' title="LaTeX Formula" alt="LaTeX Formula" />. Your two friends read the code and when they finish, <em>A</em> errors are detected by <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/c9f921b61d2fff93afaa651d353c1795.png' title="LaTeX Formula" alt="LaTeX Formula" />, <em>B</em> errors are detected by <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/42cf2846c21109921b17709ef41d2489.png' title="LaTeX Formula" alt="LaTeX Formula" />, and <em>C</em> errors are detected by both. So, in total, <em>A+B-C</em> errors are detected and can now be eliminated. We wish to <em>estimate</em> the number of errors that remain unnoticed and uncorrected.</p>
<p>The original version of this problem concerns manuscripts and proofreaders, instead of source code and programmers. It was posed and solved by George Polya and published in 1976 on <a href="http://www.maa.org/pubs/monthly.html" title="The American Mathematical Monthly Journal">The American Mathematical Monthly</a> under the name of <em>Probabilities in Proofreading</em>. Because the problem is interesting and Polya&#8217;s solution is short and elegant, I have decided to record and share it. Also, since code sharing and reading is a frequent activity in the software development world, estimating the desired value can be helpful for some readers of this blog.</p>
<h3>Estimating the number of unnoticed errors</h3>
<p>Let <em>E</em> be the number of all errors, noticed and unnoticed, in the source code. Our goal is to estimate the value of <em>E-(A+B-C)</em>. Let <em>p</em> be the probability that friend <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/c9f921b61d2fff93afaa651d353c1795.png' title="LaTeX Formula" alt="LaTeX Formula" /> notices any given error and <em>q</em> the analogous probability for friend <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/42cf2846c21109921b17709ef41d2489.png' title="LaTeX Formula" alt="LaTeX Formula" />. The expected number of errors that may be detected by <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/c9f921b61d2fff93afaa651d353c1795.png' title="LaTeX Formula" alt="LaTeX Formula" /> is <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/8cc3bbe573866e221e7058d5c94f4d29.png' title="LaTeX Formula" alt="LaTeX Formula" /> and by <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/42cf2846c21109921b17709ef41d2489.png' title="LaTeX Formula" alt="LaTeX Formula" /> is <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/7056be452630dd69988efc1014cb132a.png' title="LaTeX Formula" alt="LaTeX Formula" />. Assuming that these probabilities are independent, the expected number of errors that may be mutually detected by both friends is <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/11091e85ba69d9e4f9df5448109fab45.png' title="LaTeX Formula" alt="LaTeX Formula" />.</p>
<p>Because we are interested in an <em>estimate</em>, we can safely assume that the expected numbers are approximately equal to the number of errors detected, that is, <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/f6b99c84e75877cc3b7a90c154ac13d5.png' title="LaTeX Formula" alt="LaTeX Formula" />, <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/7f97b9bcffe46f8d265985d6c19c88c7.png' title="LaTeX Formula" alt="LaTeX Formula" />, and <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/2c4ca7fc8699851220220bd5da2ff535.png' title="LaTeX Formula" alt="LaTeX Formula" />. (We use the notation <img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/39336a2ffd276833bc2af414ed460bfa.png' title="LaTeX Formula" alt="LaTeX Formula" /> to denote that two numbers are approximately equal.)</p>
<p>We now have all the ingredients to conclude the solution. Recall that our goal is to estimate the value of <em>E-(A+B-C)</em>. We calculate:</p>
<p><img class="lateximg" src='http://www.joaoferreira.org/wp-content/plugins/wp-latexrenderer/pictures/d5bab5f3311a1d1c63abbb8274ac53ac.png' title="LaTeX Formula" alt="LaTeX Formula" /></p>
<p>This is the desired estimate!</p>
<p style="margin-top: 10px;"><strong>Related Articles:</strong></p><ul><li><a href="http://www.joaoff.com/2008/05/09/multiples-in-the-fibonacci-series/" rel="bookmark">Multiples in the Fibonacci series</a></li><li><a href="http://www.joaoff.com/2008/02/11/direct-proofs/" rel="bookmark">Calculational proofs are usually direct</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.joaoff.com/2009/09/14/probabilities-in-proofreading/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Sir Tony Hoare on the future of Computing Science</title>
		<link>http://www.joaoff.com/2009/04/30/sir-tony-hoare-on-the-future-of-computing-science/</link>
		<comments>http://www.joaoff.com/2009/04/30/sir-tony-hoare-on-the-future-of-computing-science/#comments</comments>
		<pubDate>Thu, 30 Apr 2009 17:13:39 +0000</pubDate>
		<dc:creator>jff</dc:creator>
				<category><![CDATA[Algorithms]]></category>
		<category><![CDATA[Computing Science]]></category>
		<category><![CDATA[Methodology]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Science]]></category>
		<category><![CDATA[computing]]></category>
		<category><![CDATA[correctness]]></category>
		<category><![CDATA[future]]></category>
		<category><![CDATA[hoare]]></category>
		<category><![CDATA[quotes]]></category>

		<guid isPermaLink="false">http://www.joaoff.com/?p=100</guid>
		<description><![CDATA[Sir Tony Hoare on the future of Computing Science (CACM, March 2009): I expect the future to be as wonderful as the past has been. There&#8217;s still an enormous amount of interesting work to do. As far as the fundamental science is concerned, we still certainly do not know how to prove programs correct. We [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://en.wikipedia.org/wiki/C._A._R._Hoare">Sir Tony Hoare</a> on the future of Computing Science (<a href="http://cacm.acm.org">CACM</a>, March 2009):</p>
<blockquote><p>I expect the future to be as wonderful as the past has been. There&#8217;s still an enormous amount of interesting work to do. As far as the fundamental science is concerned, we still certainly do not know how to prove programs correct. We need a lot of steady progress in this area, which one can foresee, and a lot of breakthroughs where people suddenly find there&#8217;s a simple way to do something that everybody hitherto has thought to be far too difficult.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.joaoff.com/2009/04/30/sir-tony-hoare-on-the-future-of-computing-science/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
