<?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>mathemagicio.us &#187; Math</title>
	<atom:link href="http://mathemagicio.us/tag/math/feed/" rel="self" type="application/rss+xml" />
	<link>http://mathemagicio.us</link>
	<description>Ramblings and musings about math, science and truth</description>
	<lastBuildDate>Wed, 14 Oct 2009 01:02:47 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>A plea for notational common sense</title>
		<link>http://mathemagicio.us/2009/10/13/a-plea-for-notational-common-sense/</link>
		<comments>http://mathemagicio.us/2009/10/13/a-plea-for-notational-common-sense/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 01:02:47 +0000</pubDate>
		<dc:creator>Mark Przepiora</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[CS]]></category>
		<category><![CDATA[Math]]></category>

		<guid isPermaLink="false">http://mathemagicio.us/?p=585</guid>
		<description><![CDATA[Tradition can often be a retarding force in mathematics. Advancements in logic were held back by centuries due to a collective belief that Aristotle had it all figured out and there was nothing left to discover. Non-Euclidean geometry wasn&#8217;t seriously studied until the 1800s because no one could think of the parallel postulate being false.
We [...]]]></description>
			<content:encoded><![CDATA[<p>Tradition can often be a retarding force in mathematics. Advancements in logic were held back by <em>centuries</em> due to a collective belief that Aristotle had it all figured out and there was nothing left to discover. Non-Euclidean geometry wasn&#8217;t seriously studied until the 1800s because no one could think of the parallel postulate being false.</p>
<p>We nowadays tend to recognize the dangers of blindly following tradition, yet in virtually all areas of mathematics we continue to adhere to notational lunacy, and pass it on to future generations starting as early as in junior high school.</p>
<p>This lunacy is so deeply ingrained in our minds that we see nothing wrong with the following expression:</p>
<p style="text-align: center;"><img src='/wp-content/plugins/latexrender/pictures/a9da9b7a8748bc7e5a54805ffc7a30e3_3.5pt.png' title='\sin(f(x)^2)' alt='\sin(f(x)^2)'  style="vertical-align:-3.5pt;" ></p>
<p>Let&#8217;s decipher the above. We start with a number <em>x</em>, apply <em>f</em>, square the result, and finally apply <em>sin</em>. Yet how do we recover this order of operations from the symbols above? Starting at <em>x</em> in the middle we move left to <em>f</em>, right to the <img src='/wp-content/plugins/latexrender/pictures/51bb910207e57c5f8062d01966d7a221_1.0pt.png' title='\bullet^2 ' alt='\bullet^2 '  style="vertical-align:-1.0pt;" >, and far left to the <em>sin</em>.</p>
<p>Although we read and write left-to-right, and so naturally imagine time evolving in this direction, the notation <em>f(x)</em> (due to Euler) means the opposite: start with <em>x</em>, then apply <em>f</em>. Even worse is when we have an expression like <em>f(g(h(x)))</em>. The very first operation is written on the very right, and the final operation is written on the very left, in complete contrast to how we normally think.</p>
<p>Worse still is that we do read <em>some</em> operations left-to-right, like raising to a power, and so we end up mentally zig-zagging across mathematical writing to even decipher mathematical expressions.</p>
<p>But worst of all is the following: when we write a function <img src='/wp-content/plugins/latexrender/pictures/e0fcfcf1bc30612af09825187fbbad7d_2.94444pt.png' title='f:A\to B' alt='f:A\to B'  style="vertical-align:-2.94444pt;" >, <em>A</em> denotes the input domain, and <em>B</em> denotes the output domain: input on the left, output on the right. As we&#8217;d expect in a sane world. If we also have a function <img src='/wp-content/plugins/latexrender/pictures/f54369708b7c914b474a63972dc1f05a_2.94444pt.png' title='g:B\to C' alt='g:B\to C'  style="vertical-align:-2.94444pt;" >, this left-to-right notation suggests we should be able to follow the arrows (<em>A</em> to <em>B</em> to <em>C</em>) to compose <em>f</em> and <em>g</em>. Yet, of course, the composite is called <em>gf</em> rather than <em>fg</em>. When reading <em>gf</em> we are meant to mentally reverse the direction of the arrows, so that <img src='/wp-content/plugins/latexrender/pictures/e4e23d429467d6664f8498cc5566b38a_2.94444pt.png' title='g:C\gets B' alt='g:C\gets B'  style="vertical-align:-2.94444pt;" > and <img src='/wp-content/plugins/latexrender/pictures/898cb53cb1c1b732b75ed411ece724e8_2.94444pt.png' title='f:B\gets A' alt='f:B\gets A'  style="vertical-align:-2.94444pt;" >, although we never write this way!</p>
<p>This is psychotic behaviour, and we should put a stop to it. I suggest we forget tradition, and instead succumb to notational common sense to write expressions like <em>x.f.g</em> rather than <em>g(f(x))</em>.</p>
<p>This may seem bizarre at first, but at least one group of scientists adopted this notation years ago. In object-oriented programming languages a mental shift is required, where one stops thinking that <em>functions have certain inputs</em>, and instead starts to see that <em>inputs have certain functions</em>. In doing so, the left-to-right notation becomes completely natural, and we would write <code>deck.sort.pop</code> to sort a deck of cards and remove the last one, rather than <code>pop(sort(deck))</code> as we&#8217;d expect in the mathematicians&#8217; ridiculous notation.</p>
<p>I believe that a notational shift would make all of our lives easier in the long run, but of course it will likely never happen. Just as negative charge will always correspond to an excess of electrons, Euler&#8217;s notation is an unfortunate convention that is simply known by too many people. As a result, already-difficult subjects like category theory are made even more maddening for silly reasons, and high school students have far more difficulty learning precalculus than they should.</p>
<p>Help us, Barack Obama, we need Change.</p>
]]></content:encoded>
			<wfw:commentRss>http://mathemagicio.us/2009/10/13/a-plea-for-notational-common-sense/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Twenty questions, in the degenerate case when 20 = lg(n)</title>
		<link>http://mathemagicio.us/2009/08/03/twenty-questions-in-the-degenerate-case-when-20-lgn/</link>
		<comments>http://mathemagicio.us/2009/08/03/twenty-questions-in-the-degenerate-case-when-20-lgn/#comments</comments>
		<pubDate>Tue, 04 Aug 2009 03:40:35 +0000</pubDate>
		<dc:creator>Mark Przepiora</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Complexity]]></category>
		<category><![CDATA[CS]]></category>
		<category><![CDATA[Math]]></category>

		<guid isPermaLink="false">http://mathemagicio.us/?p=554</guid>
		<description><![CDATA[A new post at Computational Complexity asks the following question:
(Problem 1.) You are trying to determine a secret integer x between 1 and n inclusive, using only queries of the form &#8220;is x = a (mod b)?&#8221; for integers a and b of your choosing. How many queries are required to determine x in the [...]]]></description>
			<content:encoded><![CDATA[<p>A new <a href="http://blog.computationalcomplexity.org/2009/08/find-number-again.html">post at Computational Complexity</a> asks the following question:</p>
<p style="padding-left: 30px; ">(Problem 1.) You are trying to determine a secret integer <em>x</em> between 1 and <em>n </em>inclusive, using only queries of the form &#8220;is x = <em>a</em> (mod <em>b</em>)?&#8221; for integers <em>a</em> and <em>b</em> of your choosing. How many queries are required to determine <em>x</em> in the worst case?</p>
<p>And more restrictively,</p>
<p style="padding-left: 30px; ">(Problem 2.) Same as above but you are only allowed to make queries where <em>b</em> is prime.</p>
<p>The comments section seems to reveal at least a partial solution, but these are fun problems, so at least give them a shot before reading the solution there (or here.) If you&#8217;d like the solution spoiled anyway, read on!<span id="more-554"></span></p>
<p>First let&#8217;s talk about a problem that has a more intuitive solution. Namely, the same problem of finding an integer between 1 and <em>n</em>, but where we are allowed to ask questions of the form &#8220;is x <em>≤</em> a?&#8221; for our choice of integers <em>a</em>.</p>
<p>Computer scientists in the audience should recognize the solution: first, find out about the midpoint. That is, whether <em>x</em> ≤ <em>n</em>/2. Whatever the answer is, we split the search space in half! That is, we originally knew that <em>x</em> must be one of <em>n</em> values. After the first query, we know that <em>x</em> must be one of <em>n</em>/2 values: either 1 ≤ x ≤ n/2 or n/2 &lt; x ≤ n. Either way, we can simply repeat the process again! After the second query, we know it must be one of <em>n</em>/4 values. And so on. For example, for 1 ≤ <em>x</em> ≤ 8, the following sequence of questions would reveal that the answer is <em>x</em> = 3.</p>
<p style="text-align: center; "><img class="aligncenter size-medium wp-image-555" title="Binary search" src="http://mathemagicio.us/wp-content/uploads/2009/08/binary-search-300x285.gif" alt="Binary search" width="240" height="228" /></p>
<p>It should be easy to convince yourself of the fact that you can only make these divisions lg(<em>n</em>) (that&#8217;s log-base-2*) times before you determine <em>x</em>.</p>
<p>Furthermore, this is the best we can do: any algorithm that finds <em>x</em> using only true/false queries requires at least lg(<em>n</em>) queries in the worst case. Why? Essentially, because this is how many bits there are in the binary expansion of <em>x</em>. Take <em>n</em> = 8 for example. If you could determine any 1 ≤ <em>x ≤ 8</em> using only two queries in the worst case, then any such <em>x</em> could be written uniquely using only 2 bits, which is impossible.</p>
<p>But let&#8217;s go back to Problem 1. Notice that the above argument applies for <em>any</em> algorithm that may only make queries about <em>x</em> whose answers are boolean. So we may immediately say that <em>at least</em> lg(<em>n</em>) queries are required by any algorithm that solves it.</p>
<p>However, is the answer again <em>exactly</em> lg(<em>n</em>)? Our binary search problem had the &#8220;nice&#8221; property that no matter what the answer to our previous query was, we could always construct <em>another</em> query that cut the search space in half <em>again</em>. Any boolean query may be thought of as a filter that eliminates a certain portion of the search space (which here is simply the set {1, 2, &#8230;, n}.) But not all queries may have this nice property. For example, if we were only allowed to ask questions of the form &#8220;is <em>x</em> = <em>a</em>?&#8221; then we would need to ask <em>n &#8211; 1</em> questions in the worst case—because no matter in what order we guess numbers, our first <em>n &#8211; 1</em> guesses could be wrong.</p>
<p>It turns out that the queries in Problem 1 do indeed have this nice property. The algorithm works like so:</p>
<ol>
<li>Ask whether <em>x</em> = 0 (mod 2). Doing so cuts the search space in half.</li>
<li>If the answer above was Yes, then ask whether <em>x</em> = 0 (mod 4). Since the previous answer was Yes, it must be the case that either <em>x</em> = 0 (mod 4) or <em>x</em> = 2 (mod 4), and the answer to this query again cuts the search space in half.</li>
<li>If the answer above was No, then ask whether <em>x</em> = 1 (mod 4). From the same reasoning as above, we again cut the search space in half.</li>
<li>Repeat the process using mod 8, 16, 32, etc., crafting the appropriate query.</li>
</ol>
<p>It shouldn&#8217;t be too hard to find the correct question to ask in each case. As an example,</p>
<p style="text-align: center; "><img class="aligncenter size-medium wp-image-557" title="Problem 1 solution example" src="http://mathemagicio.us/wp-content/uploads/2009/08/amodb-300x285.png" alt="Problem 1 solution example" width="240" height="228" /></p>
<p style="text-align: center;">
<p>This process can always be completed in lg(<em>n</em>) queries, which is the answer to Problem 1.</p>
<p>Note, however, that we always use a modulus of the form <img src='/wp-content/plugins/latexrender/pictures/fe401f62231ac24e3399751a415a4eaa_1.0pt.png' title='2^k' alt='2^k'  style="vertical-align:-1.0pt;" >, so this solution doesn&#8217;t help us solve Problem 2, where the modulus must always be prime! Don&#8217;t panic; I will discuss a solution to this problem in my next blog post.</p>
<p>* Here I&#8217;m assuming that <em>n</em> is a power of 2 to make the formula simpler, but if it isn&#8217;t then the correct answer is simply the <em>ceiling</em> of lg(<em>n</em>). That is, round lg(<em>n</em>) up. In fact, whenever I write lg(<em>n</em>) you can assume this is what I mean.</p>
]]></content:encoded>
			<wfw:commentRss>http://mathemagicio.us/2009/08/03/twenty-questions-in-the-degenerate-case-when-20-lgn/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Fresnel integral</title>
		<link>http://mathemagicio.us/2009/07/29/the-fresnel-integral/</link>
		<comments>http://mathemagicio.us/2009/07/29/the-fresnel-integral/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 16:39:50 +0000</pubDate>
		<dc:creator>Mark Przepiora</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Math]]></category>

		<guid isPermaLink="false">http://mathemagicio.us/?p=505</guid>
		<description><![CDATA[Here&#8217;s a deceptively simple-looking integral:
.
At first glance, it&#8217;s not even obvious whether the above converges.
On the other hand, it is easy to see that  does not exist (at least not in in the traditional sense) and is analogous to the alternating sequence { 1, -1, 1, -1, &#8230; }. But what of squaring the x? [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a deceptively simple-looking integral:</p>
<p style="padding-left: 30px;"><img src='/wp-content/plugins/latexrender/pictures/4f42934a90d5ff364d575cd2858d5f03_4.5556pt.png' title='\int_0^{\infty} sin(x^2)dx' alt='\int_0^{\infty} sin(x^2)dx'  style="vertical-align:-4.5556pt;" >.</p>
<p>At first glance, it&#8217;s not even obvious whether the above converges.</p>
<p>On the other hand, it is easy to see that <img src='/wp-content/plugins/latexrender/pictures/6eb6ca639eadabe95c02cb991bee1569_4.5556pt.png' title='\int_0^{\infty} sin(x)dx' alt='\int_0^{\infty} sin(x)dx'  style="vertical-align:-4.5556pt;" > does not exist (at least not in in the traditional sense) and is analogous to the alternating sequence { 1, -1, 1, -1, &#8230; }. But what of squaring the <em>x</em>? The function <img src='/wp-content/plugins/latexrender/pictures/b93efbe271528375e2f5c06c8bf87b24_3.5pt.png' title='sin(x^2)' alt='sin(x^2)'  style="vertical-align:-3.5pt;" > alternates between positive and negative as well, so one might be tempted to say that its integral also diverges.</p>
<p>But before jumping to conclusions, let&#8217;s take a look at its graph:</p>
<p><img class="aligncenter size-full wp-image-510" title="sin(x^2)" src="http://mathemagicio.us/wp-content/uploads/2009/07/msp719196g71dgh20bcf8e0000674e64fhe257033g.gif" alt="sin(x^2)" width="300" height="179" /></p>
<p><span id="more-505"></span>As <em>x</em> increases, the areas under the positive and negative parts of the curve become smaller and smaller. The question is, do the areas become small <em>fast enough</em> for the integral to converge? The answer turns out to be yes, but proving so (and evaluating its value) turns out to be less straight-forward than the problem seems.</p>
<p>To prove convergence, we can show that <img src='/wp-content/plugins/latexrender/pictures/96e357b83338f89b0898ba2f6dc501d6_4.5556pt.png' title='\int_1^{\infty} sin(x^2)dx' alt='\int_1^{\infty} sin(x^2)dx'  style="vertical-align:-4.5556pt;" > converges. By substituting <img src='/wp-content/plugins/latexrender/pictures/895eb82beb5dd5830d1e5fdd599086d6_1.0pt.png' title='u=x^2' alt='u=x^2'  style="vertical-align:-1.0pt;" > the integral becomes <img src='/wp-content/plugins/latexrender/pictures/eb89883afe0d5cb6f6c001f0501c87f1_6.43994pt.png' title='\frac{1}{2}\int_1^{\infty} \frac{sin(u)}{\sqrt u} du' alt='\frac{1}{2}\int_1^{\infty} \frac{sin(u)}{\sqrt u} du'  style="vertical-align:-6.43994pt;" >, and integrating by parts (ignoring the constant factor of 1/2) yields</p>
<p style="padding-left: 30px;"><img src='/wp-content/plugins/latexrender/pictures/d978436a74e26d0621705089f4090d25_4.5556pt.png' title='-[cos(u)u^{-1/2}]^{\infty}_1 + \frac{1}{2}\int_1^{\infty} cos(u)u^{-3/2}' alt='-[cos(u)u^{-1/2}]^{\infty}_1 + \frac{1}{2}\int_1^{\infty} cos(u)u^{-3/2}'  style="vertical-align:-4.5556pt;" ></p>
<p>It&#8217;s easy to see that the left term vanishes at infinity, so we need only worry about the integral in the right term. But this converges as well—in fact, absolutely, because</p>
<p style="padding-left: 30px;"><img src='/wp-content/plugins/latexrender/pictures/f5f82457e30fc54c6ed174ee80ed0a99_4.5556pt.png' title='\int_1^{\infty} |cos(u)|u^{-3/2}\le\int_1^{\infty} u^{-3/2}' alt='\int_1^{\infty} |cos(u)|u^{-3/2}\le\int_1^{\infty} u^{-3/2}'  style="vertical-align:-4.5556pt;" ></p>
<p>where the right-hand side converges by the &#8220;p-test.&#8221;</p>
<p>So we&#8217;ve proved that the bugger converges, but what about <em>evaluating it</em>?</p>
<p>This also turns out to be more difficult than it has any right to be. The antiderivative of <img src='/wp-content/plugins/latexrender/pictures/b93efbe271528375e2f5c06c8bf87b24_3.5pt.png' title='sin(x^2)' alt='sin(x^2)'  style="vertical-align:-3.5pt;" > doesn&#8217;t have any nice, closed form. The standard method for evaluating it involves observing that <img src='/wp-content/plugins/latexrender/pictures/3b84c2f270789af0efbcb80537b2e008_3.5pt.png' title='e^{iz^2} = \cos(z^2) + i\sin(z^2)' alt='e^{iz^2} = \cos(z^2) + i\sin(z^2)'  style="vertical-align:-3.5pt;" > and considering the contour integral of <em>this</em> function around a pizza slice-shaped region in the complex plane which includes a line on the positive x-axis.</p>
<p><img class="aligncenter size-full wp-image-524" title="Pizza slice contour" src="http://mathemagicio.us/wp-content/uploads/2009/07/250px-fresnel_integral_contoursvg.png" alt="Pizza slice contour" width="250" height="175" />(Image stolen from the <a href="http://en.wikipedia.org/wiki/Fresnel_integral">Wikipedia entry</a>.)</p>
<p>As the radius <em>R</em> of the pizza slice goes to infinity, evaluating the line integral of <img src='/wp-content/plugins/latexrender/pictures/837dee47aecdaf2f1e53857d7ee2ecc0_1.0pt.png' title='e^{iz^2}' alt='e^{iz^2}'  style="vertical-align:-1.0pt;" > along γ<sub>1</sub> and taking its imaginary part would give us the value of the integral we want. Unfortunately, this integral is no easier to evaluate directly. However, <img src='/wp-content/plugins/latexrender/pictures/837dee47aecdaf2f1e53857d7ee2ecc0_1.0pt.png' title='e^{iz^2}' alt='e^{iz^2}'  style="vertical-align:-1.0pt;" > has no singularities, so by the <a href="http://en.wikipedia.org/wiki/Residue_theorem">residue theorem</a> its path integral all the way around the above path must be zero. Furthermore, we can prove that its integral along the crust goes to zero as <em>R</em> tends to infinity.</p>
<p>Therefore, the path integral along the diagonal γ<sub>3</sub> (from the origin outward) must be equal to the integral along γ<sub>1</sub> (also outward from the origin.)</p>
<p>We can parametrize the diagonal by <img src='/wp-content/plugins/latexrender/pictures/e065a7c7bd6b28b8e27bd0bb9f06d96e_3.5pt.png' title='g(t) = te^{i\pi / 4}' alt='g(t) = te^{i\pi / 4}'  style="vertical-align:-3.5pt;" >, so the path integral across the diagonal is</p>
<p style="padding-left: 30px;"><img src='/wp-content/plugins/latexrender/pictures/62b5fd49d4c02fae7c9d6315da0c18cf_4.5556pt.png' title='\int_0^{\infty} e^{ig(t)^2}g\prime (t)dt = e^{i\pi / 4} \int_0^{\infty} e^{-t^2}dt' alt='\int_0^{\infty} e^{ig(t)^2}g\prime (t)dt = e^{i\pi / 4} \int_0^{\infty} e^{-t^2}dt'  style="vertical-align:-4.5556pt;" ></p>
<p>Taking only the imaginary part, we arrive at</p>
<p style="padding-left: 30px;"><img src='/wp-content/plugins/latexrender/pictures/2f79c1e35d03cb915620be0f717d98b9_6.43994pt.png' title='\int_0^{\infty} sin(x^2) dx = \frac{1}{\sqrt 2} \int_0^{\infty} e^{-t^2}dt = \sqrt{2\pi}/4 ' alt='\int_0^{\infty} sin(x^2) dx = \frac{1}{\sqrt 2} \int_0^{\infty} e^{-t^2}dt = \sqrt{2\pi}/4 '  style="vertical-align:-6.43994pt;" ></p>
<p>where the second integral is simply half of the Gaussian integral.</p>
<p>The contribution of complex analysis is to prove the first identity above. My question is, is there a more elementary way of establishing it? It seems as though we shouldn&#8217;t need the theory of complex functions to evaluate something like this, but I can&#8217;t find any other way.</p>
]]></content:encoded>
			<wfw:commentRss>http://mathemagicio.us/2009/07/29/the-fresnel-integral/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Circles covering squares and points</title>
		<link>http://mathemagicio.us/2009/06/12/circles-covering-squares-and-points/</link>
		<comments>http://mathemagicio.us/2009/06/12/circles-covering-squares-and-points/#comments</comments>
		<pubDate>Fri, 12 Jun 2009 07:17:52 +0000</pubDate>
		<dc:creator>Mark Przepiora</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Math]]></category>

		<guid isPermaLink="false">http://mathemagicio.us/?p=392</guid>
		<description><![CDATA[The following question appeared in an issue of π in the Sky:
Show that given any 201 points inside a 10-by-10 square, there is a unit circle containing at least 3 of those points.
It is natural to ask, for what other number of points n does the above hold? And what is the smallest such n?
One way to [...]]]></description>
			<content:encoded><![CDATA[<p>The following question appeared in an issue of <a href="http://www.pims.math.ca/pi/">π in the Sky</a>:</p>
<blockquote><p>Show that given any 201 points inside a 10-by-10 square, there is a unit circle containing at least 3 of those points.</p></blockquote>
<p>It is natural to ask, for what other number of points <em>n</em> does the above hold? And what is the smallest such <em>n</em>?<span id="more-392"></span></p>
<p>One way to bound <em>n</em> geometrically follows from noticing the obvious fact that</p>
<p style="padding-left: 30px;">given <em>k</em> circles covering a square and <em>m</em> points inside that square with any individual circle containing at most two of them, then it must be the case that <em>m ≤ 2k</em>.</p>
<p>which is just a restatement of the fact that</p>
<p style="padding-left: 30px;"><img src='/wp-content/plugins/latexrender/pictures/de33a72642cde993b8269a2e32e05a0f_4.00005pt.png' title=' \sum_i |A_i| \ge |\cup_i A_i | ' alt=' \sum_i |A_i| \ge |\cup_i A_i | '  style="vertical-align:-4.00005pt;" ></p>
<p>So it is sufficient to produce a covering of the square by 100 unit circles to prove the original statement, i.e. when <em>n = 201</em>.</p>
<p><em>Two-hundred and one</em> turns out to be a very generous bound, though. It&#8217;s quite easy to construct a covering of 60 (maybe 61?) circles, by an arrangement similar to the one below:</p>
<div id="attachment_462" class="wp-caption aligncenter" style="width: 292px"><img class="size-full wp-image-462  " title="Four circles in an arrangement" src="http://mathemagicio.us/wp-content/uploads/2009/06/circles.gif" alt="Tiling this arrangement of radius-0.1 circles allows you cover the unit square with 60 of them" width="282" height="281" /><p class="wp-caption-text">Tiling this arrangement of unit circles allows you cover a 10-by-10 square with 60 of them</p></div>
<p>This allows us to reduce the number of points from 201 in the original puzzle to only 2*60 + 1 = 121.</p>
<p>How much further can we reduce this number by this method? Worded slightly differently, what is the smallest number of unit circles that can cover a 10-by-10 square? This turns out to be a difficult problem, and <a href="http://www.stetson.edu/~efriedma/packing.html">Erich&#8217;s Packing Center</a> has <a href="http://www.stetson.edu/~efriedma/circovsqu/">the answer for the opposite question</a> (that is, &#8220;what is the largest <em>s-by-s</em> square that <em>n</em> unit circles can cover?&#8221;) for small values of <em>n</em>, with <em>s</em> reaching values of only about half of in what we&#8217;re interested.</p>
<p>Using Wolfram Alpha, we can <a href="http://www30.wolframalpha.com/input/?i=1.414%2C+1.788%2C+1.984%2C+2.828%2C+3.065%2C+3.347%2C+3.645%2C+3.841%2C+4.335%2C+4.582%2C+4.705%2C+4.943">plot these values</a> and observe that <em>s</em> appears to increase approximately linearly with <em>n</em>, and <a href="http://www30.wolframalpha.com/input/?i=linear+fit+%7B1.414%2C+1.788%2C+1.984%2C+2.828%2C+3.065%2C+3.347%2C+3.645%2C+3.841%2C+4.335%2C+4.582%2C+4.705%2C+4.943%7D">perform a linear fit</a>. Solving the resulting equation for <em>s = 10</em>, we might expect that a covering of a 10-by-10 square is possible using only 27 unit circles, which if true would bring the bound proved above down from 121 to only 55.</p>
<p>Finding such coverings allows us to prove that the original statement holds for (say) all <em>n ≥ 121</em>, but would finding the optimal covering give us the smallest <em>n</em> for which it holds? That doesn&#8217;t seem obvious, as this method essentially gives us a fixed set of circles we are allowed to use, independent of the points in the square, while the original statement allows for the circle to be a function of the points. So can we prove anything directly from the statement itself?</p>
<p>Again, it doesn&#8217;t seem obvious how, but what we <em>can</em> do easily is prove that the original statement fails for <em>n ≤ 49</em>. Simply consider a square lattice of points separated horizontally and vertically by a distance of <img src='/wp-content/plugins/latexrender/pictures/1fd9097e6e6e320446c6e7737a7b8846_2.32779pt.png' title='\sqrt{2} + \varepsilon' alt='\sqrt{2} + \varepsilon'  style="vertical-align:-2.32779pt;" >, so that each point is separated diagonally by at least a distance of 2. If we take <em>ε</em> to be small enough, say <em>ε = 0.1</em>, we can fit a grid of <em>7*7 = 49</em> points inside a 10-by-10 square, and it&#8217;s easy to convince yourself that no unit circle can cover three of the points in the lattice.</p>
<div id="attachment_483" class="wp-caption aligncenter" style="width: 253px"><img class="size-full wp-image-483  " title="Lattice of points" src="http://mathemagicio.us/wp-content/uploads/2009/06/lattice2.gif" alt="Lattice of points" width="243" height="264" /><p class="wp-caption-text">Spacing each point apart horizontally and vertically by √2+ε units ensures that no unit circle will cover three points</p></div>
<p>So we have an interesting situation: we can prove that the statement <em>fails</em> for all <em>n ≤ C</em> by constructing sets of points, and prove that the statement <em>holds</em> for all <em>n ≥ C</em> by constructing sets of circles, but neither method easily provides an exact answer.</p>
<p>Can we do better?</p>
]]></content:encoded>
			<wfw:commentRss>http://mathemagicio.us/2009/06/12/circles-covering-squares-and-points/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Easy-peasy symbolic computation with Ruby</title>
		<link>http://mathemagicio.us/2009/01/03/easy-peasy-symbolic-computation-with-ruby/</link>
		<comments>http://mathemagicio.us/2009/01/03/easy-peasy-symbolic-computation-with-ruby/#comments</comments>
		<pubDate>Sat, 03 Jan 2009 11:49:28 +0000</pubDate>
		<dc:creator>Mark Przepiora</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[CS]]></category>
		<category><![CDATA[Math]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://mathemagicio.us/?p=120</guid>
		<description><![CDATA[Ruby is a wonderful language, largely deserving of the fanaticism surrounding it. There are a number of ways you can exploit its syntax to write concise, beautiful code. For example, to shuffle an array&#8230;

deck.sort_by&#123; rand &#125;

&#8230;or to pick out certain elements of one&#8230;

deck.find_all&#123; &#124;card&#124; card.suit == Clubs &#125;

&#8230;or to seamlessly cache computations.

def average_earnings
  @average_earnings [...]]]></description>
			<content:encoded><![CDATA[<p>Ruby is a wonderful language, largely deserving of the fanaticism surrounding it. There are a number of ways you can exploit its syntax to write concise, beautiful code. For example, to shuffle an array&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="ruby ruby" style="font-family:monospace;">deck.<span style="color:#9900CC;">sort_by</span><span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#CC0066; font-weight:bold;">rand</span> <span style="color:#006600; font-weight:bold;">&#125;</span></pre></div></div>

<p>&#8230;or to pick out certain elements of one&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="ruby ruby" style="font-family:monospace;">deck.<span style="color:#9900CC;">find_all</span><span style="color:#006600; font-weight:bold;">&#123;</span> |card| card.<span style="color:#9900CC;">suit</span> == Clubs <span style="color:#006600; font-weight:bold;">&#125;</span></pre></div></div>

<p>&#8230;or to seamlessly cache computations.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">def</span> average_earnings
  <span style="color:#0066ff; font-weight:bold;">@average_earnings</span> ||= some_lengthy_computation
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>(Above, the ||= operator acts analogously to the familiar += operator. So if the instance variable @average_earnings already has a non-nil value, it is returned without any further computation. If on the other hand it is nil, then some_lengthy_computation is performed, @average_earnings is set to it, and returned.)</p>
<p>In addition, there are also a number of ridiculously short applications written in it, including a <a href="http://blogs.msdn.com/abhinaba/archive/2005/10/14/ruby-webserver-in-70-lines-of-code.aspx">web server</a> in 70 lines of code, a <a href="http://www.rubyinside.com/beast-an-open-source-rails-forum-in-500-lines-of-code-191.html">message board</a> application in 500 lines, and its slightly more verbose <a href="http://www.williambharding.com/blog/rails/savage-beast-20/">successor</a>.</p>
<p>In addition to these, I present a proof of concept of my own: Mathematica and Maple-like symbolic differentiation in about a hundred lines of code.</p>
<p><span id="more-120"></span>The idea is to have a Function class, which is subclassed by actual functions (Cos, Exp, Constant, etc.) as well as by operators (Addition, Multiplication, etc.)</p>
<p>Ruby allows us to overload operators, so we can add, subtract, multiply, and divide functions naturally, and define &#8220;f + g&#8221; as an instantiation of the Add class (which we will define later!)</p>
<p>Each subclass of Function must implement two methods: (1) diff, which returns another Function object (its derivative), and (2) the indexing method [], so given a Function object f and number x in its domain, we can evaluate f(x) via &#8220;f[x]&#8220;.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
</pre></td><td class="code"><pre class="ruby ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> Function
  <span style="color:#008000; font-style:italic;"># Skeleton. Returns: another Function</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> diff
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># Skeleton. Returns: a number</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#40;</span>index<span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># Begin algebraic operations</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#006600; font-weight:bold;">+</span><span style="color:#006600; font-weight:bold;">&#40;</span>a<span style="color:#006600; font-weight:bold;">&#41;</span>
    Add.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF; font-weight:bold;">self</span>,a<span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#006600; font-weight:bold;">*</span><span style="color:#006600; font-weight:bold;">&#40;</span>a<span style="color:#006600; font-weight:bold;">&#41;</span>
    a = Constant.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span>a<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">if</span> a.<span style="color:#9900CC;">kind_of</span>? <span style="color:#CC00FF; font-weight:bold;">Numeric</span>
    Multiply.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF; font-weight:bold;">self</span>,a<span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#006600; font-weight:bold;">/</span><span style="color:#006600; font-weight:bold;">&#40;</span>a<span style="color:#006600; font-weight:bold;">&#41;</span>
    a = Constant.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span>a<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">if</span> a.<span style="color:#9900CC;">kind_of</span>? <span style="color:#CC00FF; font-weight:bold;">Numeric</span>
    Divide.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF; font-weight:bold;">self</span>,a<span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#006600; font-weight:bold;">-</span><span style="color:#006600; font-weight:bold;">&#40;</span>a<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#0000FF; font-weight:bold;">self</span> <span style="color:#006600; font-weight:bold;">+</span> a <span style="color:#006600; font-weight:bold;">*</span> <span style="color:#006600; font-weight:bold;">-</span><span style="color:#006666;">1</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#006600; font-weight:bold;">-</span>@
    <span style="color:#0000FF; font-weight:bold;">self</span> <span style="color:#006600; font-weight:bold;">*</span> <span style="color:#006600; font-weight:bold;">-</span><span style="color:#006666;">1</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#008000; font-style:italic;"># End algebraic operations</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p>All binary operations are initialized the same way and have the same basic structure: they act in some way on two functions specified upon creation of the object.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="ruby ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> BinaryOperation <span style="color:#006600; font-weight:bold;">&lt;</span> Function
  <span style="color:#9966CC; font-weight:bold;">def</span> initialize<span style="color:#006600; font-weight:bold;">&#40;</span>f, g<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#0066ff; font-weight:bold;">@f</span> = f
    <span style="color:#0066ff; font-weight:bold;">@g</span> = g
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p>Multiply subclasses it as follows:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="ruby ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> Multiply <span style="color:#006600; font-weight:bold;">&lt;</span> BinaryOperation
  <span style="color:#9966CC; font-weight:bold;">def</span> diff
    <span style="color:#0066ff; font-weight:bold;">@f</span> <span style="color:#006600; font-weight:bold;">*</span> <span style="color:#0066ff; font-weight:bold;">@g</span>.<span style="color:#9900CC;">diff</span> <span style="color:#006600; font-weight:bold;">+</span> <span style="color:#0066ff; font-weight:bold;">@f</span>.<span style="color:#9900CC;">diff</span> <span style="color:#006600; font-weight:bold;">+</span> <span style="color:#0066ff; font-weight:bold;">@g</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#40;</span>x<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#0066ff; font-weight:bold;">@f</span><span style="color:#006600; font-weight:bold;">&#91;</span>x<span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">*</span> <span style="color:#0066ff; font-weight:bold;">@g</span><span style="color:#006600; font-weight:bold;">&#91;</span>x<span style="color:#006600; font-weight:bold;">&#93;</span> 
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p>We can similarly define Add and Divide. For any operation, we simply need to know how to differentiate the operation, and how to evaluate it.</p>
<p>We can also define some actual functions. For example,</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="ruby ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> Sin <span style="color:#006600; font-weight:bold;">&lt;</span> Function
  <span style="color:#9966CC; font-weight:bold;">def</span> diff
    Cos.<span style="color:#9900CC;">new</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#40;</span>x<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#CC00FF; font-weight:bold;">Math</span>.<span style="color:#9900CC;">sin</span><span style="color:#006600; font-weight:bold;">&#40;</span>x<span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="ruby ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> Cos <span style="color:#006600; font-weight:bold;">&lt;</span> Function
  <span style="color:#9966CC; font-weight:bold;">def</span> diff
    <span style="color:#006600; font-weight:bold;">-</span>Sin.<span style="color:#9900CC;">new</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#40;</span>x<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#CC00FF; font-weight:bold;">Math</span>.<span style="color:#9900CC;">cos</span><span style="color:#006600; font-weight:bold;">&#40;</span>x<span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="ruby ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> Exp <span style="color:#006600; font-weight:bold;">&lt;</span> Function
  <span style="color:#9966CC; font-weight:bold;">def</span> diff
    <span style="color:#0000FF; font-weight:bold;">self</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#40;</span>x<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#CC00FF; font-weight:bold;">Math</span>.<span style="color:#9900CC;">exp</span><span style="color:#006600; font-weight:bold;">&#40;</span>x<span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p>Once we have all of our operations and functions defined, we can start computing and plotting functions and their derivatives,</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="ruby ruby" style="font-family:monospace;">f = Cos.<span style="color:#9900CC;">new</span> <span style="color:#006600; font-weight:bold;">/</span> Exp.<span style="color:#9900CC;">new</span>
g = f.<span style="color:#9900CC;">diff</span>
&nbsp;
<span style="color:#006600; font-weight:bold;">&#40;</span>0..10<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> |a|
  x = a.<span style="color:#9900CC;">to_f</span><span style="color:#006600; font-weight:bold;">/</span><span style="color:#006666;">10</span>
  <span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#996600;">&quot;ft#{x}t#{f[x]}&quot;</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#006600; font-weight:bold;">&#40;</span>0..10<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> |a|
  x = a.<span style="color:#9900CC;">to_f</span><span style="color:#006600; font-weight:bold;">/</span><span style="color:#006666;">10</span>
  <span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#996600;">&quot;f't#{x}t#{g[x]}&quot;</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></td></tr></table></div>

<p>With a little additional code, we could also print out functions symbolically.</p>
<p>Not bad for less than a couple hundred lines of code.</p>
]]></content:encoded>
			<wfw:commentRss>http://mathemagicio.us/2009/01/03/easy-peasy-symbolic-computation-with-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Happy eighth day of Christmas!</title>
		<link>http://mathemagicio.us/2009/01/01/happy-eighth-day-of-christmas/</link>
		<comments>http://mathemagicio.us/2009/01/01/happy-eighth-day-of-christmas/#comments</comments>
		<pubDate>Thu, 01 Jan 2009 17:55:50 +0000</pubDate>
		<dc:creator>Mark Przepiora</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Christmas]]></category>
		<category><![CDATA[Math]]></category>

		<guid isPermaLink="false">http://mathemagicio.us/?p=36</guid>
		<description><![CDATA[As we all celebrate another revolution around the sun and come halfway closer to Epiphany, let&#8217;s explore a holiday-themed math problem.
The number of gifts one receives at the end of the Twelve Days Of Christmas is ironically 364—a gift for each day of the year except Christmas itself.
But what about the inhabitants of Gaia-n, who [...]]]></description>
			<content:encoded><![CDATA[<p>As we all celebrate another revolution around the sun and come halfway closer to Epiphany, let&#8217;s explore a holiday-themed math problem.</p>
<p>The number of gifts one receives at the end of the <a href="http://en.wikipedia.org/wiki/The_Twelve_Days_of_Christmas_(song)">Twelve Days Of Christmas</a> is ironically 364—a gift for each day of the year except Christmas itself.</p>
<p>But what about the inhabitants of Gaia-<em>n</em>, who celebrate not 12 but <em>n</em> days of Christmas?</p>
<p>On the first day, such an inhabitant receives 1 present; on the second day, 1 + 2; on the third, 1 + 2 + 3; etc. Then, thanks to a theorem by <a href="http://en.wikipedia.org/wiki/Gauss">some clever little kid</a>, we can write the number of gifts he receives on day <em>k</em> as <img src='/wp-content/plugins/latexrender/pictures/857e075bc6fcfebaaf3a7c265997c31d_3.5pt.png' title='T_k = k(k+1)/2' alt='T_k = k(k+1)/2'  style="vertical-align:-3.5pt;" >, the <em>k</em><sup>th</sup> <a href="http://en.wikipedia.org/wiki/Triangular_number">triangular number</a>, and thus the total number of presents he receives in all <em>n</em>days as the sum of triangular numbers <img src='/wp-content/plugins/latexrender/pictures/a307751c8f05cde0ec5d5eebf4eefe2d_4.00005pt.png' title='C_n = \sum_{k=1}^n T_k' alt='C_n = \sum_{k=1}^n T_k'  style="vertical-align:-4.00005pt;" > (where <em>C</em> is for Christmas.)</p>
<p style="text-align: center;"><img class="alignnone size-full wp-image-46" title="T3 + T4 is a square" src="http://mathemagicio.us/wp-content/uploads/2009/01/triangular.png" alt="T3 + T4 is a square" width="250" height="244" /></p>
<p>A geometric argument easily shows that <img src='/wp-content/plugins/latexrender/pictures/f3591d13ef49e40b696e4a9a5fea2c91_3.33333pt.png' title='T_{k-1} + T_{k} = k^2' alt='T_{k-1} + T_{k} = k^2'  style="vertical-align:-3.33333pt;" >, so (assuming <em>n</em> is even)</p>
<p><img src='/wp-content/plugins/latexrender/pictures/99a8333a9de37a4b496ddb7c1425b9a8_4.01659pt.png' title=' C_n = \sum_{k=1}^{n/2} (2k)^2 = 4\sum_{k=1}^{n/2} k^2 ' alt=' C_n = \sum_{k=1}^{n/2} (2k)^2 = 4\sum_{k=1}^{n/2} k^2 '  style="vertical-align:-4.01659pt;" ></p>
<p>which is four times a <a href="http://en.wikipedia.org/wiki/Square_pyramidal_number">pyramid number</a>! Substituting the closed expression for the sum and simplifying gives,</p>
<p><img src='/wp-content/plugins/latexrender/pictures/c3317ff187396a9d1b7d578f10fd2f07_4.44841pt.png' title=' C_n = n^3/6 + n^2/2 + n/3 = \frac{1}{6} n(n+1)(n+2)' alt=' C_n = n^3/6 + n^2/2 + n/3 = \frac{1}{6} n(n+1)(n+2)'  style="vertical-align:-4.44841pt;" >.</p>
<p>We can easily verify that this expression also gives the correct answer when <em>n</em> is odd, and moreover <img src='/wp-content/plugins/latexrender/pictures/31996bb70ea5e729e1e70c8871655891_3.5pt.png' title=' C_{12} = 12\cdot 13\cdot 14/2 = 364 ' alt=' C_{12} = 12\cdot 13\cdot 14/2 = 364 '  style="vertical-align:-3.5pt;" > as we hoped!</p>
<p>On other planets, inhabitants may celebrate a fraction of a number of days of Christmas, and they may wish to extend the expression <img src='/wp-content/plugins/latexrender/pictures/cf60ab512844030329be44356fad9fcd_2.49998pt.png' title=' C_n ' alt=' C_n '  style="vertical-align:-2.49998pt;" > to any real (or complex!) number, i.e.</p>
<p><img src='/wp-content/plugins/latexrender/pictures/cec2d0e8240bdeab391f5273e7415492_4.44841pt.png' title=' C(z) = \frac{1}{6} z(z+1)(z+2) ' alt=' C(z) = \frac{1}{6} z(z+1)(z+2) '  style="vertical-align:-4.44841pt;" ></p>
<p>which we naturally call the <em>Christmas polynomial</em>.</p>
<p>We may also wonder how many gifts someone will receive who has relatives on each of the planets Gaia-<em>1</em>, Gaia-<em>2</em>, &#8230;, up to Gaia-<em>n</em>. That is, what is the value of the sum <img src='/wp-content/plugins/latexrender/pictures/872f2b55838a37a6354dc9ae4081bc4e_4.00005pt.png' title='Z_n = \sum_{k=1}^n C_n' alt='Z_n = \sum_{k=1}^n C_n'  style="vertical-align:-4.00005pt;" >?</p>
<p>Because we may write <img src='/wp-content/plugins/latexrender/pictures/b61d840cec3f148458108a9c29ec5296_4.50006pt.png' title='T_n = \binom{n+1}{2}' alt='T_n = \binom{n+1}{2}'  style="vertical-align:-4.50006pt;" > and <img src='/wp-content/plugins/latexrender/pictures/461d8f7fba4ad0996fb9d21564b90d84_4.50006pt.png' title='C_n = \binom{n+2}{3}' alt='C_n = \binom{n+2}{3}'  style="vertical-align:-4.50006pt;" >, it is a reasonable guess that <img src='/wp-content/plugins/latexrender/pictures/ed8b0e81df66270b0253892133b9ca42_4.50006pt.png' title=' Z_n = \binom{n+3}{4} ' alt=' Z_n = \binom{n+3}{4} '  style="vertical-align:-4.50006pt;" >. This indeed turns out to be the case, and so we may naturally define a generalized Christmas function</p>
<p><img src='/wp-content/plugins/latexrender/pictures/9b32c32615427bdb27d4d73ddfe3b07d_5.28175pt.png' title=' \chi_{m,n} = \binom{n+m}{m+1} ' alt=' \chi_{m,n} = \binom{n+m}{m+1} '  style="vertical-align:-5.28175pt;" ></p>
<p>(where <em>χ</em> is for <em>Xmas</em>.) This results in the sequences</p>
<p><img src='/wp-content/plugins/latexrender/pictures/4d4051dd43196e4844971c9960002f47_3.86108pt.png' title=' \chi_{0,n} = n' alt=' \chi_{0,n} = n'  style="vertical-align:-3.86108pt;" ><br />
<img src='/wp-content/plugins/latexrender/pictures/a65a589204c86c21d144097791e19708_3.86108pt.png' title=' \chi_{1,n} = T_n' alt=' \chi_{1,n} = T_n'  style="vertical-align:-3.86108pt;" ><br />
<img src='/wp-content/plugins/latexrender/pictures/02b1ac9e443ae885fe13d83e90f425fd_3.86108pt.png' title=' \chi_{2,n} = C_n' alt=' \chi_{2,n} = C_n'  style="vertical-align:-3.86108pt;" ></p>
<p>and so on, allowing us to calculate a great number of Christmas gift-giving scenarios.</p>
]]></content:encoded>
			<wfw:commentRss>http://mathemagicio.us/2009/01/01/happy-eighth-day-of-christmas/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
