<?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>nklein software &#187; geometry</title>
	<atom:link href="http://nklein.com/tags/geometry/feed/" rel="self" type="application/rss+xml" />
	<link>http://nklein.com</link>
	<description>software development and consulting</description>
	<lastBuildDate>Wed, 30 Jun 2010 14:00:59 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Finding the Perfect Hyperbola</title>
		<link>http://nklein.com/2010/02/finding-the-perfect-hyperbola/</link>
		<comments>http://nklein.com/2010/02/finding-the-perfect-hyperbola/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 20:53:18 +0000</pubDate>
		<dc:creator>pat</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Math]]></category>
		<category><![CDATA[algebra]]></category>
		<category><![CDATA[geometry]]></category>
		<category><![CDATA[vecto]]></category>

		<guid isPermaLink="false">http://nklein.com/?p=1189</guid>
		<description><![CDATA[For an application that I&#8217;m working on, I needed a way to scale quantities that range (theoretically) over the real numbers (though practically are probably between plus and minus three) into positive numbers.  I wanted the function to be everywhere increasing, I wanted , and I wanted control of the derivative at .
The easy [...]]]></description>
			<content:encoded><![CDATA[<p>For an application that I&#8217;m working on, I needed a way to scale quantities that range (theoretically) over the real numbers (though practically are probably between plus and minus three) into positive numbers.  I wanted the function to be everywhere increasing, I wanted <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_c1cb7a5bdd50535b670e023bf91a94fc.png" title="f(0) = 1" style="vertical-align:-20%;" class="tex" alt="f(0) = 1" />, and I wanted control of the derivative at <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_055bb38e2223c10cbcfd8330867c873f.png" title="x = 0" style="vertical-align:-20%;" class="tex" alt="x = 0" />.</p>
<p>The easy choice is: <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_1664c465b5fa480b7e4896c0ece77e57.png" title="f(x) = e^{\alpha x}" style="vertical-align:-20%;" class="tex" alt="f(x) = e^{\alpha x}" />.  This is monotonically increasing.  <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_c1cb7a5bdd50535b670e023bf91a94fc.png" title="f(0) = 1" style="vertical-align:-20%;" class="tex" alt="f(0) = 1" /> and <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_ed9cb8fb0eee1cd2d3a17d75a4c58847.png" title="f^\prime(0) = \alpha" style="vertical-align:-20%;" class="tex" alt="f^\prime(0) = \alpha" />.</p>
<p>I needed to scale three such quantities and mush them together.  I thought it&#8217;d be spiffy then to have three different functions that satisfy my criteria.  The next logical choice was <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_7b757a3e18f1bca442c93c1065331ed4.png" title="f(x) = 1 + \mathrm{tanh} (\alpha x)" style="vertical-align:-20%;" class="tex" alt="f(x) = 1 + \mathrm{tanh} (\alpha x)" />.  It is everywhere positive and increasing.  And, it has <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_ed9cb8fb0eee1cd2d3a17d75a4c58847.png" title="f^\prime(0) = \alpha" style="vertical-align:-20%;" class="tex" alt="f^\prime(0) = \alpha" />.</p>
<p>Now, I needed third function that was always positive, always increasing, had <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_c1cb7a5bdd50535b670e023bf91a94fc.png" title="f(0) = 1" style="vertical-align:-20%;" class="tex" alt="f(0) = 1" /> and <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_ed9cb8fb0eee1cd2d3a17d75a4c58847.png" title="f^\prime(0) = \alpha" style="vertical-align:-20%;" class="tex" alt="f^\prime(0) = \alpha" />.  One choice was:  <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_5e73c987e194dae7b18809999c7cedd6.png" title="f(x) = e^{e^{\alpha x} - 1}" style="vertical-align:-20%;" class="tex" alt="f(x) = e^{e^{\alpha x} - 1}" />.  But, that seemed like overkill.  It also meant that I really had to keep my <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_a7175a60e504c64ad51e7119b44ee9aa.png" title="\alpha" style="vertical-align:-20%;" class="tex" alt="\alpha" /> tiny if I didn&#8217;t want to scale things into the stratosphere.</p>
<h3>Playing with hyperbolas</h3>
<p><a href="http://nklein.com/wp-content/uploads/2010/02/hyperbola.png"><img src="http://nklein.com/wp-content/uploads/2010/02/hyperbola-300x300.png" alt="" title="hyperbola" width="300" height="300" class="alignright size-medium wp-image-1191" /></a>So, I thought&#8230; why don&#8217;t I make a hyperbola, rotate it, and shift it so that the apex of one side of the hyperbola is at <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_899c0ad792ee5fca9071f5bbeb6fc9ad.png" title="(0,1)" style="vertical-align:-20%;" class="tex" alt="(0,1)" />.  And, I can adjust the parameters of the hyperbola so that <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_2213bb99d8be759f217ca55bd95edd12.png" title="f'(0) = \alpha" style="vertical-align:-20%;" class="tex" alt="f'(0) = \alpha" />.  After a variety of false starts where I tried to keep the hyperbola general until the very end (<img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_65fc2db1a4b8c991b7049c4fe78eed83.png" title="\frac{x^2}{a^2} - \frac{y^2}{b^2} = r^2" style="vertical-align:-20%;" class="tex" alt="\frac{x^2}{a^2} - \frac{y^2}{b^2} = r^2" />, rotated by <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_0004c76178a1d078888badee6891a8bd.png" title="\theta" style="vertical-align:-20%;" class="tex" alt="\theta" /> degrees, and shifted by <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_ed45436c4512976c4600afab449577d8.png" title="\beta" style="vertical-align:-20%;" class="tex" alt="\beta" />), I quickly got bogged down in six or seven incredibly ugly equations in eight or nine variables.</p>
<p>So, it was time to start trying to make it easy from the beginning.   I noticed that if was going to rotate it by an angle <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_0004c76178a1d078888badee6891a8bd.png" title="\theta" style="vertical-align:-20%;" class="tex" alt="\theta" /> in the clockwise direction, then I needed <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_b4a257df561663115406a382c2fdfb00.png" title="\phi = \frac{\pi}{2} - \theta" style="vertical-align:-20%;" class="tex" alt="\phi = \frac{\pi}{2} - \theta" /> to be such that <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_1537f3082a10cb5448ec9dabe01a0d12.png" title="\tan \phi = \alpha" style="vertical-align:-20%;" class="tex" alt="\tan \phi = \alpha" /> if my slope was going to work out right in the end.<a href="http://nklein.com/wp-content/uploads/2010/02/triangle.png"><img src="http://nklein.com/wp-content/uploads/2010/02/triangle-150x150.png" alt="" title="triangle" width="150" height="150"  style="clear: right;" class="alignright size-thumbnail wp-image-1192" /></a>   So, I&#8217;m looking at the basic triangle on the right then to determine all of my sines and cosines and such.</p>
<p>Based on that triangle, it was also obvious that the asymptote for my starting hyperbola had to have <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_16d704e03ab06854b6f15c35ef6b6c63.png" title="\frac{b}{a} = \frac{1}{\alpha}" style="vertical-align:-20%;" class="tex" alt="\frac{b}{a} = \frac{1}{\alpha}" />.  I played around a bit then with making <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_cbc4d0c9418a975cd07b3481c3233e22.png" title="a = \alpha" style="vertical-align:-20%;" class="tex" alt="a = \alpha" /> and <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_76ad81f0c9a6b05231a9d44eb84b8637.png" title="b = 1" style="vertical-align:-20%;" class="tex" alt="b = 1" />.  In the end, I found things simplified sooner if I started with <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_bfc64db88044b1bed880f65ab006c520.png" title="a = 1" style="vertical-align:-20%;" class="tex" alt="a = 1" /> and <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_56f3ac4506d4d0fd32c01984d7ea7fa5.png" title="b = \frac{1}{\alpha}" style="vertical-align:-20%;" class="tex" alt="b = \frac{1}{\alpha}" />.</p>
<p>I also needed <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_de3adc820dbc4655c45b5555765fe84b.png" title="r" style="vertical-align:-20%;" class="tex" alt="r" /> to be such that the point <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_6351922e40bc95d55bb60e1fe4fb18fd.png" title="(-r,0)" style="vertical-align:-20%;" class="tex" alt="(-r,0)" /> rotate up so that its <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_e561f1e00880abb7e58816455af00a48.png" title="y" style="vertical-align:-20%;" class="tex" alt="y" />-coordinate was <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_e04a0c4d52e7f8537abf80bb9beb4a8a.png" title="1" style="vertical-align:-20%;" class="tex" alt="1" />.  This meant that <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_82520310515e5f6f8a4d1dd2a84c782a.png" title="r \sin \theta = 1" style="vertical-align:-20%;" class="tex" alt="r \sin \theta = 1" /> or <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_5f02e0b2b4a7ef37d5076f74f518a6ca.png" title="r = \frac{1}{\sin \theta} = \sqrt{1 + \alpha^2}" style="vertical-align:-20%;" class="tex" alt="r = \frac{1}{\sin \theta} = \sqrt{1 + \alpha^2}" />.</p>
<p>So, my starting hyperbola then was: <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_f0b77c1ca12c3756fceacceb7ee4ac21.png" title="x^2 - \alpha^2 y^2 = 1 + \alpha^2" style="vertical-align:-20%;" class="tex" alt="x^2 - \alpha^2 y^2 = 1 + \alpha^2" />.</p>
<p>From there, I had to rotate the <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_1a507c5494969dc6de305770cadc6630.png" title="x" style="vertical-align:-20%;" class="tex" alt="x" /> and <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_e561f1e00880abb7e58816455af00a48.png" title="y" style="vertical-align:-20%;" class="tex" alt="y" /> by <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_0004c76178a1d078888badee6891a8bd.png" title="\theta" style="vertical-align:-20%;" class="tex" alt="\theta" /> in the clockwise direction.  This gave me:<br />
<center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_d54c652aea88202bb256c37f3d486786.png" title="(x\cos\theta - y\sin\theta)^2 - \alpha^2 (x\sin\theta + y\cos\theta)^2 = 1 + \alpha^2" style="vertical-align:-20%;" class="tex" alt="(x\cos\theta - y\sin\theta)^2 - \alpha^2 (x\sin\theta + y\cos\theta)^2 = 1 + \alpha^2" /></center></p>
<p>A little multiplying out leads to:<br />
<center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_802799f8a59061e695ae8624b0a1a115.png" title="(x^2\cos^2\theta - 2xy\sin\theta\cos\theta + y^2\sin^2\theta) \\ - \alpha^2(x^2\sin^2\theta + 2xy\sin\theta\cos\theta + y^2\cos^2\theta) = 1 + \alpha^2" style="vertical-align:-20%;" class="tex" alt="(x^2\cos^2\theta - 2xy\sin\theta\cos\theta + y^2\sin^2\theta) \\ - \alpha^2(x^2\sin^2\theta + 2xy\sin\theta\cos\theta + y^2\cos^2\theta) = 1 + \alpha^2" /></center></p>
<p>From there, using <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_ba506e83b38225aee1a949dfefa8f98b.png" title="cos^2\theta = \frac{\alpha^2}{1 + \alpha^2}" style="vertical-align:-20%;" class="tex" alt="cos^2\theta = \frac{\alpha^2}{1 + \alpha^2}" />, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_63a5ce798225d66ffd828cbf6adc0d27.png" title="sin^2\theta = \frac{1}{1 + \alpha^2}" style="vertical-align:-20%;" class="tex" alt="sin^2\theta = \frac{1}{1 + \alpha^2}" />, and <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_31893ba13c851bec319d1e84fa273c4f.png" title="\sin\theta\cos\theta = \frac{\alpha}{1 + \alpha^2}" style="vertical-align:-20%;" class="tex" alt="\sin\theta\cos\theta = \frac{\alpha}{1 + \alpha^2}" />, we come to:</p>
<p><center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_932ad4d95a72a6cae8c353b9bce95524.png" title="\frac{-2\alpha(1 + \alpha^2)xy + ( 1 - \alpha^4 )y^2}{1 + \alpha^2} = -2\alpha{}xy +  (1 - \alpha^2)y^2 = 1 + \alpha^2" style="vertical-align:-20%;" class="tex" alt="\frac{-2\alpha(1 + \alpha^2)xy + ( 1 - \alpha^4 )y^2}{1 + \alpha^2} = -2\alpha{}xy +  (1 - \alpha^2)y^2 = 1 + \alpha^2" /></center></p>
<p>The only step remaining was to shift it all over so that when <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_409ec858a4679ef8370133dc2076b0b0.png" title="y = 1" style="vertical-align:-20%;" class="tex" alt="y = 1" />, we end up with <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_055bb38e2223c10cbcfd8330867c873f.png" title="x = 0" style="vertical-align:-20%;" class="tex" alt="x = 0" />.  Plugging in <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_409ec858a4679ef8370133dc2076b0b0.png" title="y = 1" style="vertical-align:-20%;" class="tex" alt="y = 1" />, we see that <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_1150678e298fe9f8e85ddc65f9fec594.png" title="-2x\alpha + 1 - \alpha^2 = 1 + \alpha" style="vertical-align:-20%;" class="tex" alt="-2x\alpha + 1 - \alpha^2 = 1 + \alpha" />.  That equation balances when <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_5ced797303d05efbca9c01afa8b0c01d.png" title="x = -\alpha" style="vertical-align:-20%;" class="tex" alt="x = -\alpha" />.  We want it to balance when <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_055bb38e2223c10cbcfd8330867c873f.png" title="x = 0" style="vertical-align:-20%;" class="tex" alt="x = 0" />, so we&#8217;re going to substitute <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_eb4abeadbac893437197dcaef65065d0.png" title="(x - \alpha)" style="vertical-align:-20%;" class="tex" alt="(x - \alpha)" /> in place of the <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_1a507c5494969dc6de305770cadc6630.png" title="x" style="vertical-align:-20%;" class="tex" alt="x" /> in the above equation to get:<br />
<center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_fa1ee19decc1e63df0780f88c698e267.png" title="-2\alpha(x - \alpha)y + (1 - \alpha^2)y^2 = 1 + \alpha^2" style="vertical-align:-20%;" class="tex" alt="-2\alpha(x - \alpha)y + (1 - \alpha^2)y^2 = 1 + \alpha^2" /></center></p>
<p>We can easily verify that the point <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_899c0ad792ee5fca9071f5bbeb6fc9ad.png" title="(0,1)" style="vertical-align:-20%;" class="tex" alt="(0,1)" /> is on the curve.  And, we can implicitly differentiate the above to get:<br />
<center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_e3c61432dce722a22bd63f345ff46dfb.png" title="-2\alpha(x - \alpha)\frac{dy}{dx} - 2\alpha{}y + 2(1 - \alpha^2)y\frac{dy}{dx} = 0" style="vertical-align:-20%;" class="tex" alt="-2\alpha(x - \alpha)\frac{dy}{dx} - 2\alpha{}y + 2(1 - \alpha^2)y\frac{dy}{dx} = 0" /></center><br />
Plopping <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_055bb38e2223c10cbcfd8330867c873f.png" title="x = 0" style="vertical-align:-20%;" class="tex" alt="x = 0" /> and <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_409ec858a4679ef8370133dc2076b0b0.png" title="y = 1" style="vertical-align:-20%;" class="tex" alt="y = 1" /> in there, we find that <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_72e4810a86292a1519a296309402d06c.png" title="\frac{dy}{dx} = \alpha" style="vertical-align:-20%;" class="tex" alt="\frac{dy}{dx} = \alpha" />.</p>
<p>This is pretty good as it goes.  The only step is to complete the square to find a nicer expression for <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_e561f1e00880abb7e58816455af00a48.png" title="y" style="vertical-align:-20%;" class="tex" alt="y" /> in terms of <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_1a507c5494969dc6de305770cadc6630.png" title="x" style="vertical-align:-20%;" class="tex" alt="x" />.  We start by adding <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_62383f7ea78be0903e109947ea724843.png" title="\left[ \frac{\alpha}{\sqrt{1 - \alpha^2}} (x - \alpha) \right]^2" style="vertical-align:-20%;" class="tex" alt="\left[ \frac{\alpha}{\sqrt{1 - \alpha^2}} (x - \alpha) \right]^2" /> to both sides to get:<br />
<center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_9e6cf43c71372d26b0e06677ad2ac25c.png" title="\left[ \sqrt(1 - \alpha^2)y - \frac{\alpha}{\sqrt{1 - \alpha^2}(x - \alpha)} \right]^2 = 1 + \alpha^2 + \frac{\alpha}{1 - \alpha^2} (x-\alpha)^2" style="vertical-align:-20%;" class="tex" alt="\left[ \sqrt(1 - \alpha^2)y - \frac{\alpha}{\sqrt{1 - \alpha^2}(x - \alpha)} \right]^2 = 1 + \alpha^2 + \frac{\alpha}{1 - \alpha^2} (x-\alpha)^2" /></center></p>
<p>This is easy enough to solve for <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_e561f1e00880abb7e58816455af00a48.png" title="y" style="vertical-align:-20%;" class="tex" alt="y" /> by taking the square root of both sides and shuffling some things about:<br />
<center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_bec4a5b2c46a0636d3a736f5a68e1a5b.png" title="y = \frac{\alpha}{1 - \alpha^2}(x - \alpha) + \frac{1}{\sqrt{1 - \alpha^2}} \sqrt{1 + \alpha^2 + \frac{\alpha^2}{1 - \alpha^2}(x - \alpha)^2}" style="vertical-align:-20%;" class="tex" alt="y = \frac{\alpha}{1 - \alpha^2}(x - \alpha) + \frac{1}{\sqrt{1 - \alpha^2}} \sqrt{1 + \alpha^2 + \frac{\alpha^2}{1 - \alpha^2}(x - \alpha)^2}" /></center></p>
<p>Here are all three curves with <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_3fa6bf5c636b83a0ae3d01c31d078f76.png" title="\alpha = \frac{1}{4}" style="vertical-align:-20%;" class="tex" alt="\alpha = \frac{1}{4}" />.  The exponential is in black, the hyperbolic tangent is in red, and the hyperbola is in blue:<br />
<center><a href="http://nklein.com/wp-content/uploads/2010/02/final.png"><img src="http://nklein.com/wp-content/uploads/2010/02/final.png" alt="" title="final" width="522" height="322" class="alignnone size-full wp-image-1218" /></a></center></p>
<p>The first image on the page here was made with Zach&#8217;s <a href="http://www.xach.com/lisp/vecto/">Vecto</a> library with some post-processing in the GIMP.  (Here is the source file: <a href="http://nklein.com/wp-content/uploads/2010/02/hyperbola.lisp">hyperbola.lisp</a>.) The second image was made entirely within the GIMP.  And, the last image was made using <a href="http://fooplot.com/">Foo Plot</a> and the GIMP.</p>
]]></content:encoded>
			<wfw:commentRss>http://nklein.com/2010/02/finding-the-perfect-hyperbola/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Casting to Integers Considered Harmful</title>
		<link>http://nklein.com/2009/08/casting-to-integers-considered-harmful/</link>
		<comments>http://nklein.com/2009/08/casting-to-integers-considered-harmful/#comments</comments>
		<pubDate>Thu, 06 Aug 2009 18:46:14 +0000</pubDate>
		<dc:creator>pat</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[geometry]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[lisp]]></category>
		<category><![CDATA[objective c]]></category>
		<category><![CDATA[rounding]]></category>

		<guid isPermaLink="false">http://nklein.com/?p=707</guid>
		<description><![CDATA[Background
Many years back, I wrote some ambient music generation code.  The basic structure of the code is this:  Take one queen and twenty or so drones in a thirty-two dimensional space.  Give them each random positions and velocities.  Limit the velocity and acceleration of the queen more than you limit the [...]]]></description>
			<content:encoded><![CDATA[<h3>Background</h3>
<p>Many years back, I wrote <a href="http://old.nklein.com/products/rmusic/">some ambient <q>music</q> generation code</a>.  The basic structure of the code is this:  Take one <q>queen</q> and twenty or so <q>drones</q> in a thirty-two dimensional space.  Give them each random positions and velocities.  Limit the velocity and acceleration of the queen more than you limit the same for the drones.  Now, select some point at random for the queen to target.  Have the queen accelerate toward that target.  Have the drones accelerate toward the queen.  Use the average distance from the drones to the queens in the <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_5477186a84cc2c889974ca6fd01ca96f.png" title="i" style="vertical-align:-20%;" class="tex" alt="i" />-th dimension as the volume of the <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_5477186a84cc2c889974ca6fd01ca96f.png" title="i" style="vertical-align:-20%;" class="tex" alt="i" />-th note where the notes are logarithmically spaced across one octave.  Clip negative volumes to zero.  Every so often, or when the queen gets close to the target, give the queen a new target.</p>
<p>It makes for some interesting ambient noise that sounds a bit like movie space noises where the lumbering enemy battleship is looming in orbit as its center portion spins to create artificial gravity within.</p>
<p>I started working on an iPhone application based on this code.  The original code was in C++.  The conversion to Objective C was fairly straightforward and fairly painless (as I used the opportunity to try to <a href="http://nklein.com/2009/02/sapir-whorf-wit-programming-languages/">correct my own faults</a> by breaking things out into separate functions more often).</p>
<h3>Visualization troubles</h3>
<p><a href="http://nklein.com/wp-content/uploads/2009/08/uniform.png"><img src="http://nklein.com/wp-content/uploads/2009/08/uniform-300x225.png" alt="uniform" title="uniform" width="300" height="225" class="alignright size-medium wp-image-709" /></a><br />
The original code though chose random positions and velocities from uniform distributions.  The iPhone app is going to involve visualization as well as <q>auralization</q>.  The picture at the right here is a plot of five thousand points with each coordinate selected from a uniform distribution with range [-20,+20].  Because each axis value is chosen independently, it looks very unnatural.</p>
<p style="clear: both;">
<a href="http://nklein.com/wp-content/uploads/2009/08/gauss.png"><img src="http://nklein.com/wp-content/uploads/2009/08/gauss-300x225.png" alt="gauss" title="gauss" width="300" height="225" class="alignright size-medium wp-image-710" /></a><br />
What to do?  The obvious answer is to use <a href="http://en.wikipedia.org/wiki/Normal_distribution">Gaussian random variables</a> instead of uniform ones.  The picture at the right here is five thousand points with each coordinate selected from a Gaussian distribution with a standard-deviation of 10.  As you can see, this is much more natural looking.</p>
<h3 style="clear: both;">How did I generate the Gaussians?</h3>
<p>I have usually used the Box-Muller method of generating two Gaussian-distributed random variables given two uniformly-distributed random variables:</p>
<div class="codecolorer-container lisp blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="lisp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defun</span> random-gaussian <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">let</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>u1 <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">random</span> <span style="color: #cc66cc;">1.0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#40;</span>u2 <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">random</span> <span style="color: #cc66cc;">1.0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">let</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>mag <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">sqrt</span> <span style="color: #66cc66;">&#40;</span>* -<span style="color: #cc66cc;">2.0</span> <span style="color: #66cc66;">&#40;</span>log u1<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#40;</span>ang <span style="color: #66cc66;">&#40;</span>* <span style="color: #cc66cc;">2.0</span> pi u2<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#40;</span>values <span style="color: #66cc66;">&#40;</span>* mag <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">cos</span> ang<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#40;</span>* mag <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">sin</span> ang<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></div></div>
<p>But, I found an article online that <a href="http://www.taygeta.com/random/gaussian.html">shows a more numerically stable version</a>:</p>
<div class="codecolorer-container lisp blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="lisp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defun</span> random-gaussian <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; <span style="color: #66cc66;">&#40;</span>flet <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>pick-in-circle <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #66cc66;">&#40;</span>loop as u1 <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">random</span> <span style="color: #cc66cc;">1.0</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; as u2 <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">random</span> <span style="color: #cc66cc;">1.0</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; as mag-squared <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#40;</span>+ <span style="color: #66cc66;">&#40;</span>* u1 u1<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#40;</span>* u2 u2<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">when</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&lt;</span> mag-squared <span style="color: #cc66cc;">1.0</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #66cc66;">&#40;</span>values u1 u2 mag-squared<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #66cc66;">&#40;</span>multiple-value-bind <span style="color: #66cc66;">&#40;</span>u1 u2 mag-squared<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#40;</span>pick-in-circle<span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">let</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>ww <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">sqrt</span> <span style="color: #66cc66;">&#40;</span>/ <span style="color: #66cc66;">&#40;</span>* -<span style="color: #cc66cc;">2.0</span> <span style="color: #66cc66;">&#40;</span>log mag-squared<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> mag-squared<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#40;</span>values <span style="color: #66cc66;">&#40;</span>* u1 ww<span style="color: #66cc66;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#40;</span>* u2 ww<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></div></div>
<p>For a quick sanity check, I thought, <q>let&#8217;s just make sure it looks like a Gaussian.</q>  Here, I showed the code in Lisp, but the original code was in Objective-C.  I figured, <q>If I just change the function declaration, I can plop this into a short C program, run a few thousand trials into some histogram buckets, and see what I get.</q></p>
<h3>The trouble with zero</h3>
<p>So, here comes the problem with zero.  I had the following main loop:</p>
<div class="codecolorer-container c blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="c codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #339933;">#define BUCKET_COUNT 33</span><br />
<span style="color: #339933;">#define STDDEV &nbsp; &nbsp; &nbsp; 8.0</span><br />
<span style="color: #339933;">#define ITERATIONS &nbsp; 100000</span><br />
<br />
&nbsp; <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span> ii<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">;</span> ii <span style="color: #339933;">&lt;</span> ITERATIONS<span style="color: #339933;">;</span> <span style="color: #339933;">++</span>ii <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #993333;">int</span> bb <span style="color: #339933;">=</span> val_to_bucket<span style="color: #009900;">&#40;</span> STDDEV <span style="color: #339933;">*</span> gaussian<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #0000dd;">0</span> <span style="color: #339933;">&lt;=</span> bb <span style="color: #339933;">&amp;&amp;</span> bb <span style="color: #339933;">&lt;</span> BUCKET_COUNT <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #339933;">++</span>buckets<span style="color: #009900;">&#91;</span> bb <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span></div></div>
<p>I now present you with three different implementations of the <em>val_to_bucket()</em> function.</p>
<div class="codecolorer-container c blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="c codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #993333;">int</span> val_to_bucket<span style="color: #009900;">&#40;</span> <span style="color: #993333;">double</span> _val <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; <span style="color: #b1b100;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span><span style="color: #009900;">&#41;</span>_val <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span> BUCKET_COUNT <span style="color: #339933;">/</span> <span style="color: #0000dd;">2</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #993333;">int</span> val_to_bucket<span style="color: #009900;">&#40;</span> <span style="color: #993333;">double</span> _val <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; <span style="color: #b1b100;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span> _val <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span> BUCKET_COUNT <span style="color: #339933;">/</span> <span style="color: #0000dd;">2</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #993333;">int</span> val_to_bucket<span style="color: #009900;">&#40;</span> <span style="color: #993333;">double</span> _val <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; <span style="color: #b1b100;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span> _val <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span> BUCKET_COUNT <span style="color: #339933;">/</span> <span style="color: #0000dd;">2</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000dd;">1</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #0000dd;">1</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>As you can probably guess, after years or reading trick questions, only the last one actually works as far as my main loop is concerned.  Why?  Every number between -1 and +1 becomes zero when you cast the double to an integer.  That&#8217;s twice as big a range as any other integer gets.  So, for the first implementation, the middle bucket has about twice as many things in it as it should.  For the second implementation, the first bucket has more things in it than it should.  For the final implementation, the non-existent bucket before the first one is the overloaded bucket.  In the end, I used this implementation instead so that I wouldn&#8217;t even bias non-existent buckets:</p>
<div class="codecolorer-container c blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="c codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #993333;">int</span> val_to_bucket<span style="color: #009900;">&#40;</span> <span style="color: #993333;">double</span> _val <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; <span style="color: #b1b100;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #993333;">int</span><span style="color: #009900;">&#41;</span>lround<span style="color: #009900;">&#40;</span>_val<span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span> BUCKET_COUNT <span style="color: #339933;">/</span> <span style="color: #0000dd;">2</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://nklein.com/2009/08/casting-to-integers-considered-harmful/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Clifford Algebras for Rotating, Scaling, and Translating Space</title>
		<link>http://nklein.com/2009/07/clifford-algebras-for-rotating-scaling-and-translating-space/</link>
		<comments>http://nklein.com/2009/07/clifford-algebras-for-rotating-scaling-and-translating-space/#comments</comments>
		<pubDate>Mon, 06 Jul 2009 19:46:35 +0000</pubDate>
		<dc:creator>pat</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Clifford Algebras]]></category>
		<category><![CDATA[Math]]></category>
		<category><![CDATA[geometry]]></category>
		<category><![CDATA[non-commutativity]]></category>
		<category><![CDATA[quaternions]]></category>

		<guid isPermaLink="false">http://nklein.com/?p=641</guid>
		<description><![CDATA[In (very much) earlier articles, I described:

using complex numbers for rotating, translating, and scaling the plane
using Clifford algebras for rotating, translating, and scaling the plane, and
using quaternions for rotating, translating, and scaling three-dimensional space.

Today, it is time to tackle rotating, translating, and scaling three-dimensional space using Clifford algebras.
Three dimensions now instead of two
Back when we [...]]]></description>
			<content:encoded><![CDATA[<p>In (very much) earlier articles, I described:</p>
<ul>
<li><a href="http://nklein.com/2009/06/complex-numbers-for-rotating-translating-and-scaling-the-plane/">using complex numbers for rotating, translating, and scaling the plane</a></li>
<li><a href="http://nklein.com/2009/06/clifford-algebras-for-rotating-scaling-and-translating-the-plane/">using Clifford algebras for rotating, translating, and scaling the plane</a>, and</li>
<li><a href="http://nklein.com/2009/06/quaternions-for-rotating-scaling-and-translating-space/">using quaternions for rotating, translating, and scaling three-dimensional space</a>.</li>
</ul>
<p>Today, it is time to tackle rotating, translating, and scaling three-dimensional space using Clifford algebras.</p>
<h3>Three dimensions now instead of two</h3>
<p>Back when we used <a href="http://nklein.com/2009/06/clifford-algebras-for-rotating-scaling-and-translating-the-plane/">Clifford algebras to rotate, translate, and scale the plane</a>, we were using the two-dimesional Clifford algebra.  With the two-dimensional Clifford algebra, we represented two-dimensional coordinates <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_1a4d392f8222c83b05eab4d12436f9ee.png" title="(x,y)" style="vertical-align:-20%;" class="tex" alt="(x,y)" /> as <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_f016d0a338e6730b4c14a80c9f51e7de.png" title="xe_1 + ye_2" style="vertical-align:-20%;" class="tex" alt="xe_1 + ye_2" />.  It shouldn&#8217;t surprise you then to find we&#8217;re going to represent three-dimensional coordinates <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_10d9044e786da5a5d943a2f14ef42373.png" title="(x,y,z)" style="vertical-align:-20%;" class="tex" alt="(x,y,z)" /> as <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_d825155e779c833b51304bb4fbbd9769.png" title="xe_1 + ye_2 + ze_3" style="vertical-align:-20%;" class="tex" alt="xe_1 + ye_2 + ze_3" />.</p>
<p>As before, we will have <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_f0b9fc2e9f9e6a41337bfab088a53e8b.png" title="e_1e_1 = 1" style="vertical-align:-20%;" class="tex" alt="e_1e_1 = 1" /> and <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_6a064c44b0dcc96886e5ae1d73f6d7ae.png" title="e_2e_2 = 1" style="vertical-align:-20%;" class="tex" alt="e_2e_2 = 1" />.  Similarly, we will have <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_228075c2e3a70fbc1683c7c8b5b0b400.png" title="e_3e_3 = 1" style="vertical-align:-20%;" class="tex" alt="e_3e_3 = 1" />.  In the two-dimesional case, we showed that <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_869b33a0ca7c69c44255220f0a3d6b2c.png" title="e_1e_2 = -e_2e_1" style="vertical-align:-20%;" class="tex" alt="e_1e_2 = -e_2e_1" />.  By the same logic as the two-dimensional case, we also find that <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_b69bcae477b196d76a558ff103b95387.png" title="e_1e_3 = -e_3e_1" style="vertical-align:-20%;" class="tex" alt="e_1e_3 = -e_3e_1" /> and <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_4c0ff37b01b77172a1b849891c285269.png" title="e_2e_3 = - e_3e_2" style="vertical-align:-20%;" class="tex" alt="e_2e_3 = - e_3e_2" />.  We could potentially also end up multiplying <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_2c114902ec52372ed67af47f809ba7a0.png" title="e_1" style="vertical-align:-20%;" class="tex" alt="e_1" />, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_49142e125cfa1b96bdd97397c41eb8ea.png" title="e_2" style="vertical-align:-20%;" class="tex" alt="e_2" />, and <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_aafe61a61cb0ec96dc0785643f45904c.png" title="e_3" style="vertical-align:-20%;" class="tex" alt="e_3" /> all together.  This isn&#8217;t going to be equal to any combination of the other things we&#8217;ve seen so we&#8217;ll just leave it written <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_dacb1085506e5f4b7785c367531a82e4.png" title="e_1e_2e_3" style="vertical-align:-20%;" class="tex" alt="e_1e_2e_3" />.</p>
<p><span id="more-641"></span></p>
<p>Using the identities like <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_bf38e54214cbe5fc7fffd6a3c073d0d8.png" title="e_ie_j = - e_je_i" style="vertical-align:-20%;" class="tex" alt="e_ie_j = - e_je_i" /> for <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_6bedaae1f5dbc80650aabe97bf2f4ffd.png" title="i \ne j" style="vertical-align:-20%;" class="tex" alt="i \ne j" />, we can shuffle any combination of <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_2c114902ec52372ed67af47f809ba7a0.png" title="e_1" style="vertical-align:-20%;" class="tex" alt="e_1" />, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_49142e125cfa1b96bdd97397c41eb8ea.png" title="e_2" style="vertical-align:-20%;" class="tex" alt="e_2" />, and <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_aafe61a61cb0ec96dc0785643f45904c.png" title="e_3" style="vertical-align:-20%;" class="tex" alt="e_3" /> so that all of the indexes are in order.  We may have to change the sign, but we won&#8217;t have to change anything else.  For example:</p>
<p><center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_7aff909f0527da2560defa3dcb823217.png" title="\begin{array}{rcl} e_3e_2e_1 &#038;=&#038; - e_3e_1e_2 \\ &#038;=&#038; e_1e_3e_2 \\ &#038;=&#038; -e_1e_2e_3\end{array}" style="vertical-align:-20%;" class="tex" alt="\begin{array}{rcl} e_3e_2e_1 &#038;=&#038; - e_3e_1e_2 \\ &#038;=&#038; e_1e_3e_2 \\ &#038;=&#038; -e_1e_2e_3\end{array}" /></center></p>
<p><center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_c823f4d15275faf9ac57d01b747fd393.png" title="\begin{array}{rcl} e_2e_3e_1 &#038;=&#038; - e_2e_1e_3 \\ &#038;=&#038; e_1e_2e_3\end{array}" style="vertical-align:-20%;" class="tex" alt="\begin{array}{rcl} e_2e_3e_1 &#038;=&#038; - e_2e_1e_3 \\ &#038;=&#038; e_1e_2e_3\end{array}" /></center></p>
<p>Recall that <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_e9c8fd68601f63402a7bd894cde3668a.png" title="e_1e_2" style="vertical-align:-20%;" class="tex" alt="e_1e_2" /> was a <q>bivector</q>.  Here, we have added one more vector: <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_aafe61a61cb0ec96dc0785643f45904c.png" title="e_3" style="vertical-align:-20%;" class="tex" alt="e_3" />,  two more bivectors:  <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_124a9d6099ff4facd359b73fcfac244a.png" title="e_1e_3" style="vertical-align:-20%;" class="tex" alt="e_1e_3" /> and <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_168fbdacc604237fb4beec3d8b023755.png" title="e_2e_3" style="vertical-align:-20%;" class="tex" alt="e_2e_3" />, and a trivector <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_dacb1085506e5f4b7785c367531a82e4.png" title="e_1e_2e_3" style="vertical-align:-20%;" class="tex" alt="e_1e_2e_3" />.  The general element of the three-dimensional Clifford algebra looks like:</p>
<p><center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_8c1ce5afdbd3d18026f9fd8b2fc4d03c.png" title="a + be_1 + ce_2 + de_3 + ke_1e_2 + m e_1e_3 + n e_2e_3 + p e_1e_2e_3" style="vertical-align:-20%;" class="tex" alt="a + be_1 + ce_2 + de_3 + ke_1e_2 + m e_1e_3 + n e_2e_3 + p e_1e_2e_3" /></center></p>
<p>For the two-dimensional Clifford algebra, we had <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_e86e6dd8549cbd5e65bd445745ef6895.png" title="4 = 2^2" style="vertical-align:-20%;" class="tex" alt="4 = 2^2" /> terms in the general element&mdash;the Clifford algebra is an algebra on a four-dimensional vector space.  For the three-dimensional Clifford algebra, we have <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_e11b8b6811b293fc18ab6c93d3c87521.png" title="8 = 2^3" style="vertical-align:-20%;" class="tex" alt="8 = 2^3" /> terms in the general element.  If we backtrack here to the one-dimensional Clifford algebra, we see that the general element looks like <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_064a16ad363ddaebcc6d9f4348160b5e.png" title="a + be_1" style="vertical-align:-20%;" class="tex" alt="a + be_1" /> meaning there are <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_99ec83cdb10d199bba24b2cca22a9104.png" title="2 = 2^1" style="vertical-align:-20%;" class="tex" alt="2 = 2^1" /> terms in the general element of the one-dimensional Clifford algebra.  If we backtrack even further, we see that for a zero-dimensional Clifford algebra, the general element looks like <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_3cad95c81df4676e1b14e93cbb0b18ae.png" title="a" style="vertical-align:-20%;" class="tex" alt="a" /> meaning there is <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_544ba5e6718dc0d7952953d2ba3399c3.png" title="1 = 2^0" style="vertical-align:-20%;" class="tex" alt="1 = 2^0" /> term in the general element of the zero-dimensional Clifford algebra.</p>
<p>This relation is going to hold for Clifford algebras in general.  If <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_98d86ac06986d02b6e40f483093b61e0.png" title="k" style="vertical-align:-20%;" class="tex" alt="k" /> is a non-negative integer, then there are <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_2e3a09cd1cc10e50762245b7c38dd1e3.png" title="2^k" style="vertical-align:-20%;" class="tex" alt="2^k" /> terms in the general element of the <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_98d86ac06986d02b6e40f483093b61e0.png" title="k" style="vertical-align:-20%;" class="tex" alt="k" />-dimensional Clifford algebra.  The <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_98d86ac06986d02b6e40f483093b61e0.png" title="k" style="vertical-align:-20%;" class="tex" alt="k" />-dimensional Clifford algebra is an algebra over a <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_2e3a09cd1cc10e50762245b7c38dd1e3.png" title="2^k" style="vertical-align:-20%;" class="tex" alt="2^k" />-dimensional vector space.  There are <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_2e3a09cd1cc10e50762245b7c38dd1e3.png" title="2^k" style="vertical-align:-20%;" class="tex" alt="2^k" /> degrees of freedom, if you like.  We won&#8217;t be using all of those degrees of freedom because we are restricting ourselves to scaling, rotating, and translating vectors.</p>
<h3>Translating and Scaling</h3>
<p>We are going to represent our points in three-dimensional space using the vector portion of our three-dimensional Clifford algebra <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_29cf51fdedf0008f3547b4ddbd6bb05e.png" title="\mathcal{C\ell}_2" style="vertical-align:-20%;" class="tex" alt="\mathcal{C\ell}_2" />.  So, a point with coordinates <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_10d9044e786da5a5d943a2f14ef42373.png" title="(x,y,z)" style="vertical-align:-20%;" class="tex" alt="(x,y,z)" /> will be <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_a9e047345faa027764c43f7ad49ad100.png" title="p = xe_1 + ye_2 + ze_3" style="vertical-align:-20%;" class="tex" alt="p = xe_1 + ye_2 + ze_3" />.</p>
<p>Just as we did in the two-dimensional case, we can scale three-space away from the origin by a factor of <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_5a4f530002151e61f4239aee0d82ad4a.png" title="s" style="vertical-align:-20%;" class="tex" alt="s" /> just by multiplying each point <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_ca7cf0e15209f0ce76a070417db0d7b2.png" title="p" style="vertical-align:-20%;" class="tex" alt="p" /> by the real number <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_5a4f530002151e61f4239aee0d82ad4a.png" title="s" style="vertical-align:-20%;" class="tex" alt="s" />.  So, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_476a107cd53243f4728d9b140df48de2.png" title="p^\prime = s p" style="vertical-align:-20%;" class="tex" alt="p^\prime = s p" />.</p>
<p>Similarly, we can translate the point <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_ca7cf0e15209f0ce76a070417db0d7b2.png" title="p" style="vertical-align:-20%;" class="tex" alt="p" /> by <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_3cad95c81df4676e1b14e93cbb0b18ae.png" title="a" style="vertical-align:-20%;" class="tex" alt="a" /> units in the x-direction, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_97f4a1ba736119e3cd4de6fca35efd6b.png" title="b" style="vertical-align:-20%;" class="tex" alt="b" /> units in the y-direction and <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_08c1898a88651cdd0a9fdb2d6ce6e8a1.png" title="c" style="vertical-align:-20%;" class="tex" alt="c" /> units in the z-direction by creating a translation vector <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_07700b600644c8f9804504d3c2ed0adf.png" title="t = ae_1 + be_2 + ce_3" style="vertical-align:-20%;" class="tex" alt="t = ae_1 + be_2 + ce_3" /> and adding it to each point <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_ca7cf0e15209f0ce76a070417db0d7b2.png" title="p" style="vertical-align:-20%;" class="tex" alt="p" /> so that <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_09e47d6213dcc2866226460b5a06c3b5.png" title="p^\prime = p + t" style="vertical-align:-20%;" class="tex" alt="p^\prime = p + t" />.</p>
<h3>Rotating three-space</h3>
<p>When we <a href="http://nklein.com/2009/06/clifford-algebras-for-rotating-scaling-and-translating-the-plane/">used Clifford algebras to rotate the xy-plane</a>, we let <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_b222214588283eec5cd883b6bd34a088.png" title="r = \cos\frac{\theta}{2} + \sin\frac{\theta}{2} e_1e_2" style="vertical-align:-20%;" class="tex" alt="r = \cos\frac{\theta}{2} + \sin\frac{\theta}{2} e_1e_2" /> and let <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_ccffd7760dde45b39baf91826bbc8278.png" title="\overline{r} = \cos\frac{\theta}{2} - \sin\frac{\theta}{2} e_1e_2" style="vertical-align:-20%;" class="tex" alt="\overline{r} = \cos\frac{\theta}{2} - \sin\frac{\theta}{2} e_1e_2" />.  Then, to rotate a point <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_ca7cf0e15209f0ce76a070417db0d7b2.png" title="p" style="vertical-align:-20%;" class="tex" alt="p" /> we multiplied out <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_dd00cba913c6a1772214da10f0c67613.png" title="r \cdot p \cdot \overline{r}" style="vertical-align:-20%;" class="tex" alt="r \cdot p \cdot \overline{r}" />.</p>
<p>Three-dimensional space contains the xy-plane.  We want to be able to rotate things in the xy-plane in just the same way we did in the two-dimensional case.  We even spent some time in another article verifying that <a href="http://nklein.com/2009/06/what-was-up-with-that-rotation-trick/">these rotations in the xy-plane would leave coordinates on other axises alone.</a></p>
<p><a href="http://nklein.com/2009/06/quaternions-for-rotating-scaling-and-translating-space/">Rotating space with the quaternions</a>, we found that could rotate around an arbitrary axis.  If we pick an axis that points from the origin to <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_33d275ba0e772f6a9f3862c1caf38bc8.png" title="(a,b,c)" style="vertical-align:-20%;" class="tex" alt="(a,b,c)" /> where <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_1b2dabdd56e27a3edaead725b9835ddb.png" title="a^2 + b^2 + c^2 = 1" style="vertical-align:-20%;" class="tex" alt="a^2 + b^2 + c^2 = 1" />, then we used the quaternion <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_5b016a7d9e6009879ff68f974b3b8d88.png" title="\alpha + \beta ai + \beta bj + \beta ck" style="vertical-align:-20%;" class="tex" alt="\alpha + \beta ai + \beta bj + \beta ck" /> (where <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_f5e527d80ebce3eda18d8f795c336bd9.png" title="\alpha = \cos\frac{\theta}{2}" style="vertical-align:-20%;" class="tex" alt="\alpha = \cos\frac{\theta}{2}" /> and <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_64d7a975386a7ebd12a312cd77b92c4c.png" title="\beta = \sin\frac{\theta}{2}" style="vertical-align:-20%;" class="tex" alt="\beta = \sin\frac{\theta}{2}" /> just like we used the two-dimensional Clifford algebra rotation.  We let <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_92ef35fc51bca3a9676c5f7efba1bb4f.png" title="r = \alpha + \beta ( ai + bj + ck )" style="vertical-align:-20%;" class="tex" alt="r = \alpha + \beta ( ai + bj + ck )" />and <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_b7202c13bc7ef3a34553b276c46c09f2.png" title="\overline{r} = \alpha - \beta ( ai + bj + ck )" style="vertical-align:-20%;" class="tex" alt="\overline{r} = \alpha - \beta ( ai + bj + ck )" />.  Then, we could rotate a point <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_2d67de5bf1e94ebea634b0cb5b7b777d.png" title="p = xi + yj + zk" style="vertical-align:-20%;" class="tex" alt="p = xi + yj + zk" /> by evaluating <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_e1164c990a4f95b320d44ce1b292efd1.png" title="p^\prime = r \cdot p \cdot \overline{r}" style="vertical-align:-20%;" class="tex" alt="p^\prime = r \cdot p \cdot \overline{r}" />.</p>
<p>With Clifford algebras, we don&#8217;t mush together translations and rotations both into the vector portion.  We keep translations in the vector portion, but we move rotations to the bivector portion.  We&#8217;re going to rotate around the axis from the origin to <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_33d275ba0e772f6a9f3862c1caf38bc8.png" title="(a,b,c)" style="vertical-align:-20%;" class="tex" alt="(a,b,c)" /> (where <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_1b2dabdd56e27a3edaead725b9835ddb.png" title="a^2 + b^2 + c^2 = 1" style="vertical-align:-20%;" class="tex" alt="a^2 + b^2 + c^2 = 1" /> by an angle <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_0004c76178a1d078888badee6891a8bd.png" title="\theta" style="vertical-align:-20%;" class="tex" alt="\theta" /> by letting <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_a9c5e035fcadb4908e78ad23764ca5df.png" title="r = \alpha + \beta ( a e_2e_3 + b e_3e_1 + c e_1e_2 )" style="vertical-align:-20%;" class="tex" alt="r = \alpha + \beta ( a e_2e_3 + b e_3e_1 + c e_1e_2 )" /><br />
and <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_d69b00e3f520c12db230ae3010667508.png" title="\overline{r} = \alpha - \beta ( a e_2e_3 + b e_3e_1 + c e_1 e_2 )" style="vertical-align:-20%;" class="tex" alt="\overline{r} = \alpha - \beta ( a e_2e_3 + b e_3e_1 + c e_1 e_2 )" /> where <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_f5e527d80ebce3eda18d8f795c336bd9.png" title="\alpha = \cos\frac{\theta}{2}" style="vertical-align:-20%;" class="tex" alt="\alpha = \cos\frac{\theta}{2}" /> and <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_64d7a975386a7ebd12a312cd77b92c4c.png" title="\beta = \sin\frac{\theta}{2}" style="vertical-align:-20%;" class="tex" alt="\beta = \sin\frac{\theta}{2}" />.  Then, we can rotate a point <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_a9e047345faa027764c43f7ad49ad100.png" title="p = xe_1 + ye_2 + ze_3" style="vertical-align:-20%;" class="tex" alt="p = xe_1 + ye_2 + ze_3" /> just by multiplying on the left by <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_de3adc820dbc4655c45b5555765fe84b.png" title="r" style="vertical-align:-20%;" class="tex" alt="r" /> and on the right by <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_c3e378eef52a54860a6eca39bcf44568.png" title="\overline{r}" style="vertical-align:-20%;" class="tex" alt="\overline{r}" /> so that <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_56d3a94850235bda314242f6aaa8ed90.png" title="p^\prime = r\cdot p \cdot \overline{r}" style="vertical-align:-20%;" class="tex" alt="p^\prime = r\cdot p \cdot \overline{r}" />.</p>
<p>I wrote <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_de3adc820dbc4655c45b5555765fe84b.png" title="r" style="vertical-align:-20%;" class="tex" alt="r" /> a little differently here than I did above for the general element.  If I were to keep totally consistent with what I wrote above, I should write <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_fee4614c6b0c14728e634ea7f63d5049.png" title="r = \alpha + \beta( c e_1e_2 - b e_1e_3 + a e_2e_3 )" style="vertical-align:-20%;" class="tex" alt="r = \alpha + \beta( c e_1e_2 - b e_1e_3 + a e_2e_3 )" />.  Certainly, we can add in any order, so it is totally cosmetic to write it one way or the other.  I chose to keep <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_3cad95c81df4676e1b14e93cbb0b18ae.png" title="a" style="vertical-align:-20%;" class="tex" alt="a" />, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_97f4a1ba736119e3cd4de6fca35efd6b.png" title="b" style="vertical-align:-20%;" class="tex" alt="b" />, and <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_08c1898a88651cdd0a9fdb2d6ce6e8a1.png" title="c" style="vertical-align:-20%;" class="tex" alt="c" /> in order rather than <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_e9c8fd68601f63402a7bd894cde3668a.png" title="e_1e_2" style="vertical-align:-20%;" class="tex" alt="e_1e_2" />, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_124a9d6099ff4facd359b73fcfac244a.png" title="e_1e_3" style="vertical-align:-20%;" class="tex" alt="e_1e_3" />, and <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_168fbdacc604237fb4beec3d8b023755.png" title="e_2e_3" style="vertical-align:-20%;" class="tex" alt="e_2e_3" />.  I also chose to keep them all positive at the expense of using <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_e9d56cd1d1a289c57107055e5e77c132.png" title="e_3e_1" style="vertical-align:-20%;" class="tex" alt="e_3e_1" /> instead of <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_124a9d6099ff4facd359b73fcfac244a.png" title="e_1e_3" style="vertical-align:-20%;" class="tex" alt="e_1e_3" />.</p>
<p>Before we get into why we used <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_e9d56cd1d1a289c57107055e5e77c132.png" title="e_3e_1" style="vertical-align:-20%;" class="tex" alt="e_3e_1" /> instead of <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_124a9d6099ff4facd359b73fcfac244a.png" title="e_1e_3" style="vertical-align:-20%;" class="tex" alt="e_1e_3" /> for the <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_97f4a1ba736119e3cd4de6fca35efd6b.png" title="b" style="vertical-align:-20%;" class="tex" alt="b" />, let&#8217;s look at the case of rotating around the z-axis.  In that case, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_33d275ba0e772f6a9f3862c1caf38bc8.png" title="(a,b,c)" style="vertical-align:-20%;" class="tex" alt="(a,b,c)" /> would be <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_13d754fd5e90c96667ea7dd84ae3e197.png" title="(0,0,1)" style="vertical-align:-20%;" class="tex" alt="(0,0,1)" />.  This should degenerate to exactly what we had for <a href="http://nklein.com/2009/06/clifford-algebras-for-rotating-scaling-and-translating-the-plane/">rotating the xy-plane with Clifford algebras</a>.  Sure enough, if we plop those values in for <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_3cad95c81df4676e1b14e93cbb0b18ae.png" title="a" style="vertical-align:-20%;" class="tex" alt="a" />, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_97f4a1ba736119e3cd4de6fca35efd6b.png" title="b" style="vertical-align:-20%;" class="tex" alt="b" />, and <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_08c1898a88651cdd0a9fdb2d6ce6e8a1.png" title="c" style="vertical-align:-20%;" class="tex" alt="c" /> we find that <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_ca2b35e3fc34e88635233c7e98eb1dbe.png" title="r = \alpha + \beta e_1e_2" style="vertical-align:-20%;" class="tex" alt="r = \alpha + \beta e_1e_2" /> exactly as we had in the two-dimensional case.  Bonus!</p>
<p>Why should the <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_97f4a1ba736119e3cd4de6fca35efd6b.png" title="b" style="vertical-align:-20%;" class="tex" alt="b" /> end up with <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_e9d56cd1d1a289c57107055e5e77c132.png" title="e_3e_1" style="vertical-align:-20%;" class="tex" alt="e_3e_1" /> instead of <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_124a9d6099ff4facd359b73fcfac244a.png" title="e_1e_3" style="vertical-align:-20%;" class="tex" alt="e_1e_3" />?  The way that our axis system worked with the quaternions is that we had the x-axis going east, the y-axis going north, and the z-axis going up.  If we are going to rotate around the y-axis, then we need to rotate the z-axis toward the x-axis as opposed to rotating the x-axis toward the z-axis.  The rotation around the z-axis takes the x-axis toward the y-axis.  This is represented with the <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_e9c8fd68601f63402a7bd894cde3668a.png" title="e_1e_2" style="vertical-align:-20%;" class="tex" alt="e_1e_2" />.  <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_2c114902ec52372ed67af47f809ba7a0.png" title="e_1" style="vertical-align:-20%;" class="tex" alt="e_1" /> is the x-axis and it is moving toward the y-axis <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_49142e125cfa1b96bdd97397c41eb8ea.png" title="e_2" style="vertical-align:-20%;" class="tex" alt="e_2" />.  If we reverse the order, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_6c6074f3096a0987da7b46dcf75158b1.png" title="e_2e_1" style="vertical-align:-20%;" class="tex" alt="e_2e_1" />, then we are moving the y-axis toward the x-axis.  Using our transposing tricks, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_91ace962a3556f41bd7ca29abd5250a8.png" title="e_2e_1 = -e_1e_2" style="vertical-align:-20%;" class="tex" alt="e_2e_1 = -e_1e_2" />.  Thus, rotating the y-axis toward the x-axis is just negatively rotating the x-axis toward the y-axis.  In better English, that is:  rotating the y-axis toward the x-axis is just rotating the x-axis away from the y-axis.</p>
<p>If we had chosen <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_124a9d6099ff4facd359b73fcfac244a.png" title="e_1e_3" style="vertical-align:-20%;" class="tex" alt="e_1e_3" /> instead of <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_e9d56cd1d1a289c57107055e5e77c132.png" title="e_3e_1" style="vertical-align:-20%;" class="tex" alt="e_3e_1" />, then we would have messed up how our axises fit together.  To keep the axis of rotation obvious, we used <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_e4942a155cbb6d051b2f65b68c1f1365.png" title="(a e_2e_3 + b e_3e_1 + c e_1e_2 )" style="vertical-align:-20%;" class="tex" alt="(a e_2e_3 + b e_3e_1 + c e_1e_2 )" />.  We can still rewrite the result in any form we like.  If we were given <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_238ad6853d20d5ec43a7447145ae2c4a.png" title="r = \alpha + \beta ( A e_1e_2 + B e_1e_3 + C e_2e_3 )" style="vertical-align:-20%;" class="tex" alt="r = \alpha + \beta ( A e_1e_2 + B e_1e_3 + C e_2e_3 )" />, that would be a rotation around the axis from the origin to the point <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_fa091439dbbb3f543eef715f3f8277e2.png" title="(C,-B,A)" style="vertical-align:-20%;" class="tex" alt="(C,-B,A)" />.  I think it&#8217;s more intuitive to write <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_de3adc820dbc4655c45b5555765fe84b.png" title="r" style="vertical-align:-20%;" class="tex" alt="r" /> as <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_8e317ed548344d0f26b3c289c45602a3.png" title="\alpha + \beta ( C e_2e_3 - B e_3e_1 + A e_1e_2 )" style="vertical-align:-20%;" class="tex" alt="\alpha + \beta ( C e_2e_3 - B e_3e_1 + A e_1e_2 )" /> because then you can read the axis of rotation right off of the coefficients.</p>
<h3>Next time</h3>
<p>Next time, we&#8217;ll tackle rotating, scaling, and translating hyperspace (four-dimensional space).</p>
]]></content:encoded>
			<wfw:commentRss>http://nklein.com/2009/07/clifford-algebras-for-rotating-scaling-and-translating-space/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quaternions for Rotating, Scaling, and Translating Space</title>
		<link>http://nklein.com/2009/06/quaternions-for-rotating-scaling-and-translating-space/</link>
		<comments>http://nklein.com/2009/06/quaternions-for-rotating-scaling-and-translating-space/#comments</comments>
		<pubDate>Thu, 11 Jun 2009 20:35:20 +0000</pubDate>
		<dc:creator>pat</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Clifford Algebras]]></category>
		<category><![CDATA[Math]]></category>
		<category><![CDATA[geometry]]></category>
		<category><![CDATA[non-commutativity]]></category>
		<category><![CDATA[quaternions]]></category>

		<guid isPermaLink="false">http://nklein.com/?p=544</guid>
		<description><![CDATA[In earlier posts, I described how complex numbers can be used to rotate, scale, and translate the plane, how Clifford algebras can be used to rotate, scale, and translate the plane, and why I resorted to an awkward trick for the Clifford algebra rotations of the plane.  In this post, I am going to [...]]]></description>
			<content:encoded><![CDATA[<p>In earlier posts, I described how <a href="http://nklein.com/2009/06/complex-numbers-for-rotating-translating-and-scaling-the-plane/">complex numbers can be used to rotate, scale, and translate the plane</a>, how <a href="http://nklein.com/2009/06/clifford-algebras-for-rotating-scaling-and-translating-the-plane/">Clifford algebras can be used to rotate, scale, and translate the plane</a>, and why I resorted to <a href="http://nklein.com/2009/06/what-was-up-with-that-rotation-trick/">an awkward trick for the Clifford algebra rotations of the plane</a>.  In this post, I am going to explain what the quaternions are and describe how they can be used to represent a rotation in three-dimensional space.</p>
<h3>What are the quaternions</h3>
<p>Okay, remember how we got the <a href="http://nklein.com/2009/06/complex-numbers-for-rotating-translating-and-scaling-the-plane/">complex numbers</a>?  We needed something that was the square root of negative one.</p>
<p>Now, imagine that you are <a href="http://en.wikipedia.org/wiki/William_Rowan_Hamilton">Sir William Rowan Hamilton</a>.  The year is 1843.  It is springtime.  You know how to use the complex numbers to represent points in the plane.  And, you know that when you do that, you can use complex numbers to rotate, scale, and translate the points.  That&#8217;s all well and good, but you don&#8217;t live in a two-dimensional world.  How are you going to do the same sort of thing with three-dimensional space?  How are you going to <q>multiply triples</q>?</p>
<p>You spend months on this.  If only you could say, <q>How about I let there be another number that is different from <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_5477186a84cc2c889974ca6fd01ca96f.png" title="i" style="vertical-align:-20%;" class="tex" alt="i" /> (and from <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_e76a7ef4a6c63544bcc391a3c25cdc85.png" title="-i" style="vertical-align:-20%;" class="tex" alt="-i" />) that has the same property that its square is negative one?</q>  You fight with this for months.  You try to represent a point with coordinates <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_10d9044e786da5a5d943a2f14ef42373.png" title="(x,y,z)" style="vertical-align:-20%;" class="tex" alt="(x,y,z)" /> as <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_0bdacc6716a3fb38f2029c7901f28ba2.png" title="x + yi + zj" style="vertical-align:-20%;" class="tex" alt="x + yi + zj" />.  But, nothing you come up with makes any sense.</p>
<p>Your kids are harassing you, <q>Daddy, did you figure out how to multiply triples yet?</q>  You have to answer them every morning with a polite, <q>No, not yet.</q></p>
<p>Then, you&#8217;re walking along the Royal Canal in Dublin.  It&#8217;s mid-October already.  My, how the year has flown by.  Bam, it hits you.  If you add a third number like <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_5477186a84cc2c889974ca6fd01ca96f.png" title="i" style="vertical-align:-20%;" class="tex" alt="i" /> and <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_33c9ab784156bc3b75c894b91ea4ecf8.png" title="j" style="vertical-align:-20%;" class="tex" alt="j" /> which is equal to <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_af21d08d52909621afbe4a86b3d67221.png" title="i\cdot j" style="vertical-align:-20%;" class="tex" alt="i\cdot j" />, everything works out.  You get so excited, that you carve your equations into a stone bridge over the canal:<br />
<center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_7d543957dddff5e402fe4dae3f9dd48c.png" title="i^2 = j^2 = k^2 = ijk = -1" style="vertical-align:-20%;" class="tex" alt="i^2 = j^2 = k^2 = ijk = -1" /></center></p>
<p><span id="more-544"></span></p>
<p>Now, instead of trying to represent <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_10d9044e786da5a5d943a2f14ef42373.png" title="(x,y,z)" style="vertical-align:-20%;" class="tex" alt="(x,y,z)" /> as <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_0bdacc6716a3fb38f2029c7901f28ba2.png" title="x + yi + zj" style="vertical-align:-20%;" class="tex" alt="x + yi + zj" />, it is represented as <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_b4d5c8e9c78fc19534c97e29f9c992a3.png" title="xi + yj + zk" style="vertical-align:-20%;" class="tex" alt="xi + yj + zk" />.  Immediately, this looks like an improvement.  Before, things were not symmetric.  Squaring something that was only in the x-direction was fundamentally different than squaring something that was only in the y- or z-direction because <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_c8335f9f20b8f019e45bb485c2d96813.png" title="x^2 = x^2" style="vertical-align:-20%;" class="tex" alt="x^2 = x^2" />, but <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_6619b4711bf1cf5342fdba64db358222.png" title="(yj)^2 = y^2j^2 = -y^2" style="vertical-align:-20%;" class="tex" alt="(yj)^2 = y^2j^2 = -y^2" />.  Now, at least, there is no singled-out axis.</p>
<p>Let&#8217;s just explore the <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_91b228d98f9dc1411f17be394aa083bc.png" title="ijk = -1" style="vertical-align:-20%;" class="tex" alt="ijk = -1" /> part for a minute.  If we multiply both sides (on the right) by <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_f0542c94aef002d5abdf2e810cd7a5a6.png" title="-k" style="vertical-align:-20%;" class="tex" alt="-k" />, we see that: <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_3d1670d1f558660ee20346a962a6cabe.png" title="-ijk^2 = ij = k" style="vertical-align:-20%;" class="tex" alt="-ijk^2 = ij = k" />.  If, instead, we multiply by <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_e76a7ef4a6c63544bcc391a3c25cdc85.png" title="-i" style="vertical-align:-20%;" class="tex" alt="-i" /> on the left, we see that <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_19412431b34ebf4705449738b491a9c3.png" title="-i^2jk = jk = i" style="vertical-align:-20%;" class="tex" alt="-i^2jk = jk = i" />.  If we take that <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_01e5a99d5bdf0dfdac66aa84b94eaf87.png" title="jk = i" style="vertical-align:-20%;" class="tex" alt="jk = i" /> and multiply on the right by <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_f0542c94aef002d5abdf2e810cd7a5a6.png" title="-k" style="vertical-align:-20%;" class="tex" alt="-k" />, we get <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_959f0da8505843b73715407aabce2d12.png" title="-jk^2 = j = -ik" style="vertical-align:-20%;" class="tex" alt="-jk^2 = j = -ik" />.  We&#8217;re going to show in a minute that <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_759331fe3e3bd86972e8c4aa97b4c073.png" title="-ik = ki" style="vertical-align:-20%;" class="tex" alt="-ik = ki" />.  So, if take <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_5477186a84cc2c889974ca6fd01ca96f.png" title="i" style="vertical-align:-20%;" class="tex" alt="i" />, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_33c9ab784156bc3b75c894b91ea4ecf8.png" title="j" style="vertical-align:-20%;" class="tex" alt="j" />, and <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_98d86ac06986d02b6e40f483093b61e0.png" title="k" style="vertical-align:-20%;" class="tex" alt="k" /> in that order and take two in a row (wrapping around if needed), the product is the next one:  <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_de473fe51c0a430b2e12d50cbe90d40a.png" title="ij = k" style="vertical-align:-20%;" class="tex" alt="ij = k" />, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_01e5a99d5bdf0dfdac66aa84b94eaf87.png" title="jk = i" style="vertical-align:-20%;" class="tex" alt="jk = i" />, and <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_d957b89279aa3fe8dba761e8fb821eb1.png" title="ki =j" style="vertical-align:-20%;" class="tex" alt="ki =j" />.</p>
<p>So, how do we show that <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_759331fe3e3bd86972e8c4aa97b4c073.png" title="-ik = ki" style="vertical-align:-20%;" class="tex" alt="-ik = ki" />?  Well, it&#8217;s pretty simple to show that <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_d28ae9bf009612af9adf0eaa46837b45.png" title="kj = -i" style="vertical-align:-20%;" class="tex" alt="kj = -i" />.  We already know that <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_91b228d98f9dc1411f17be394aa083bc.png" title="ijk = -1" style="vertical-align:-20%;" class="tex" alt="ijk = -1" />.  So, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_b7b7dc442570aae66fffec9eaa3f90e7.png" title="kj = -(ijk)(kj) = -ijk^2j" style="vertical-align:-20%;" class="tex" alt="kj = -(ijk)(kj) = -ijk^2j" />.  We know that <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_1e4a437781d97da12aea9f9fa4a817f1.png" title="k^2 = -1" style="vertical-align:-20%;" class="tex" alt="k^2 = -1" />, so <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_5722c6099f927a5717436a4ba1286dc5.png" title="-ijk^2j = ij^2" style="vertical-align:-20%;" class="tex" alt="-ijk^2j = ij^2" />.  And, we know that <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_47fc0bf7545ab5ee7a3f18951ef9ec64.png" title="j^2 = -1" style="vertical-align:-20%;" class="tex" alt="j^2 = -1" />, so <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_dbd23478e0424b3052d55a6af5e852a8.png" title="ij^2 = -i" style="vertical-align:-20%;" class="tex" alt="ij^2 = -i" />.  And, since we already know that <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_01e5a99d5bdf0dfdac66aa84b94eaf87.png" title="jk = i" style="vertical-align:-20%;" class="tex" alt="jk = i" />,  we have <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_23d3443406ed411c6859f92cbc02cb16.png" title="kj = -i = -jk" style="vertical-align:-20%;" class="tex" alt="kj = -i = -jk" />.  We can use this, then to manipulate <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_109e4527709ee342d513e62dab402928.png" title="-ik" style="vertical-align:-20%;" class="tex" alt="-ik" />.  <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_7e8e42c9ef7b727051bed0313e46d236.png" title="-ik = (-jk)k = (kj)k = k(jk) = ki" style="vertical-align:-20%;" class="tex" alt="-ik = (-jk)k = (kj)k = k(jk) = ki" />.  We can do a similar thing to show that <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_912860c1150fbbec17923dc4d7f2c39b.png" title="-ij = ji" style="vertical-align:-20%;" class="tex" alt="-ij = ji" />.</p>
<p>This should look familiar from the <a href="http://nklein.com/2009/06/clifford-algebras-for-rotating-scaling-and-translating-the-plane/">the Clifford algebras</a>.  In the Clifford algebras, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_869b33a0ca7c69c44255220f0a3d6b2c.png" title="e_1e_2 = -e_2e_1" style="vertical-align:-20%;" class="tex" alt="e_1e_2 = -e_2e_1" />.  Here, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_3f3413156bf2247b559e3ba02a71d626.png" title="ij = -ji" style="vertical-align:-20%;" class="tex" alt="ij = -ji" />.  It turns out that this is extra important in three-dimensions compared to two.</p>
<p><a href="http://nklein.com/wp-content/uploads/2009/06/dice.png"><img src="http://nklein.com/wp-content/uploads/2009/06/dice-300x240.png" alt="dice" title="dice" width="300" height="240" class="alignright size-medium wp-image-546" /></a></p>
<p>In two dimensions, if you rotate by an angle <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_0004c76178a1d078888badee6891a8bd.png" title="\theta" style="vertical-align:-20%;" class="tex" alt="\theta" /> and then by and angle <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_949758cd9e9d69018875081f46e96eb1.png" title="\phi" style="vertical-align:-20%;" class="tex" alt="\phi" />, it is the same thing as if you rotate by the angle <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_949758cd9e9d69018875081f46e96eb1.png" title="\phi" style="vertical-align:-20%;" class="tex" alt="\phi" /> and then by the angle <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_0004c76178a1d078888badee6891a8bd.png" title="\theta" style="vertical-align:-20%;" class="tex" alt="\theta" />.  In three-dimensions, you have more options.  In addition to picking the angle, you can also pick the axis of rotation.  (Actually, for later on, it may be helpful to think of picking the plane parallel to which the rotation will take place rather than thinking of it as an axis.)  In the picture at the right, the die in the back is the original position of a die.  The die on the left is the result of rotating the original die a quarter turn on its left face (orange arrow) and then a quarter turn on its right face (blue arrow).  The die on the right is the result of rotating the original die around its right face (blue arrow) and then its left face (orange arrow).  As you can see, the resulting positions are different.</p>
<p>[Ugh... I just realized the free model of a die that I downloaded is not an actual, legal die.  If it were, the opposite faces would sum to seven.  Clearly, however, the two and the five are on adjacent faces of this die, as are the three and four, and thus also the one and six.  Erf.  So, you can't repeat this experiment on your desktop unless you fabricate your own die.  Sorry.]</p>
<p>Like the Clifford algebras and the complex numbers, addition and subtraction are simply adding and subtracting (respectively, of course) the corresponding parts.<br />
<center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_cfb2f7e7be1aa5e611afe88d85b807e8.png" title="(a + bi + cj + dk) + (w + xi + yj + zk) = (a+w) + (b + x)i + (c + y)j + (d + z)k" style="vertical-align:-20%;" class="tex" alt="(a + bi + cj + dk) + (w + xi + yj + zk) = (a+w) + (b + x)i + (c + y)j + (d + z)k" /></center></p>
<p>Armed with the above identities, we have enough information to multiply together quaternions.  Rather than do the full general case of <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_c58dcd66aac772d9ef71bc09544dea00.png" title="(a + bi + cj + dk)\cdot(w + xi + yj + zk)" style="vertical-align:-20%;" class="tex" alt="(a + bi + cj + dk)\cdot(w + xi + yj + zk)" />, I&#8217;m going to do a simpler case to give you the flavor without wasting a ton of space in this article beating a horse that needn&#8217;t be beaten that much.  Let&#8217;s just try:  <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_310d8052cccb15d4077f5ecb1ca7db30.png" title="(1 + 3i)\cdot(2i + 5j - k)" style="vertical-align:-20%;" class="tex" alt="(1 + 3i)\cdot(2i + 5j - k)" />.  We start with the distributive law, twice, and then combine like terms.<br />
<center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_45ea182ce18481405707eafb29e9f45d.png" title="(1 + 3i) \cdot (2i + 5j - k)" style="vertical-align:-20%;" class="tex" alt="(1 + 3i) \cdot (2i + 5j - k)" /></center><br />
<center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_1d0b0e5f89ab866ed2cb5f94d49b9ce2.png" title="(2i + 5j - k) + 3i \cdot (2i + 5j - k)" style="vertical-align:-20%;" class="tex" alt="(2i + 5j - k) + 3i \cdot (2i + 5j - k)" /></center><br />
<center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_c62e50ef55478c5f912e7f7f158306f6.png" title="(2i + 5j - k + 6i^2 + 15ij - 3ik" style="vertical-align:-20%;" class="tex" alt="(2i + 5j - k + 6i^2 + 15ij - 3ik" /></center><br />
<center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_a1799909c179c38f13c4900534a5f281.png" title="2i + 5j - k - 6 + 15k + 3ki" style="vertical-align:-20%;" class="tex" alt="2i + 5j - k - 6 + 15k + 3ki" /></center><br />
<center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_d375b01a5bdfcee11d818a1bf1c9b716.png" title="2i + 5j - k - 6 + 15k + 3j" style="vertical-align:-20%;" class="tex" alt="2i + 5j - k - 6 + 15k + 3j" /></center><br />
<center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_fad073f66ddc3b69407b592fd893c76f.png" title="-6 + 2i + 8j + 14k" style="vertical-align:-20%;" class="tex" alt="-6 + 2i + 8j + 14k" /></center></p>
<p>There is one other notation we&#8217;re going to need below.  In the complex numbers, we used the notation <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_3327729dd645dd503dc1d8f8e632d744.png" title="\overline{z}" style="vertical-align:-20%;" class="tex" alt="\overline{z}" /> to mean the number <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_645f43d7c6169f257cafd2dc973d2421.png" title="z" style="vertical-align:-20%;" class="tex" alt="z" /> with the sign of its imaginary part reversed.  So, if <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_8bda0fb3a6ee4a95e174e84732e4e4ff.png" title="z = x + yi" style="vertical-align:-20%;" class="tex" alt="z = x + yi" />, then <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_b146ee6312a66b35817fa8a2efe9d46b.png" title="\overline{z} = x - yi" style="vertical-align:-20%;" class="tex" alt="\overline{z} = x - yi" />.  With the quaternions, we are going to use <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_d2c357747d75d834f78c8a0089ea80a9.png" title="\overline{q}" style="vertical-align:-20%;" class="tex" alt="\overline{q}" /> to mean the number <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_ad82fe4a03707ce6f42cf72f2ae029be.png" title="q" style="vertical-align:-20%;" class="tex" alt="q" /> with the sing of <em>all of its imaginary parts</em> reversed.  So, if <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_0090bed48c0fcee9e0d6abe807090579.png" title="q = a + bi + cj + dk" style="vertical-align:-20%;" class="tex" alt="q = a + bi + cj + dk" />, then <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_643d80990c68ff0243d5635e442895cf.png" title="\overline{q} = a - bi - cj - dk" style="vertical-align:-20%;" class="tex" alt="\overline{q} = a - bi - cj - dk" />.</p>
<h3>Transforming Space</h3>
<p>Say you have some list of points in three-dimensional space: <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_e995436a130d4df69a0326fab250f598.png" title="(x_1,y_1,z_1)" style="vertical-align:-20%;" class="tex" alt="(x_1,y_1,z_1)" />, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_e86a9fc639fe76e19bc5e2165fbe9d6f.png" title="(x_2,y_2,z_2)" style="vertical-align:-20%;" class="tex" alt="(x_2,y_2,z_2)" />, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_4b30e31f5d5a5dbe4dcd2e370ee5d1ae.png" title="\ldots" style="vertical-align:-20%;" class="tex" alt="\ldots" />, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_8c747e2555c824abf73bd6ac50fe5493.png" title="(x_n,y_n,z_n)" style="vertical-align:-20%;" class="tex" alt="(x_n,y_n,z_n)" />.  We are going to represent those as pure quaternions: <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_e8ead658af6d05b88a6b5a7257247c71.png" title="q_1 = x_1 i + y_1 j + z_1 k" style="vertical-align:-20%;" class="tex" alt="q_1 = x_1 i + y_1 j + z_1 k" />, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_52376e9491fb01bbb9a9535006f61c34.png" title="q_2 = x_2 i + y_2 j + z_2 k" style="vertical-align:-20%;" class="tex" alt="q_2 = x_2 i + y_2 j + z_2 k" />, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_4b30e31f5d5a5dbe4dcd2e370ee5d1ae.png" title="\ldots" style="vertical-align:-20%;" class="tex" alt="\ldots" />, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_206d19ae2a5cd777a46484e793d08e23.png" title="q_n = x_ni + y_nj + z_nk" style="vertical-align:-20%;" class="tex" alt="q_n = x_ni + y_nj + z_nk" />.</p>
<p>If we want to translate them all by two units along the x-axis, three units along the y-axis and five units along the z-axis, we can set <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_bedf3b1dbe8d81b450e3f5a6213e681b.png" title="t = 2i + 3j + 5k" style="vertical-align:-20%;" class="tex" alt="t = 2i + 3j + 5k" /> and then add <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_4e156c4dfd6f5bd0adffc493c64bc7ca.png" title="t" style="vertical-align:-20%;" class="tex" alt="t" /> to each of our points:  <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_0372b8a7fb019cafe76d48b044712122.png" title="q_\alpha^\prime = q_\alpha + t" style="vertical-align:-20%;" class="tex" alt="q_\alpha^\prime = q_\alpha + t" />.</p>
<p>If we want to scale three-space out from the origin by a factor of seven, we can set <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_a9e6ca5b71520dd0e6f6e0fbad154765.png" title="s = 7" style="vertical-align:-20%;" class="tex" alt="s = 7" /> and multiply each point by <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_5a4f530002151e61f4239aee0d82ad4a.png" title="s" style="vertical-align:-20%;" class="tex" alt="s" />:  <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_27f7c8a15113b275656caf337585f009.png" title="q_\alpha^\prime = s \cdot q_\alpha^\prime" style="vertical-align:-20%;" class="tex" alt="q_\alpha^\prime = s \cdot q_\alpha^\prime" />.</p>
<p>Let&#8217;s say now, that we want to rotate our points parallel to some plane through the origin by an angle <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_0004c76178a1d078888badee6891a8bd.png" title="\theta" style="vertical-align:-20%;" class="tex" alt="\theta" />.  The first thing we need to find is some way to describe that plane.  In three-dimensions, we can simply use the <a href="http://en.wikipedia.org/wiki/Surface_normal">surface normal</a> of the plane.  It may make more sense to you to think of this as the axis of rotation.  In two- and three-dimensions, that will be fine.  In higher numbers of dimensions, this will just confuse things.  Let&#8217;s say our normal starts at the origin and goes through the point <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_33d275ba0e772f6a9f3862c1caf38bc8.png" title="(a,b,c)" style="vertical-align:-20%;" class="tex" alt="(a,b,c)" />.  To make things nice, let&#8217;s also assume it is of unit length: <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_1b2dabdd56e27a3edaead725b9835ddb.png" title="a^2 + b^2 + c^2 = 1" style="vertical-align:-20%;" class="tex" alt="a^2 + b^2 + c^2 = 1" />.  We can represent our rotation as <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_972c72c847db5ae10922210ee43a53f5.png" title="r = \cos\frac{\theta}{2} + \sin\frac{\theta}{2}\left( ai + bj + ck \right)" style="vertical-align:-20%;" class="tex" alt="r = \cos\frac{\theta}{2} + \sin\frac{\theta}{2}\left( ai + bj + ck \right)" />.  Then, we can rotate our points by multiplying on the left by <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_de3adc820dbc4655c45b5555765fe84b.png" title="r" style="vertical-align:-20%;" class="tex" alt="r" /> and on the right by <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_c3e378eef52a54860a6eca39bcf44568.png" title="\overline{r}" style="vertical-align:-20%;" class="tex" alt="\overline{r}" />:  <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_ab569d588d906c94f5cb8523d8edcc24.png" title="q_\alpha^\prime = rq_\alpha \overline{r}" style="vertical-align:-20%;" class="tex" alt="q_\alpha^\prime = rq_\alpha \overline{r}" />.</p>
<p>By way of an example, let us suppose we are going to rotate the point <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_b4d5c8e9c78fc19534c97e29f9c992a3.png" title="xi + yj + zk" style="vertical-align:-20%;" class="tex" alt="xi + yj + zk" /> by an angle <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_0004c76178a1d078888badee6891a8bd.png" title="\theta" style="vertical-align:-20%;" class="tex" alt="\theta" />, parallel to the xy-plane.  We will expect that our z-coordinate remains the same, but that the other two coordinates change.  First, let us let <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_f5e527d80ebce3eda18d8f795c336bd9.png" title="\alpha = \cos\frac{\theta}{2}" style="vertical-align:-20%;" class="tex" alt="\alpha = \cos\frac{\theta}{2}" /> and <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_64d7a975386a7ebd12a312cd77b92c4c.png" title="\beta = \sin\frac{\theta}{2}" style="vertical-align:-20%;" class="tex" alt="\beta = \sin\frac{\theta}{2}" />.  The normal to the xy-plane is just the z-axis.  So, our <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_de3adc820dbc4655c45b5555765fe84b.png" title="r" style="vertical-align:-20%;" class="tex" alt="r" /> is going to be <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_fac9346388bf0c290f5f8dad38d922d4.png" title="\alpha + \beta k" style="vertical-align:-20%;" class="tex" alt="\alpha + \beta k" />.  This leaves us to multiply out (and it&#8217;s going to get messy):<br />
<center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_0a817ec5013a79f529251ccbf9771a3e.png" title="(\alpha + \beta k)(xi + yj + zk)(\alpha - \beta k)" style="vertical-align:-20%;" class="tex" alt="(\alpha + \beta k)(xi + yj + zk)(\alpha - \beta k)" /></center><br />
<center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_e38aef532e459e2b6239a3a0a197eafd.png" title="(\alpha + \beta k)(\alpha xi + \alpha yj + \alpha zk - \beta x ik - \beta y jk - \beta z k^2)" style="vertical-align:-20%;" class="tex" alt="(\alpha + \beta k)(\alpha xi + \alpha yj + \alpha zk - \beta x ik - \beta y jk - \beta z k^2)" /></center><br />
<center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_204ed03b4452fa96ce8889055e3cf6c8.png" title="(\alpha + \beta k)\left( \beta z + (\alpha x - \beta y)i + (\alpha y + \beta x)j + \alpha zk \right)" style="vertical-align:-20%;" class="tex" alt="(\alpha + \beta k)\left( \beta z + (\alpha x - \beta y)i + (\alpha y + \beta x)j + \alpha zk \right)" /></center><br />
<center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_4bf3fbda57b05daa28f11835b30e62a3.png" title="\alpha\beta z + \alpha(\alpha x - \beta y)i + \alpha(\alpha y + \beta x)j + \alpha^2 z k \\ \qquad + \beta^2 z k + \beta(\alpha x - \beta y)ki + \beta(\alpha y + \beta x)kj + \alpha\beta z k^2" style="vertical-align:-20%;" class="tex" alt="\alpha\beta z + \alpha(\alpha x - \beta y)i + \alpha(\alpha y + \beta x)j + \alpha^2 z k \\ \qquad + \beta^2 z k + \beta(\alpha x - \beta y)ki + \beta(\alpha y + \beta x)kj + \alpha\beta z k^2" /></center><br />
<center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_067539c7cd03274b2641353d7aa3eca5.png" title="\alpha\beta z + (\alpha^2 x - \alpha\beta y)i + (\alpha^2 y - \alpha\beta x)j + \alpha^2 z k \\ \qquad + \beta^2 z k + (\alpha\beta x - \beta^2 y)j - (\alpha\beta y + \beta^2 x)i - \alpha\beta z" style="vertical-align:-20%;" class="tex" alt="\alpha\beta z + (\alpha^2 x - \alpha\beta y)i + (\alpha^2 y - \alpha\beta x)j + \alpha^2 z k \\ \qquad + \beta^2 z k + (\alpha\beta x - \beta^2 y)j - (\alpha\beta y + \beta^2 x)i - \alpha\beta z" /></center></p>
<p>Notice how the <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_f40b68c361dc39c63584bb9bf5a129c0.png" title="\alpha\beta z" style="vertical-align:-20%;" class="tex" alt="\alpha\beta z" /> and the <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_22ca64a845f836008499f78a11f6775a.png" title="-\alpha\beta z" style="vertical-align:-20%;" class="tex" alt="-\alpha\beta z" /> cancel out.  Also, notice how <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_087d609aa9016e94cbce64da00ef882d.png" title="\alpha^2 + \beta^2 = 1" style="vertical-align:-20%;" class="tex" alt="\alpha^2 + \beta^2 = 1" />.  So, we can simplify to an extent like this:<br />
<center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_e2226eafb2f63e01a2d4bdc1171e54ae.png" title="(\alpha^2 x - \alpha\beta y)i + (\alpha^2 y + \alpha\beta x)j + z k \\ \qquad + (\alpha\beta x - \beta^2 y)j + (-\alpha\beta y - \beta^2 x)i" style="vertical-align:-20%;" class="tex" alt="(\alpha^2 x - \alpha\beta y)i + (\alpha^2 y + \alpha\beta x)j + z k \\ \qquad + (\alpha\beta x - \beta^2 y)j + (-\alpha\beta y - \beta^2 x)i" /></center><br />
<center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_d2b68a9e83c9a2806fbc3101f8edb126.png" title="[(\alpha^2 - \beta^2)x - 2\alpha\beta y]i + [2\alpha\beta x + (\alpha^2 - \beta^2)]j + z" style="vertical-align:-20%;" class="tex" alt="[(\alpha^2 - \beta^2)x - 2\alpha\beta y]i + [2\alpha\beta x + (\alpha^2 - \beta^2)]j + z" /></center></p>
<p>If we go back to the <a href="http://www.mathwords.com/d/double_angle_identities.htm">double angle identites</a>, we find that <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_e933da8ed5bf761cbe7926b3d65c63ec.png" title="\alpha^2 - \beta^2 = \cos\theta" style="vertical-align:-20%;" class="tex" alt="\alpha^2 - \beta^2 = \cos\theta" /> while <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_5dcbc10fa3f31d077cfb47473e310133.png" title="2\alpha\beta = \sin\theta" style="vertical-align:-20%;" class="tex" alt="2\alpha\beta = \sin\theta" />.  So, our final formula is:<br />
<center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_c357860f53426b9a4fae14e7682b18d9.png" title="(\cos\theta x - \sin\theta y) i + (sin\theta x + \cos\theta y) j + zk" style="vertical-align:-20%;" class="tex" alt="(\cos\theta x - \sin\theta y) i + (sin\theta x + \cos\theta y) j + zk" /></center></p>
<h3>Denouement</h3>
<p>I know that in the complex number case and in the Clifford algebra case, I used <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_571b9f07aac145828a6936eeb5627d1e.png" title="\overline{r}zr" style="vertical-align:-20%;" class="tex" alt="\overline{r}zr" />.  In this case, I used <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_360099b6e5feb75fedf3b819a7bb3b25.png" title="rq\overline{r}" style="vertical-align:-20%;" class="tex" alt="rq\overline{r}" /> (swapping the roles of <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_de3adc820dbc4655c45b5555765fe84b.png" title="r" style="vertical-align:-20%;" class="tex" alt="r" /> and <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_c3e378eef52a54860a6eca39bcf44568.png" title="\overline{r}" style="vertical-align:-20%;" class="tex" alt="\overline{r}" />).  I could have used either in the complex number case since the complex numbers are commutative:  <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_2a0100518805d0539dbf26e7a3e0430d.png" title="ab = ba" style="vertical-align:-20%;" class="tex" alt="ab = ba" /> for all complex numbers <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_3cad95c81df4676e1b14e93cbb0b18ae.png" title="a" style="vertical-align:-20%;" class="tex" alt="a" /> and <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_97f4a1ba736119e3cd4de6fca35efd6b.png" title="b" style="vertical-align:-20%;" class="tex" alt="b" />.  Thus, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_c9112cc627516213602347dab468029a.png" title="\overline{r}zr = z\overline{r}r = zr\overline{r} = rz\overline{r}" style="vertical-align:-20%;" class="tex" alt="\overline{r}zr = z\overline{r}r = zr\overline{r} = rz\overline{r}" />.  I probably should have used <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_580a9fb467b7c13e622eb2a310cb2397.png" title="rz\overline{r}" style="vertical-align:-20%;" class="tex" alt="rz\overline{r}" /> for the complex case and still used <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_571b9f07aac145828a6936eeb5627d1e.png" title="\overline{r}zr" style="vertical-align:-20%;" class="tex" alt="\overline{r}zr" /> for the Clifford algebra case.</p>
<p>There is a technical reason for the difference.  This may sail right over your head if you haven&#8217;t done much hardcore linear algebra.  But, when we are using the complex numbers or the quaternions to represent rotations, we are really jamming a linear form into a vector and pretending like they&#8217;re the same thing.  We are glossing over the difference between a vector space and its <a href="http://en.wikipedia.org/wiki/Dual_space">dual space</a> by just pretending they are the same.  We can get away with that in the complex numbers and the quaternions, but we could not get away with it in the Clifford algebra case.  This is because the three-dimensional bivectors make up the dual space of the vectors.  So, when we&#8217;re using three-dimensional bivectors, we are explicitly using the dual space instead of taking advantage of the isomorphism between the dual space and the original vectors.  When we get to four dimensions or more, the rotations aren&#8217;t even in the dual space.</p>
<p>For a more English, less Math, version of the above, look at it this way.  Really, a rotation is something fundamentally different than a vector.  We lucked out with the complex numbers and the quaternions in that we were still able to represent rotations with something like a vector (though in the quaternion case, it was a vector plus a scalar).  The luck in the quaternion case isn&#8217;t perfect, it is off by a few signs here and there.  In more dimensions, we won&#8217;t be so lucky.  In three dimensions, there are three degrees of freedom for a rotation.  In four dimensions, there are six degrees of freedom.  We are never going to jam those six degrees of freedom into our puny four-dimensional vector.</p>
<h3>Next time</h3>
<p>Next time, we will do these transformations of three-dimensional space using Clifford algebras instead of quaternions.</p>
]]></content:encoded>
			<wfw:commentRss>http://nklein.com/2009/06/quaternions-for-rotating-scaling-and-translating-space/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>What Was Up With That Rotation Trick?</title>
		<link>http://nklein.com/2009/06/what-was-up-with-that-rotation-trick/</link>
		<comments>http://nklein.com/2009/06/what-was-up-with-that-rotation-trick/#comments</comments>
		<pubDate>Wed, 10 Jun 2009 18:25:56 +0000</pubDate>
		<dc:creator>pat</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Clifford Algebras]]></category>
		<category><![CDATA[Math]]></category>
		<category><![CDATA[geometry]]></category>
		<category><![CDATA[tricks]]></category>

		<guid isPermaLink="false">http://nklein.com/?p=542</guid>
		<description><![CDATA[In my prior post about using Clifford algebras to do plane rotations, I finished with a non-intuitive step at the end.  Rather than multiplying on the right by an element representing a rotation of angle , I multiplied on the left by an element representing a rotation of angle  and multiplied on the [...]]]></description>
			<content:encoded><![CDATA[<p>In my prior post about <a href="http://nklein.com/2009/06/clifford-algebras-for-rotating-scaling-and-translating-the-plane/">using Clifford algebras to do plane rotations</a>, I finished with a non-intuitive step at the end.  Rather than multiplying on the right by an element representing a rotation of angle <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_0004c76178a1d078888badee6891a8bd.png" title="\theta" style="vertical-align:-20%;" class="tex" alt="\theta" />, I multiplied on the left by an element representing a rotation of angle <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_2d16913e1a4ec8f7e9b5f6ffcf80bc33.png" title="\frac{\theta}{2}" style="vertical-align:-20%;" class="tex" alt="\frac{\theta}{2}" /> and multiplied on the right by an element representing a rotation of angle <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_7a577a03310558ad008df0fbed789c2e.png" title="-\frac{\theta}{2}" style="vertical-align:-20%;" class="tex" alt="-\frac{\theta}{2}" />.</p>
<p>Why did I do this?  Well, I mentioned it would be awkward for the two-dimensional case, but that it will be important when we get to three or more dimensions.  Well, work for a moment with <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_2d16913e1a4ec8f7e9b5f6ffcf80bc33.png" title="\frac{\theta}{2}" style="vertical-align:-20%;" class="tex" alt="\frac{\theta}{2}" /> being a quarter rotation (ninety degrees, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_4dcb91d20c0d18d06a5312f11f63360a.png" title="\frac{\pi}{2}" style="vertical-align:-20%;" class="tex" alt="\frac{\pi}{2}" /> radians).  This means our total rotation is going to be a half turn (180 degrees, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_45e9944b76bbb5b9e0dc513417fadf63.png" title="\pi" style="vertical-align:-20%;" class="tex" alt="\pi" /> radians).</p>
<p>For that <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_2d16913e1a4ec8f7e9b5f6ffcf80bc33.png" title="\frac{\theta}{2}" style="vertical-align:-20%;" class="tex" alt="\frac{\theta}{2}" />, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_c169dbccac5c68843892501c8928b97f.png" title="r = e_1e_2" style="vertical-align:-20%;" class="tex" alt="r = e_1e_2" /> and so <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_6d5663c230568262d7c4bebb5114f2c3.png" title="\overline{r} = -e_1e_2" style="vertical-align:-20%;" class="tex" alt="\overline{r} = -e_1e_2" />.  Let&#8217;s just look at what it does to our unit vectors <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_2c114902ec52372ed67af47f809ba7a0.png" title="e_1" style="vertical-align:-20%;" class="tex" alt="e_1" /> and <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_49142e125cfa1b96bdd97397c41eb8ea.png" title="e_2" style="vertical-align:-20%;" class="tex" alt="e_2" /> to multiply on the left by <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_de3adc820dbc4655c45b5555765fe84b.png" title="r" style="vertical-align:-20%;" class="tex" alt="r" /> and on the right by <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_c3e378eef52a54860a6eca39bcf44568.png" title="\overline{r}" style="vertical-align:-20%;" class="tex" alt="\overline{r}" />.</p>
<p>For <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_2c114902ec52372ed67af47f809ba7a0.png" title="e_1" style="vertical-align:-20%;" class="tex" alt="e_1" />, we get <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_5bb0059d1766f53dc18fe56a2aa4d291.png" title="-e_1e_2e_1e_1e_2 = -e_1e_2e_2 = -e_1" style="vertical-align:-20%;" class="tex" alt="-e_1e_2e_1e_1e_2 = -e_1e_2e_2 = -e_1" />.  Similarly, for <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_49142e125cfa1b96bdd97397c41eb8ea.png" title="e_2" style="vertical-align:-20%;" class="tex" alt="e_2" />, we get <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_0b26aeee70d44511c433107f8e7dcccf.png" title="-e_1e_2e_2e_1e_2 = -e_2" style="vertical-align:-20%;" class="tex" alt="-e_1e_2e_2e_1e_2 = -e_2" />.</p>
<p>So far, we were only working in two dimensions.  As such, there wasn&#8217;t any <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_aafe61a61cb0ec96dc0785643f45904c.png" title="e_3" style="vertical-align:-20%;" class="tex" alt="e_3" /> to worry about.  But, what if there were?  What happens to the <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_645f43d7c6169f257cafd2dc973d2421.png" title="z" style="vertical-align:-20%;" class="tex" alt="z" />-coordinate of something if you rotate things parallel to the <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_f307a57d9bce0d77a4c713980fbf9c0f.png" title="xy" style="vertical-align:-20%;" class="tex" alt="xy" />-plane?  It remains unchanged.</p>
<p>Well, what would happen if we multiplied <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_aafe61a61cb0ec96dc0785643f45904c.png" title="e_3" style="vertical-align:-20%;" class="tex" alt="e_3" /> on the right by <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_118ba1241cdfb6f5184e44684f0036f2.png" title="\cos\theta + \sin\theta e_1e_2" style="vertical-align:-20%;" class="tex" alt="\cos\theta + \sin\theta e_1e_2" />?  We would end up with <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_9df448d6c524e1fdb525a41ccfc61365.png" title="\cos\theta e_3 + \sin\theta e_3e_1e_2 = \cos\theta e_3 + \sin\theta e_1e_2e_3" style="vertical-align:-20%;" class="tex" alt="\cos\theta e_3 + \sin\theta e_3e_1e_2 = \cos\theta e_3 + \sin\theta e_1e_2e_3" />.  We&#8217;ve ended up scaling <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_aafe61a61cb0ec96dc0785643f45904c.png" title="e_3" style="vertical-align:-20%;" class="tex" alt="e_3" /> and adding in a trivector <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_dacb1085506e5f4b7785c367531a82e4.png" title="e_1e_2e_3" style="vertical-align:-20%;" class="tex" alt="e_1e_2e_3" />.  We&#8217;ve made a mess.</p>
<p>Let&#8217;s try it instead with our trick.  We&#8217;re going to start with <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_713f978db7752c0401887189100dbd3a.png" title="-e_1e_2e_3e_1e_2" style="vertical-align:-20%;" class="tex" alt="-e_1e_2e_3e_1e_2" />.  Every time we transpose elements with different subscripts, we flip the sign.  Every time we get two elements next to each other with the same subscript, they cancel out.  So, switching the <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_aafe61a61cb0ec96dc0785643f45904c.png" title="e_3" style="vertical-align:-20%;" class="tex" alt="e_3" /> with the second <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_2c114902ec52372ed67af47f809ba7a0.png" title="e_1" style="vertical-align:-20%;" class="tex" alt="e_1" />, we get <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_b3404e11f3c64cdf3f0c8188fe467fb6.png" title="e_1e_2e_1e_3e_2" style="vertical-align:-20%;" class="tex" alt="e_1e_2e_1e_3e_2" />.  From there, we can switch the first two elements to get <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_1ba103eb0c8e6a07ee5a81dc15127190.png" title="-e_2e_1e_1e_3e_2" style="vertical-align:-20%;" class="tex" alt="-e_2e_1e_1e_3e_2" /> which is just <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_098e8b34f70bf74ac7bea1e763b862ec.png" title="-e_2e_3e_2" style="vertical-align:-20%;" class="tex" alt="-e_2e_3e_2" />.  We can switch the <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_aafe61a61cb0ec96dc0785643f45904c.png" title="e_3" style="vertical-align:-20%;" class="tex" alt="e_3" /> with the second <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_49142e125cfa1b96bdd97397c41eb8ea.png" title="e_2" style="vertical-align:-20%;" class="tex" alt="e_2" /> to get: <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_ad640c7b1d839d4e5bf8e3f66d23ffe6.png" title="e_2e_2e_3" style="vertical-align:-20%;" class="tex" alt="e_2e_2e_3" /> which is just <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_aafe61a61cb0ec96dc0785643f45904c.png" title="e_3" style="vertical-align:-20%;" class="tex" alt="e_3" />.  So, our trick leaves <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_aafe61a61cb0ec96dc0785643f45904c.png" title="e_3" style="vertical-align:-20%;" class="tex" alt="e_3" /> unchanged.</p>
<p>In the above, there is nothing special about the subscript three.  It would work for any subscript except one or two.  So, the trick allows us to break the rotation up into two parts that still do what we want with <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_2c114902ec52372ed67af47f809ba7a0.png" title="e_1" style="vertical-align:-20%;" class="tex" alt="e_1" /> and <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_49142e125cfa1b96bdd97397c41eb8ea.png" title="e_2" style="vertical-align:-20%;" class="tex" alt="e_2" /> but leave our other directions unchanged (or, maybe it&#8217;s easier to think of them as changing them and then changing them right back).</p>
]]></content:encoded>
			<wfw:commentRss>http://nklein.com/2009/06/what-was-up-with-that-rotation-trick/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Clifford Algebras for Rotating, Scaling, and Translating the Plane</title>
		<link>http://nklein.com/2009/06/clifford-algebras-for-rotating-scaling-and-translating-the-plane/</link>
		<comments>http://nklein.com/2009/06/clifford-algebras-for-rotating-scaling-and-translating-the-plane/#comments</comments>
		<pubDate>Mon, 08 Jun 2009 17:00:54 +0000</pubDate>
		<dc:creator>pat</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Clifford Algebras]]></category>
		<category><![CDATA[Math]]></category>
		<category><![CDATA[geometry]]></category>

		<guid isPermaLink="false">http://nklein.com/?p=525</guid>
		<description><![CDATA[In my previous post, I reviewed how the complex numbers can be used to represent coordinates in the plane and how, once you&#8217;ve done that, complex arithmetic leads naturally to rotations, scalings, and translations of the plane.  Today, we&#8217;re going to do the same with the Clifford algebra .
What are Clifford Algebras
In our previous [...]]]></description>
			<content:encoded><![CDATA[<p>In my previous post, I reviewed how the complex numbers can be used to represent coordinates in the plane and how, once you&#8217;ve done that, <a href="http://nklein.com/2009/06/complex-numbers-for-rotating-translating-and-scaling-the-plane/">complex arithmetic leads naturally to rotations, scalings, and translations of the plane</a>.  Today, we&#8217;re going to do the same with the Clifford algebra <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_5e218a4aefa9db5298d035290f2b93f2.png" title="\mathcal{C}\ell_2" style="vertical-align:-20%;" class="tex" alt="\mathcal{C}\ell_2" />.</p>
<h3>What are Clifford Algebras</h3>
<p>In our previous post, we used two different ways to represent coordinates in the plane.  We used an ordered pair of real numbers like <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_bc7caa02946656da535028801e54d085.png" title="(3,5)" style="vertical-align:-20%;" class="tex" alt="(3,5)" /> and we used the real and imaginary parts of a complex number like <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_dc2e6bc073cc2325e07fd3f3b2bc4c51.png" title="3 + 5i" style="vertical-align:-20%;" class="tex" alt="3 + 5i" />.  Another way we could have written the coordinates in the plane is as a vector.  Typically, to express a vector, we pick an axis (say, the x-axis) and then pick a second axis perpendicular to it (say, the y-axis).  Most physics books would call these <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_de45e9ce8bf8980973de2a30d732594e.png" title="\hat{i}" style="vertical-align:-20%;" class="tex" alt="\hat{i}" /> and <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_b15bd4cfdc18bfb1f9e10d26fe26ab08.png" title="\hat{j}" style="vertical-align:-20%;" class="tex" alt="\hat{j}" />.  I am going to use <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_2c114902ec52372ed67af47f809ba7a0.png" title="e_1" style="vertical-align:-20%;" class="tex" alt="e_1" /> and <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_49142e125cfa1b96bdd97397c41eb8ea.png" title="e_2" style="vertical-align:-20%;" class="tex" alt="e_2" /> instead so that there is no confusion with <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_f1cf3fd16a9bd501a3ba1d0270b56944.png" title="i = \sqrt{-1}" style="vertical-align:-20%;" class="tex" alt="i = \sqrt{-1}" /> and because it is a notation that we will continue throughout Clifford algebras.  We could then express <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_bc7caa02946656da535028801e54d085.png" title="(3,5)" style="vertical-align:-20%;" class="tex" alt="(3,5)" /> as <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_0969b65627ddaaad2e61178a4134c073.png" title="3e_1 + 5e_2" style="vertical-align:-20%;" class="tex" alt="3e_1 + 5e_2" />.   Here, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_2c114902ec52372ed67af47f809ba7a0.png" title="e_1" style="vertical-align:-20%;" class="tex" alt="e_1" /> and <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_49142e125cfa1b96bdd97397c41eb8ea.png" title="e_2" style="vertical-align:-20%;" class="tex" alt="e_2" /> are called unit vectors.  We assume they have length one so that when we take three of them, we get something with length three (for arbitrary values of <q>three</q>).</p>
<p>Having done that, we can easily multiply any vector by a real number using the normal distributive law:  <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_2a740f913976bd1c723f79445c5913f9.png" title="s \cdot \left(xe_1 + ye_2\right) = (sx)e_1 + (sy)e_2" style="vertical-align:-20%;" class="tex" alt="s \cdot \left(xe_1 + ye_2\right) = (sx)e_1 + (sy)e_2" />.  And, we can add vectors just like we added complex numbers: summing like parts.  So, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_f00c38a922ef8d0f65708a92777c0927.png" title="(ae_1 + be_2) + (ce_1 + de_2) = (a+c)e_1 + (b+d)e_2" style="vertical-align:-20%;" class="tex" alt="(ae_1 + be_2) + (ce_1 + de_2) = (a+c)e_1 + (b+d)e_2" />.  Of course, subtraction goes the same way: <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_03828e9b4b5e20863bca605887c648f2.png" title="(ae_1 + be_2) - (ce_1 + de_2) = (a-c)e_1 + (b-d)e_2" style="vertical-align:-20%;" class="tex" alt="(ae_1 + be_2) - (ce_1 + de_2) = (a-c)e_1 + (b-d)e_2" />.</p>
<p><span id="more-525"></span></p>
<p>Great.  We can add and subtract vectors.  We can multiply vectors by real numbers.  But, what about multiplying a vector by a vector?  Well, let&#8217;s try it:  <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_6473a00daa6fbb9abc1d13a0c919f36f.png" title="(ae_1 + be_2)\cdot(ce_1 + de_2)" style="vertical-align:-20%;" class="tex" alt="(ae_1 + be_2)\cdot(ce_1 + de_2)" />.  Again, we&#8217;re going to use the <a href="http://www.mathwarehouse.com/algebra/polynomial/foil-method-binomials.php">F.O.I.L. method</a>.  We end up with: <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_cd7485b771bc5dbe286023d84aa8c065.png" title="ace_1^2 + ade_1e_2 + bce_2e_1 + bde_2^2" style="vertical-align:-20%;" class="tex" alt="ace_1^2 + ade_1e_2 + bce_2e_1 + bde_2^2" />.  So far, I have assumed that we can multiply real numbers by our unit vectors in any order, but that maybe multiplying <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_e9c8fd68601f63402a7bd894cde3668a.png" title="e_1e_2" style="vertical-align:-20%;" class="tex" alt="e_1e_2" /> would be different than <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_6c6074f3096a0987da7b46dcf75158b1.png" title="e_2e_1" style="vertical-align:-20%;" class="tex" alt="e_2e_1" />.  Well, to get anywhere from here, we need to be able to evaluate things like <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_14abf461a48b13a16ce460a5511a72a0.png" title="e_1^2" style="vertical-align:-20%;" class="tex" alt="e_1^2" /> and <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_e9c8fd68601f63402a7bd894cde3668a.png" title="e_1e_2" style="vertical-align:-20%;" class="tex" alt="e_1e_2" />.</p>
<p>[Note: the F.O.I.L. method is nothing magical.  It is simply the distributive law applied three times:<br />
<center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_271a85688f0f8ea6709a179f5b1aa430.png" title="(a + b)(c + d) = a(c+d) + b(c+d) = ac + ad + bc + bd" style="vertical-align:-20%;" class="tex" alt="(a + b)(c + d) = a(c+d) + b(c+d) = ac + ad + bc + bd" /></center></p>
<p>Actually, this leaves me a good place to mention... if you're better at hearing someone speak while doing math than you are reading along on your own, then you can review the complex arithmetic we did in the last post with these videos at <a href="http://khanacademy.org/">KhanAcademy.org</a>:  <a href="http://www.youtube.com/watch?v=rDLDGQMKT3M">i and Imaginary numbers</a>, <a href="http://www.youtube.com/watch?v=kpywdu1afas">Complex Numbers (part 1)</a>, and <a href="http://www.youtube.com/watch?v=bPqB9a1uk_8">Complex Numbers (part 2)</a>.]</p>
<p>So, where are we?  If we want to multiply two vectors together, we need to decide how to multiply things like <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_14abf461a48b13a16ce460a5511a72a0.png" title="e_1^2" style="vertical-align:-20%;" class="tex" alt="e_1^2" /> or <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_e9c8fd68601f63402a7bd894cde3668a.png" title="e_1e_2" style="vertical-align:-20%;" class="tex" alt="e_1e_2" />.  Well, there are probably lots of ways we could do this.  But, we&#8217;re going to be trying to do geometric things with our vectors.  What are some geometrically useful possibilities?</p>
<p>We could say that any vector multiplied by itself is just itself so that <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_9204a2f305124e407442423a35f680dd.png" title="e_1^2 = e_1" style="vertical-align:-20%;" class="tex" alt="e_1^2 = e_1" />.  This doesn&#8217;t really help us figure out anything about <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_e9c8fd68601f63402a7bd894cde3668a.png" title="e_1e_2" style="vertical-align:-20%;" class="tex" alt="e_1e_2" /> and how it relates to <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_6c6074f3096a0987da7b46dcf75158b1.png" title="e_2e_1" style="vertical-align:-20%;" class="tex" alt="e_2e_1" />.</p>
<p>Another possibility is that parallel vectors annihilate each other so that <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_1bda69404c4891c19f83c8e297bfa320.png" title="e_1^2 = 0" style="vertical-align:-20%;" class="tex" alt="e_1^2 = 0" /> while perpendicular vectors do not.  If that were the case, then <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_9f397282855b45f40365dc0c7952e5f2.png" title="(e_1 + e_2)^2 = 0" style="vertical-align:-20%;" class="tex" alt="(e_1 + e_2)^2 = 0" />.  And, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_198fc87e6115d01127426801a1b17d4f.png" title="(e_1 + e_2)^2 = e_1^2 + e_1e_2 + e_2e_1 + e_2^2 = e_1e_2 + e_2e_1" style="vertical-align:-20%;" class="tex" alt="(e_1 + e_2)^2 = e_1^2 + e_1e_2 + e_2e_1 + e_2^2 = e_1e_2 + e_2e_1" />. so that <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_9b27e1a084a76d4367cdecc420fa0dba.png" title="e_1e_2 = -\left(e_2e_1\right)" style="vertical-align:-20%;" class="tex" alt="e_1e_2 = -\left(e_2e_1\right)" />.  This has some merits.  This results in what is called the <a href="http://en.wikipedia.org/wiki/Exterior_algebra">Exterior (or Grassmann) algebra</a>.  There is lots of interesting stuff to learn there, but Clifford algebras take a slightly different tack.</p>
<p>Another natural choice might be then that if we take some vector <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_de3adc820dbc4655c45b5555765fe84b.png" title="r" style="vertical-align:-20%;" class="tex" alt="r" /> and multiply it by itself, maybe we should get a real number that is the square of the length of <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_de3adc820dbc4655c45b5555765fe84b.png" title="r" style="vertical-align:-20%;" class="tex" alt="r" />.  So, if we have a vector <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_f016d0a338e6730b4c14a80c9f51e7de.png" title="xe_1 + ye_2" style="vertical-align:-20%;" class="tex" alt="xe_1 + ye_2" />, its length is <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_f0ef7f2c017723ad127f5fce6e9f6a3b.png" title="\sqrt{x^2 + y^2}" style="vertical-align:-20%;" class="tex" alt="\sqrt{x^2 + y^2}" />.  If we want the square of the vector to be <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_a95ebb4548e029eaeefd7058304d3d5c.png" title="x^2 + y^2" style="vertical-align:-20%;" class="tex" alt="x^2 + y^2" />, then we need to have the following:<br />
<center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_a306339bf9c3b6854910886b6114bb66.png" title="(xe_1 + ye_2)^2 = x^2 + y^2" style="vertical-align:-20%;" class="tex" alt="(xe_1 + ye_2)^2 = x^2 + y^2" /></center><br />
<center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_ef67c3bc915f850b18f0c13204fd6a78.png" title="x^2e_1^2 + xye_1e_2 + xye_2e_1 + y^2e_2^2 = x^2 + y^2" style="vertical-align:-20%;" class="tex" alt="x^2e_1^2 + xye_1e_2 + xye_2e_1 + y^2e_2^2 = x^2 + y^2" /></center></p>
<p>To make this equation work out for every <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_1a507c5494969dc6de305770cadc6630.png" title="x" style="vertical-align:-20%;" class="tex" alt="x" /> and <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_e561f1e00880abb7e58816455af00a48.png" title="y" style="vertical-align:-20%;" class="tex" alt="y" />, we need to have <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_27330b0710e58954fafebf696f5822fd.png" title="e_1e_2 = - \left(e_2e_1\right)" style="vertical-align:-20%;" class="tex" alt="e_1e_2 = - \left(e_2e_1\right)" /> and <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_0949227d5913f87d8d2894450cfd8621.png" title="e_1^2 = e_2^2 = 1" style="vertical-align:-20%;" class="tex" alt="e_1^2 = e_2^2 = 1" />.  This is the essence of Clifford algebra.  All of the rest is deducible from here.  But, we&#8217;re going to be a bit more explicit on some of the things this implies.</p>
<p>We can reduce <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_88d4b455d5953918a4739f3789df179f.png" title="(ae_1 + be_2)\cdot(ce_1+de_2)" style="vertical-align:-20%;" class="tex" alt="(ae_1 + be_2)\cdot(ce_1+de_2)" /> further, now.  When we multiplied it all out, we got: <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_cd7485b771bc5dbe286023d84aa8c065.png" title="ace_1^2 + ade_1e_2 + bce_2e_1 + bde_2^2" style="vertical-align:-20%;" class="tex" alt="ace_1^2 + ade_1e_2 + bce_2e_1 + bde_2^2" />.  Knowing now that <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_0949227d5913f87d8d2894450cfd8621.png" title="e_1^2 = e_2^2 = 1" style="vertical-align:-20%;" class="tex" alt="e_1^2 = e_2^2 = 1" /> and <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_9b27e1a084a76d4367cdecc420fa0dba.png" title="e_1e_2 = -\left(e_2e_1\right)" style="vertical-align:-20%;" class="tex" alt="e_1e_2 = -\left(e_2e_1\right)" />, we can rewrite this:  <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_08b463e937fa455b074a5c383c592461.png" title="(ac + bd) + (ad - bc)e_1e_2" style="vertical-align:-20%;" class="tex" alt="(ac + bd) + (ad - bc)e_1e_2" />.  So, we multiplied two vectors and got a real number plus a real number times this other thing: <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_e9c8fd68601f63402a7bd894cde3668a.png" title="e_1e_2" style="vertical-align:-20%;" class="tex" alt="e_1e_2" />.  We&#8217;re going to call this other thing a bivector.</p>
<h3>A bivector?</h3>
<p>Let&#8217;s explore bivectors a little more.  In particular, what is <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_d69d0de114ee2298dcc7b1fceec6dc51.png" title="(e_1e_2)^2 = e_1e_2e_1e_2" style="vertical-align:-20%;" class="tex" alt="(e_1e_2)^2 = e_1e_2e_1e_2" />?  Well, we&#8217;ve already decided that <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_869b33a0ca7c69c44255220f0a3d6b2c.png" title="e_1e_2 = -e_2e_1" style="vertical-align:-20%;" class="tex" alt="e_1e_2 = -e_2e_1" />.  So, we know that <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_b0c3a5220f7f1029bd7800264780529e.png" title="e_1e_2e_1e_2 = -e_2e_1e_1e_2" style="vertical-align:-20%;" class="tex" alt="e_1e_2e_1e_2 = -e_2e_1e_1e_2" />.  And, we already decided that <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_760e171c0991b20ef0c18ac0931be335.png" title="e_1^2 = 1" style="vertical-align:-20%;" class="tex" alt="e_1^2 = 1" />, so <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_7b2f85a721ee85169890d24e164bb5f3.png" title="-e_2e_1^2e_2 = -e_2e_2" style="vertical-align:-20%;" class="tex" alt="-e_2e_1^2e_2 = -e_2e_2" />.  And, we already decided that <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_6db4f17c604e87420fa925e1d6f93593.png" title="e_2^2 = 1" style="vertical-align:-20%;" class="tex" alt="e_2^2 = 1" />.  So, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_ba9251672b85705edd6ea2ca8ec04433.png" title="(e_1e_2)^2 = -1" style="vertical-align:-20%;" class="tex" alt="(e_1e_2)^2 = -1" />.  When we square our unit bivector, we get <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_4d0cb72998bb739b2e3ab61ebc1488fd.png" title="-1" style="vertical-align:-20%;" class="tex" alt="-1" />.  Our bivector is exactly like our <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_5477186a84cc2c889974ca6fd01ca96f.png" title="i" style="vertical-align:-20%;" class="tex" alt="i" /> from the complex numbers!</p>
<p>Recall that <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_3cd7d667708d283427d6c880c7b38484.png" title="(a + bi)\cdot(c+di) = (ac - bd) + (ad + bc)i" style="vertical-align:-20%;" class="tex" alt="(a + bi)\cdot(c+di) = (ac - bd) + (ad + bc)i" />.  Now, let&#8217;s multiply out <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_054d5b54db29ed0f91d4b4249e4d56c8.png" title="(a + be_1e_2)\cdot(c + de_1e_2)" style="vertical-align:-20%;" class="tex" alt="(a + be_1e_2)\cdot(c + de_1e_2)" />.  We get <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_701c8d9661e1aa40a39e90699d02b9c6.png" title="ac + ade_1e_2 + bce_1e_2 + bd(e_1e_2)^2" style="vertical-align:-20%;" class="tex" alt="ac + ade_1e_2 + bce_1e_2 + bd(e_1e_2)^2" /> which is <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_bd0324b871dd2f312e22c14e5f1cf9fc.png" title="(ac - bd) + (ad + bc)e_1e_2" style="vertical-align:-20%;" class="tex" alt="(ac - bd) + (ad + bc)e_1e_2" />.</p>
<p>So, we could stop right here if we wanted.  We could represent our points in the plane as a real number plus a real number times <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_e9c8fd68601f63402a7bd894cde3668a.png" title="e_1e_2" style="vertical-align:-20%;" class="tex" alt="e_1e_2" /> and do everything we did with the complex numbers.  But, if we did that, then we&#8217;ve totally skipped over using the vector part of our Clifford algebra.  We are only using the bivector part.</p>
<p>Now we&#8217;ve got real numbers and vectors and bivectors.  What if we multiply <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_168d77b0745cdcb86e5a911bb7878398.png" title="e_1\cdot(e_1e_2)" style="vertical-align:-20%;" class="tex" alt="e_1\cdot(e_1e_2)" />?  Well, since <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_760e171c0991b20ef0c18ac0931be335.png" title="e_1^2 = 1" style="vertical-align:-20%;" class="tex" alt="e_1^2 = 1" />, we are just left with <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_49142e125cfa1b96bdd97397c41eb8ea.png" title="e_2" style="vertical-align:-20%;" class="tex" alt="e_2" />.  How about if we multiply <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_e58560b0c28d4d81fb13143ebb5ab50a.png" title="(e_1e_2)\cdot e_1" style="vertical-align:-20%;" class="tex" alt="(e_1e_2)\cdot e_1" />?  Here, we have to make use of <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_869b33a0ca7c69c44255220f0a3d6b2c.png" title="e_1e_2 = -e_2e_1" style="vertical-align:-20%;" class="tex" alt="e_1e_2 = -e_2e_1" />, so we end up with <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_5d32766d5cc251616b8ed2f05650d4fd.png" title="e_1e_2e_1 = -e_2e_1e_1 = -e_2" style="vertical-align:-20%;" class="tex" alt="e_1e_2e_1 = -e_2e_1e_1 = -e_2" />.  So, our vectors and bivectors are a little weird compared to what we&#8217;re used to.  We&#8217;re used to having <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_2a0100518805d0539dbf26e7a3e0430d.png" title="ab = ba" style="vertical-align:-20%;" class="tex" alt="ab = ba" /> for real numbers (and even complex numbers).  But, this doesn&#8217;t work out for vectors times vectors or vectors times bivectors.  And, it turns out, that will be a good thing later.  In two-dimensions, it isn&#8217;t quite as big a deal.  [Well, if you're familiar with vector cross-products, then maybe it is a big deal to you since you already know that <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_6d4a737b2a88cb28929fa2af1cb53cf0.png" title="a \times b = - b \times a" style="vertical-align:-20%;" class="tex" alt="a \times b = - b \times a" />.]</p>
<p>Anyhow, an arbitrary element of the two-dimensional Clifford algebra <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_5e218a4aefa9db5298d035290f2b93f2.png" title="\mathcal{C}\ell_2" style="vertical-align:-20%;" class="tex" alt="\mathcal{C}\ell_2" /> is of the form <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_ff92089962e64ef282fd6b06d1b8cb7f.png" title="a + be_1 + ce_2 + de_1e_2" style="vertical-align:-20%;" class="tex" alt="a + be_1 + ce_2 + de_1e_2" /> for real numbers <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_3cad95c81df4676e1b14e93cbb0b18ae.png" title="a" style="vertical-align:-20%;" class="tex" alt="a" />, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_97f4a1ba736119e3cd4de6fca35efd6b.png" title="b" style="vertical-align:-20%;" class="tex" alt="b" />, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_08c1898a88651cdd0a9fdb2d6ce6e8a1.png" title="c" style="vertical-align:-20%;" class="tex" alt="c" />, and <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_fa25a1c273232af978e96f1ea4331d79.png" title="d" style="vertical-align:-20%;" class="tex" alt="d" />.  It is a real number <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_3cad95c81df4676e1b14e93cbb0b18ae.png" title="a" style="vertical-align:-20%;" class="tex" alt="a" /> plus a two-dimensional vector with real coordinates <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_8b6d5e7ae6e10dd54af04ee5b8a52819.png" title="be_1 + ce_2" style="vertical-align:-20%;" class="tex" alt="be_1 + ce_2" /> plus a real number times our bivector <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_e9c8fd68601f63402a7bd894cde3668a.png" title="e_1e_2" style="vertical-align:-20%;" class="tex" alt="e_1e_2" />.</p>
<h3>Transforming the Plane</h3>
<p>It is common/natural/intuitive?/easy? to think of the coordinates of a point in the plane as a two-dimensional vector from the origin to the point.  As such, we&#8217;re just going to use the coordinates as the coefficients of the unit vectors of our general element <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_ff92089962e64ef282fd6b06d1b8cb7f.png" title="a + be_1 + ce_2 + de_1e_2" style="vertical-align:-20%;" class="tex" alt="a + be_1 + ce_2 + de_1e_2" />.  So, the point <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_bc7caa02946656da535028801e54d085.png" title="(3,5)" style="vertical-align:-20%;" class="tex" alt="(3,5)" /> would be represented in our algebra as <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_0969b65627ddaaad2e61178a4134c073.png" title="3e_1 + 5e_2" style="vertical-align:-20%;" class="tex" alt="3e_1 + 5e_2" />.  This is called a <q>pure vector</q> since it has zero for its real part and zero for its bivector part.</p>
<p>Now, what if we had a whole list of points <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_df6a991ade7cc9ad3cd908b4e2ef9946.png" title="(x_1,y_1)" style="vertical-align:-20%;" class="tex" alt="(x_1,y_1)" />, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_c1e27f0abd9ad9572f3887ef067770ab.png" title="(x_2,y_2)" style="vertical-align:-20%;" class="tex" alt="(x_2,y_2)" />, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_4b30e31f5d5a5dbe4dcd2e370ee5d1ae.png" title="\ldots" style="vertical-align:-20%;" class="tex" alt="\ldots" />, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_dd0bee170fcdd06706728b42cc47c899.png" title="(x_k,y_k)" style="vertical-align:-20%;" class="tex" alt="(x_k,y_k)" />?  We can represent these as elements of our Clifford algebra as <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_07d8479eaec7561e07542b2c156a946c.png" title="z_1 = x_1e_1 + y_1e_2" style="vertical-align:-20%;" class="tex" alt="z_1 = x_1e_1 + y_1e_2" />, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_c4e4c3252d679143e27eb097163f8d73.png" title="z_2 = x_2e_1 + y_2e_2" style="vertical-align:-20%;" class="tex" alt="z_2 = x_2e_1 + y_2e_2" />, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_4b30e31f5d5a5dbe4dcd2e370ee5d1ae.png" title="\ldots" style="vertical-align:-20%;" class="tex" alt="\ldots" />, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_b79c4db9604e4cbabf1d0225af1e9876.png" title="z_k = x_ke_1 + y_ke_2" style="vertical-align:-20%;" class="tex" alt="z_k = x_ke_1 + y_ke_2" />.  If we want to translate all of them by two units along the x-axis and seven units along the y-axis, then we can let <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_42052f05c538f164b60a37666ed21d87.png" title="t = 2e_1 + 7e_2" style="vertical-align:-20%;" class="tex" alt="t = 2e_1 + 7e_2" /> and just add <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_4e156c4dfd6f5bd0adffc493c64bc7ca.png" title="t" style="vertical-align:-20%;" class="tex" alt="t" /> to each of our points: <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_483aad77b980aa545aa0a1a03969b86d.png" title="z_j^\prime = z_j + t" style="vertical-align:-20%;" class="tex" alt="z_j^\prime = z_j + t" />.</p>
<p>Now, what if we want to scale the whole plane up by a factor of six radiating from the origin?  We can just let <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_31b4f2a711662a46c284a2b77e10d239.png" title="s = 6" style="vertical-align:-20%;" class="tex" alt="s = 6" /> and multiply it by each of our points:  <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_9a1111f05648bd17c3c50048d78f3abd.png" title="z_j^\prime = s \cdot z_j" style="vertical-align:-20%;" class="tex" alt="z_j^\prime = s \cdot z_j" />.</p>
<p>How about rotation by an angle <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_0004c76178a1d078888badee6891a8bd.png" title="\theta" style="vertical-align:-20%;" class="tex" alt="\theta" /> around the origin?  Well, drawing on what we did with complex numbers, let&#8217;s see if we can just get away with multiplying by <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_118ba1241cdfb6f5184e44684f0036f2.png" title="\cos\theta + \sin\theta e_1e_2" style="vertical-align:-20%;" class="tex" alt="\cos\theta + \sin\theta e_1e_2" />.  Recall that we want a point <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_f016d0a338e6730b4c14a80c9f51e7de.png" title="xe_1 + ye_2" style="vertical-align:-20%;" class="tex" alt="xe_1 + ye_2" /> to go to a point <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_4939b8b0878deb991a48c4fd5e794bbb.png" title="(x\cos\theta - y\sin\theta)e_1 + (x\sin\theta + y\cos\theta)e_2" style="vertical-align:-20%;" class="tex" alt="(x\cos\theta - y\sin\theta)e_1 + (x\sin\theta + y\cos\theta)e_2" /> when rotated.</p>
<p>Let&#8217;s try multiplying <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_d63b6d6d22df9f0943142e645178ad7d.png" title="(\cos\theta + \sin\theta e_1e_2)\cdot(xe_1 + ye_2)" style="vertical-align:-20%;" class="tex" alt="(\cos\theta + \sin\theta e_1e_2)\cdot(xe_1 + ye_2)" />.  Remember, we have to be careful to keep the <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_2c114902ec52372ed67af47f809ba7a0.png" title="e_1" style="vertical-align:-20%;" class="tex" alt="e_1" />&#8217;s and <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_49142e125cfa1b96bdd97397c41eb8ea.png" title="e_2" style="vertical-align:-20%;" class="tex" alt="e_2" />&#8217;s in the order they appear because every time we swap places on them, we need to swap the sign.  When we multiply this out, we get:<br />
<center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_553874be5df0676e5c2d51713d3a5304.png" title="x\cos\theta e_1 + y\sin\theta e_1e_2e_2 + x\sin\theta e_1e_2e_1 + y\cos\theta e_2" style="vertical-align:-20%;" class="tex" alt="x\cos\theta e_1 + y\sin\theta e_1e_2e_2 + x\sin\theta e_1e_2e_1 + y\cos\theta e_2" /></center><br />
<center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_65152563a6d58feb8d5640b4d786c2e0.png" title="x\cos\theta e_1 + y\sin\theta e_1 - x\sin\theta e_2e_1e_1 + y\cos\theta e_2" style="vertical-align:-20%;" class="tex" alt="x\cos\theta e_1 + y\sin\theta e_1 - x\sin\theta e_2e_1e_1 + y\cos\theta e_2" /></center><br />
<center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_dca394db9b2bc503133d788bd64d4831.png" title="(x\cos\theta + y\sin\theta)e_1 + (-x\sin\theta + y\cos\theta)e_2" style="vertical-align:-20%;" class="tex" alt="(x\cos\theta + y\sin\theta)e_1 + (-x\sin\theta + y\cos\theta)e_2" /></center></p>
<p>This is really close.  We just don&#8217;t have the sign right on the sine terms.  Well, we could just use the fact that <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_902e75cb985a20011fb89e4256340d36.png" title="\cos\theta = \cos(-\theta)" style="vertical-align:-20%;" class="tex" alt="\cos\theta = \cos(-\theta)" /> and <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_b4e1ec3df533bda6e41dab2f89a2635a.png" title="\sin\theta = -\sin(-\theta)" style="vertical-align:-20%;" class="tex" alt="\sin\theta = -\sin(-\theta)" />.  But, that would be funky weird to use <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_782d9710567804b4405606fd848c78f2.png" title="-\theta" style="vertical-align:-20%;" class="tex" alt="-\theta" /> when you want to rotate by <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_0004c76178a1d078888badee6891a8bd.png" title="\theta" style="vertical-align:-20%;" class="tex" alt="\theta" />.  But, we&#8217;ve seen before how switching the order of multiplying things can change the sign.  Let&#8217;s try this here.  Instead of multiplying with the vector on the right, let&#8217;s multiply with the vector on the left:<br />
<center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_6800ec3ccab21f75d1e9d3b48c253fa4.png" title="(xe_1 + ye_2)\cdot(\cos\theta + \sin\theta e_1e_2)" style="vertical-align:-20%;" class="tex" alt="(xe_1 + ye_2)\cdot(\cos\theta + \sin\theta e_1e_2)" /></center><br />
<center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_016d7a35c099bb64e43f06000beaeb63.png" title="x\cos\theta e_1 + x\sin\theta e_1e_1e_2 + y\cos\theta e_2 + y\sin\theta e_2e_1e_2" style="vertical-align:-20%;" class="tex" alt="x\cos\theta e_1 + x\sin\theta e_1e_1e_2 + y\cos\theta e_2 + y\sin\theta e_2e_1e_2" /></center><br />
<center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_4939b8b0878deb991a48c4fd5e794bbb.png" title="(x\cos\theta - y\sin\theta)e_1 + (x\sin\theta + y\cos\theta)e_2" style="vertical-align:-20%;" class="tex" alt="(x\cos\theta - y\sin\theta)e_1 + (x\sin\theta + y\cos\theta)e_2" /></center></p>
<p>There we have it.  So, if we let <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_829f095cf610d03b8d2317d7b328cac9.png" title="r = \cos\theta + \sin\theta e_1e_2" style="vertical-align:-20%;" class="tex" alt="r = \cos\theta + \sin\theta e_1e_2" />, then we can rotate all of our points by angle <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_0004c76178a1d078888badee6891a8bd.png" title="\theta" style="vertical-align:-20%;" class="tex" alt="\theta" /> around the origin using: <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_b4cc18a857ea59ba3fafcec520137551.png" title="z_j^\prime = z_j \cdot r" style="vertical-align:-20%;" class="tex" alt="z_j^\prime = z_j \cdot r" />.</p>
<p>And, of course, if we want to scale or rotate around different points, we can translate, scale or rotate, and translate back again like we did with the complex numbers.</p>
<h3>Not so fast</h3>
<p>It turns out that just multiplying with the vector on the left isn&#8217;t going to serve us well as we go up in dimensions.  We&#8217;re going to do something that might look really awkward now, and will be somewhat awkward for this two-dimensional case, but it&#8217;s going to prepare us to do better things in three or more dimensions.</p>
<p>Let&#8217;s let <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_ba1ddca9e7f65b94e3ddec159d858b7b.png" title="r = \cos\phi + \sin\phi e_1e_2" style="vertical-align:-20%;" class="tex" alt="r = \cos\phi + \sin\phi e_1e_2" />.  And, let&#8217;s let <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_ced4a3f5a5b59c893ec82067187c1466.png" title="\overline{r} = \cos\phi - \sin\phi e_1e_2" style="vertical-align:-20%;" class="tex" alt="\overline{r} = \cos\phi - \sin\phi e_1e_2" />.  You might recognize this as just like the <a href="http://en.wikipedia.org/wiki/Complex_conjugate">complex conjugate</a> of <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_de3adc820dbc4655c45b5555765fe84b.png" title="r" style="vertical-align:-20%;" class="tex" alt="r" />.</p>
<p>Let&#8217;s see what we get if we multiply <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_f016d0a338e6730b4c14a80c9f51e7de.png" title="xe_1 + ye_2" style="vertical-align:-20%;" class="tex" alt="xe_1 + ye_2" /> by <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_de3adc820dbc4655c45b5555765fe84b.png" title="r" style="vertical-align:-20%;" class="tex" alt="r" /> on the left and by <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_c3e378eef52a54860a6eca39bcf44568.png" title="\overline{r}" style="vertical-align:-20%;" class="tex" alt="\overline{r}" /> on the right.<br />
<center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_c8e0b6e7e8c82a82ebcc11cfeeb29e1d.png" title="(\cos\phi + \sin\phi e_1e_2)(xe_1 + ye_2)(\cos\phi - \sin\phi e_1e_2)" style="vertical-align:-20%;" class="tex" alt="(\cos\phi + \sin\phi e_1e_2)(xe_1 + ye_2)(\cos\phi - \sin\phi e_1e_2)" /></center><br />
<center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_58b1d901a460e6bb071304250f892214.png" title="(x\cos\phi e_1 + x\sin\phi e_1e_2e_1 + y\cos\phi e_2 + y\sin\phi e_1e_2e_2)(\cos\phi - \sin\phi e_1e_2)" style="vertical-align:-20%;" class="tex" alt="(x\cos\phi e_1 + x\sin\phi e_1e_2e_1 + y\cos\phi e_2 + y\sin\phi e_1e_2e_2)(\cos\phi - \sin\phi e_1e_2)" /></center><br />
<center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_3374a6e21de2344910a4e4d985f25286.png" title="(x\cos\phi e_1 - x\sin\phi e_2 + y\cos\phi e_2 + y\sin\phi e_1)(\cos\phi - \sin\phi e_1e_2)" style="vertical-align:-20%;" class="tex" alt="(x\cos\phi e_1 - x\sin\phi e_2 + y\cos\phi e_2 + y\sin\phi e_1)(\cos\phi - \sin\phi e_1e_2)" /></center><br />
<center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_7539005d244e9790e957a0e3964b0d15.png" title="[(x\cos\phi + y\sin\phi)e_1 + (-x\sin\phi + y\cos\phi)e_2)](\cos\phi - \sin\phi e_1e_2)" style="vertical-align:-20%;" class="tex" alt="[(x\cos\phi + y\sin\phi)e_1 + (-x\sin\phi + y\cos\phi)e_2)](\cos\phi - \sin\phi e_1e_2)" /></center></p>
<p>This is getting a bit large, so let&#8217;s just concentrate for a moment on the terms that are going to contribute to <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_2c114902ec52372ed67af47f809ba7a0.png" title="e_1" style="vertical-align:-20%;" class="tex" alt="e_1" /> in the end: namely, the <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_2c114902ec52372ed67af47f809ba7a0.png" title="e_1" style="vertical-align:-20%;" class="tex" alt="e_1" /> term in the first factor times the real part in the second factor and the <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_49142e125cfa1b96bdd97397c41eb8ea.png" title="e_2" style="vertical-align:-20%;" class="tex" alt="e_2" /> term in the first factor times the bivector part in the second factor.<br />
<center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_d553fd89d5117257f5b9f888d0b740b1.png" title="(x\cos^2\phi + y\sin\phi\cos\phi)e_1 + (x\sin^2\phi - y\sin\phi\cos\phi)e_2e_1e_2" style="vertical-align:-20%;" class="tex" alt="(x\cos^2\phi + y\sin\phi\cos\phi)e_1 + (x\sin^2\phi - y\sin\phi\cos\phi)e_2e_1e_2" /></center><br />
<center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_9742e4a957889af9056a9ce9ece846bc.png" title="(x\cos^2\phi + y\sin\phi\cos\phi)e_1 - (x\sin^2\phi - y\sin\phi\cos\phi)e_1" style="vertical-align:-20%;" class="tex" alt="(x\cos^2\phi + y\sin\phi\cos\phi)e_1 - (x\sin^2\phi - y\sin\phi\cos\phi)e_1" /></center><br />
<center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_793e0d48869e1f683cc72c62bfbd4971.png" title="[x(\cos^2\phi - sin^2\phi) - y(2\sin\phi\cos\phi)]e_1" style="vertical-align:-20%;" class="tex" alt="[x(\cos^2\phi - sin^2\phi) - y(2\sin\phi\cos\phi)]e_1" /></center></p>
<p>We can do a similar thing with the portions that contribute to <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_49142e125cfa1b96bdd97397c41eb8ea.png" title="e_2" style="vertical-align:-20%;" class="tex" alt="e_2" />:<br />
<center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_e3e89fe71b08ddd34649392a6db98825.png" title="(-x\sin\phi\cos\phi + y\cos^2\phi)e_2 - (x\sin\phi\cos\phi + y\sin^2\phi)e_1e_1e_2" style="vertical-align:-20%;" class="tex" alt="(-x\sin\phi\cos\phi + y\cos^2\phi)e_2 - (x\sin\phi\cos\phi + y\sin^2\phi)e_1e_1e_2" /></center><br />
<center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_03abb85532d2db646b920d1f71c14c1a.png" title="(-x\sin\phi\cos\phi + y\cos^2\phi)e_2 - (x\sin\phi\cos\phi  + y\sin^2\phi)e_2" style="vertical-align:-20%;" class="tex" alt="(-x\sin\phi\cos\phi + y\cos^2\phi)e_2 - (x\sin\phi\cos\phi  + y\sin^2\phi)e_2" /></center><br />
<center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_c6bd0122c1f83782fd650725ee36f314.png" title="[x(2\sin\phi\cos\phi) + y(\cos^2\phi - sin^2\phi)]e_2" style="vertical-align:-20%;" class="tex" alt="[x(2\sin\phi\cos\phi) + y(\cos^2\phi - sin^2\phi)]e_2" /></center></p>
<p>Now, we have to remember some trigonometric identities.  In particular, we need to remember the <a href="http://www.mathwords.com/d/double_angle_identities.htm">double angle identities</a>:  <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_4ea3f4f019b8ca995d49c68c6dd38fe6.png" title="cos^2\phi - sin^2\phi = \cos(2\phi)" style="vertical-align:-20%;" class="tex" alt="cos^2\phi - sin^2\phi = \cos(2\phi)" /> and <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_aa740a359236aee32251257591a0a4a0.png" title="2\sin\phi\cos\phi = \sin(2\phi)" style="vertical-align:-20%;" class="tex" alt="2\sin\phi\cos\phi = \sin(2\phi)" />.  Taking advantage of those, we have our whole product:</p>
<p><center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_a223ea458ddce99c3aa64bee1a56dad5.png" title="[x\cos(2\phi) - y\sin(2\phi)]e_1 + [x\sin(2\phi) + y\cos(2\phi)]e_2" style="vertical-align:-20%;" class="tex" alt="[x\cos(2\phi) - y\sin(2\phi)]e_1 + [x\sin(2\phi) + y\cos(2\phi)]e_2" /></center></p>
<p>So, if we want to rotate by an angle <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_0004c76178a1d078888badee6891a8bd.png" title="\theta" style="vertical-align:-20%;" class="tex" alt="\theta" /> around the origin, we can let <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_5657bb0bd45b958667ee40e14bbdd7b6.png" title="r = \cos\frac{\theta}{2} + \sin\frac{\theta}{2}e_1e_2" style="vertical-align:-20%;" class="tex" alt="r = \cos\frac{\theta}{2} + \sin\frac{\theta}{2}e_1e_2" />.  Then, we can let <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_dcc4a8d7870a45e2472e63791cb4ff58.png" title="z_j^\prime = r\cdot z_j \cdot \overline{r}" style="vertical-align:-20%;" class="tex" alt="z_j^\prime = r\cdot z_j \cdot \overline{r}" />.  And, of course, if we want to rotate around a point <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_4e156c4dfd6f5bd0adffc493c64bc7ca.png" title="t" style="vertical-align:-20%;" class="tex" alt="t" /> instead, we can translate by <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_873cb8d5053bdc96c2a08d726284ec4e.png" title="-t" style="vertical-align:-20%;" class="tex" alt="-t" />, do this rotation, and translate <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_4e156c4dfd6f5bd0adffc493c64bc7ca.png" title="t" style="vertical-align:-20%;" class="tex" alt="t" /> back so that <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_54a43c9ac6ea791efa0bcb6db953b1d8.png" title="z_j^\prime = r \cdot (z_j - t) \cdot \overline{r} + t" style="vertical-align:-20%;" class="tex" alt="z_j^\prime = r \cdot (z_j - t) \cdot \overline{r} + t" />.</p>
<p>Now, we&#8217;ve used Clifford algebras to represent rotating, translating, and scaling the plane.  In our next installment, we will move on to use quaternions to rotate three-dimensional space.  From there, we will move to the Clifford algebra for three-dimensional vectors <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_323c829d40b1fd0ee086a39e9d742688.png" title="\mathcal{C}\ell_3" style="vertical-align:-20%;" class="tex" alt="\mathcal{C}\ell_3" />.</p>
]]></content:encoded>
			<wfw:commentRss>http://nklein.com/2009/06/clifford-algebras-for-rotating-scaling-and-translating-the-plane/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Complex Numbers for Rotating, Translating, and Scaling the Plane</title>
		<link>http://nklein.com/2009/06/complex-numbers-for-rotating-translating-and-scaling-the-plane/</link>
		<comments>http://nklein.com/2009/06/complex-numbers-for-rotating-translating-and-scaling-the-plane/#comments</comments>
		<pubDate>Sun, 07 Jun 2009 06:13:59 +0000</pubDate>
		<dc:creator>pat</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[Clifford Algebras]]></category>
		<category><![CDATA[Math]]></category>
		<category><![CDATA[conformal maps]]></category>
		<category><![CDATA[geometry]]></category>
		<category><![CDATA[polynomials]]></category>

		<guid isPermaLink="false">http://nklein.com/?p=511</guid>
		<description><![CDATA[A good friend of mine recently discovered some of the fun things you can do with complex numbers if you&#8217;re using them to represent points in the plane.  Yesterday, I re-read a passage by Tony Smith about why one should be interested in Clifford algebras.  Tony Smith&#8217;s passage included all of the fun [...]]]></description>
			<content:encoded><![CDATA[<p>A good friend of mine recently discovered some of the fun things you can do with complex numbers if you&#8217;re using them to represent points in the plane.  Yesterday, I re-read a passage by <a href="http://www.valdostamuseum.org/hamsmith/TShome.html">Tony Smith</a> about <a href="http://www.valdostamuseum.org/hamsmith/clfpq.html">why one should be interested in Clifford algebras</a>.  Tony Smith&#8217;s passage included all of the fun one can have with the complex plane and extends it to three, four, five, and more dimensions.  I thought, <q>I should segue from the complex numbers in the plane to Clifford algebras to quaternions in 3-space to Clifford algebras again in a series of posts here.</q></p>
<h3>What are Complex Numbers</h3>
<p>Say you&#8217;re playing around with polynomials.  You start playing with the equation <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_9fea09dd66c480fa713ecad13ed68053.png" title="z^2 - 1 = 0" style="vertical-align:-20%;" class="tex" alt="z^2 - 1 = 0" />.  WIth a little fiddling, you find this is equivalent to <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_3c8a1654ed4783532049c5df7fbc9449.png" title="z^2 = 1" style="vertical-align:-20%;" class="tex" alt="z^2 = 1" />.  Then, you take the square root of both sides to find that <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_bc13dda0bc6007242071d129b4d7b97e.png" title="z = \pm \sqrt{1} = \pm 1" style="vertical-align:-20%;" class="tex" alt="z = \pm \sqrt{1} = \pm 1" />.  We started with a polynomial equation in one variable in which the highest exponent was two and we found two answers.</p>
<p>Pounding your chest and sounding your barbaric yawp, you move on to <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_f365da03ebf58d14298115ccb3707800.png" title="z^2 + 1 = 0" style="vertical-align:-20%;" class="tex" alt="z^2 + 1 = 0" />.  This should be easy, right?  With the same fiddling, we find <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_c89984c5f0a8af60d1a7db39dd7a6594.png" title="z^2 = -1" style="vertical-align:-20%;" class="tex" alt="z^2 = -1" /> and then <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_73ccce548583ffab9beb7e11198019e5.png" title="z = \pm \sqrt{-1}" style="vertical-align:-20%;" class="tex" alt="z = \pm \sqrt{-1}" />.</p>
<p>Uh-oh.  What do we do now?  We can&#8217;t think of any number that when multiplied by itself gives us a negative number.  If we start with zero, we end with zero.  If we multiply a positive number by itself, we get a positive number.  If we multiply a negative number by itself, we get a <em>positive</em> number.  Again!</p>
<p><span id="more-511"></span></p>
<p>So, how do we get around this?  We pull an ace out of our sleeve.  We just run with the idea that there is such a number and see where it takes us.  We say, <q>There is a number <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_5477186a84cc2c889974ca6fd01ca96f.png" title="i" style="vertical-align:-20%;" class="tex" alt="i" /> such that <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_2effb75364932f653b3033ef36028f13.png" title="i^2 = -1" style="vertical-align:-20%;" class="tex" alt="i^2 = -1" />.  Everything else is going to stay the same.</q></p>
<p>Where does this take us?  It turns out, it takes us very, very far.  For starters, our equation <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_f365da03ebf58d14298115ccb3707800.png" title="z^2 + 1 = 0" style="vertical-align:-20%;" class="tex" alt="z^2 + 1 = 0" />, a polynomial equation in one variable where the highest exponent is two, now has two answers:  <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_de7bc04d341c737b5b97606a2dfe0981.png" title="z = \pm i" style="vertical-align:-20%;" class="tex" alt="z = \pm i" />.</p>
<p>What about <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_547b84259e1f91c9db9e937123e40aa2.png" title="z^2 + 4 = 0" style="vertical-align:-20%;" class="tex" alt="z^2 + 4 = 0" />?  It is a polynomial equation in one variable where the highest exponent is two.  It&#8217;d be pretty spiffy if there were two answers.  With the same manipulation as before, we find that <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_65f4411c3858e22f845bea4e9d5f340f.png" title="z = \pm \sqrt{-4}" style="vertical-align:-20%;" class="tex" alt="z = \pm \sqrt{-4}" />.</p>
<p>Now, we need to remember that if <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_3cad95c81df4676e1b14e93cbb0b18ae.png" title="a" style="vertical-align:-20%;" class="tex" alt="a" /> and <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_97f4a1ba736119e3cd4de6fca35efd6b.png" title="b" style="vertical-align:-20%;" class="tex" alt="b" /> are positive numbers, then <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_53519ada3075742e0a2ef81d7308daa0.png" title="\sqrt{a\cdot{b}} = \sqrt{a}\cdot\sqrt{b}" style="vertical-align:-20%;" class="tex" alt="\sqrt{a\cdot{b}} = \sqrt{a}\cdot\sqrt{b}" />.  Let&#8217;s see what happens if we extend this to allow our new number <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_5477186a84cc2c889974ca6fd01ca96f.png" title="i" style="vertical-align:-20%;" class="tex" alt="i" />.  If we said that <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_f5334506113f757d6e22338e56e99ab7.png" title="\sqrt{-4} = \sqrt{4}\cdot\sqrt{-1}" style="vertical-align:-20%;" class="tex" alt="\sqrt{-4} = \sqrt{4}\cdot\sqrt{-1}" />, then <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_b6464f3e24b21942e1d9926cbce23386.png" title="\sqrt{-4} = 2i" style="vertical-align:-20%;" class="tex" alt="\sqrt{-4} = 2i" />.  What happens if we multiply <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_06532e1cb171ae73340f6b0a07a3e9c2.png" title="2i\cdot2i" style="vertical-align:-20%;" class="tex" alt="2i\cdot2i" />?  When we multiply real number <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_3cad95c81df4676e1b14e93cbb0b18ae.png" title="a" style="vertical-align:-20%;" class="tex" alt="a" />, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_97f4a1ba736119e3cd4de6fca35efd6b.png" title="b" style="vertical-align:-20%;" class="tex" alt="b" />, and <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_08c1898a88651cdd0a9fdb2d6ce6e8a1.png" title="c" style="vertical-align:-20%;" class="tex" alt="c" />, we can do it in any order.  We could do <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_22670214cc8aaea09f2552ba682a7958.png" title="a\cdot b\cdot c" style="vertical-align:-20%;" class="tex" alt="a\cdot b\cdot c" /> or <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_918f8f3d65feca981cbef93e84060ba6.png" title="a \cdot c \cdot b" style="vertical-align:-20%;" class="tex" alt="a \cdot c \cdot b" /> or <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_a2c2637af76fe91ad2a8df47a2c9bdec.png" title="c \cdot a \cdot b" style="vertical-align:-20%;" class="tex" alt="c \cdot a \cdot b" /> (or three other orders).  Well, let&#8217;s assume for now that when we multiply <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_5477186a84cc2c889974ca6fd01ca96f.png" title="i" style="vertical-align:-20%;" class="tex" alt="i" /> by a real number, we can do it in either order.  Then <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_a149d9a9bffb0ecf34821aab72924727.png" title="2i\cdot2i = 2\cdot2\cdot i\cdot i = 4 \cdot -1 = -4" style="vertical-align:-20%;" class="tex" alt="2i\cdot2i = 2\cdot2\cdot i\cdot i = 4 \cdot -1 = -4" />.  That&#8217;s exactly what we were hoping it would be.</p>
<p>Good.  Our equation <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_547b84259e1f91c9db9e937123e40aa2.png" title="z^2 + 4 = 0" style="vertical-align:-20%;" class="tex" alt="z^2 + 4 = 0" /> is a polynomial equation in one variable where the highest exponent is two and it has two solutions <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_4df9c813ea8509c221548a60da21d681.png" title="z = \pm 2i" style="vertical-align:-20%;" class="tex" alt="z = \pm 2i" />.</p>
<p>As it turns out, by adding in <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_5477186a84cc2c889974ca6fd01ca96f.png" title="i" style="vertical-align:-20%;" class="tex" alt="i" /> (and real number multiples of <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_5477186a84cc2c889974ca6fd01ca96f.png" title="i" style="vertical-align:-20%;" class="tex" alt="i" />) to our real numbers, we have the complex numbers.  These complex numbers are an algebraic completion of the real numbers.  That&#8217;s just a fancy way of saying that if you make a polynomial equation in one variable where all of the coefficients are real numbers and the highest exponent is <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_18a633fc025e2f1a862f7c8de3b31d6c.png" title="n" style="vertical-align:-20%;" class="tex" alt="n" />, then there will be <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_18a633fc025e2f1a862f7c8de3b31d6c.png" title="n" style="vertical-align:-20%;" class="tex" alt="n" /> solutions to the equation all in the complex numbers.</p>
<p>[It turns out that the complex numbers are algebraically complete themselves.  If you make a polynomial equation in one variable where all of the coefficients are complex numbers and the highest exponent is <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_18a633fc025e2f1a862f7c8de3b31d6c.png" title="n" style="vertical-align:-20%;" class="tex" alt="n" />, then there will be <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_18a633fc025e2f1a862f7c8de3b31d6c.png" title="n" style="vertical-align:-20%;" class="tex" alt="n" /> solutions to the equation in the complex numbers.]</p>
<h3>A Quick Review of Complex Arithmetic</h3>
<p>Above, we decided to say that <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_3cc652a30b982461e9f38a041117c43a.png" title="\sqrt{-1}" style="vertical-align:-20%;" class="tex" alt="\sqrt{-1}" /> is <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_5477186a84cc2c889974ca6fd01ca96f.png" title="i" style="vertical-align:-20%;" class="tex" alt="i" /> and go from there.  We also used the idea that <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_717a284e85ef0210c35106ec3b2e54f2.png" title="\sqrt{a\cdot b} = \sqrt{a}\cdot\sqrt{b}" style="vertical-align:-20%;" class="tex" alt="\sqrt{a\cdot b} = \sqrt{a}\cdot\sqrt{b}" /> to find square roots of all negative numbers.  And, we already played around a little bit with multiplying some numbers together.  Let&#8217;s take a step back for a moment though and just add.</p>
<p>We still want the rest of our algebra to work.  Because of that, we don&#8217;t have much choice for how imaginary numbers add together.  If we take any number <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_645f43d7c6169f257cafd2dc973d2421.png" title="z" style="vertical-align:-20%;" class="tex" alt="z" /> and add it to itself, we get <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_a6d66ac4d067413ca6c058d650c05924.png" title="z + z = (1 + 1) z = 2z" style="vertical-align:-20%;" class="tex" alt="z + z = (1 + 1) z = 2z" />.  We still want that to be true when <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_f8be652f4325571a12f2fee7e1bd26e1.png" title="z = i" style="vertical-align:-20%;" class="tex" alt="z = i" /> or <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_01d34053141c3fd4aa259aff5cdc1ddd.png" title="z = 5i" style="vertical-align:-20%;" class="tex" alt="z = 5i" />.  In general, then, we will need <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_3fbe3cd4cbb4b299a185390b21fd0134.png" title="az + bz = (a + b)z" style="vertical-align:-20%;" class="tex" alt="az + bz = (a + b)z" /> for any numbers <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_3cad95c81df4676e1b14e93cbb0b18ae.png" title="a" style="vertical-align:-20%;" class="tex" alt="a" />, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_97f4a1ba736119e3cd4de6fca35efd6b.png" title="b" style="vertical-align:-20%;" class="tex" alt="b" />, and <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_645f43d7c6169f257cafd2dc973d2421.png" title="z" style="vertical-align:-20%;" class="tex" alt="z" />.</p>
<p>Earlier, we multiplied <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_06532e1cb171ae73340f6b0a07a3e9c2.png" title="2i\cdot2i" style="vertical-align:-20%;" class="tex" alt="2i\cdot2i" />.  What if we add one to <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_5477186a84cc2c889974ca6fd01ca96f.png" title="i" style="vertical-align:-20%;" class="tex" alt="i" />?  Well, we can definitely write this as <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_7a08e143cc76d57c8c288d77d726e9a6.png" title="1 + i" style="vertical-align:-20%;" class="tex" alt="1 + i" /> just like we can add one to two by just writing <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_c58688802f846bfc1980bba12853b24e.png" title="1 + 2" style="vertical-align:-20%;" class="tex" alt="1 + 2" />.  In the latter case, we already have a name for <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_c58688802f846bfc1980bba12853b24e.png" title="1 + 2" style="vertical-align:-20%;" class="tex" alt="1 + 2" />.  We could instead write <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_1b73081e7f571e9a816296b5a78040a1.png" title="3" style="vertical-align:-20%;" class="tex" alt="3" />.</p>
<p>We don&#8217;t already have a name for <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_7a08e143cc76d57c8c288d77d726e9a6.png" title="1 + i" style="vertical-align:-20%;" class="tex" alt="1 + i" />.  How do we know?  Well, let us assume that <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_7a08e143cc76d57c8c288d77d726e9a6.png" title="1 + i" style="vertical-align:-20%;" class="tex" alt="1 + i" /> is some real number or some real number times <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_5477186a84cc2c889974ca6fd01ca96f.png" title="i" style="vertical-align:-20%;" class="tex" alt="i" />.  If it is some real number, we should get a positive real number when we square it.  If it is a real number times <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_5477186a84cc2c889974ca6fd01ca96f.png" title="i" style="vertical-align:-20%;" class="tex" alt="i" />, we should get a negative real number when we square it.  But, if we multiply <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_2ac514bbaf1dc57d3298033a3518a4f7.png" title="(1 + i) \cdot (1 + i)" style="vertical-align:-20%;" class="tex" alt="(1 + i) \cdot (1 + i)" /> (using the old <a href="http://www.mathwarehouse.com/algebra/polynomial/foil-method-binomials.php"><q><b>F</b>irsts, <b>O</b>uters, <b>I</b>nners, <b>L</b>asts</q> method</a>), we get <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_c75a8f6adbb4b3af2519723da888b12e.png" title="1 + i + i + i^2 = 1 + 2i -1 = 2i" style="vertical-align:-20%;" class="tex" alt="1 + i + i + i^2 = 1 + 2i -1 = 2i" /> which is not a positive real number or a negative real number.</p>
<p>As it happens, all of our complex numbers will have the form:  <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_d21097041b32be657b9b67a074ca1685.png" title="a + bi" style="vertical-align:-20%;" class="tex" alt="a + bi" /> for some real numbers <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_3cad95c81df4676e1b14e93cbb0b18ae.png" title="a" style="vertical-align:-20%;" class="tex" alt="a" /> and <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_97f4a1ba736119e3cd4de6fca35efd6b.png" title="b" style="vertical-align:-20%;" class="tex" alt="b" />.  When we go to add two numbers together, we just add the corresponding pieces:  <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_52c57cd71ce73cc7fe190068f21a2740.png" title="(a + bi) + (c + di) = (a + c) + (b + d)i" style="vertical-align:-20%;" class="tex" alt="(a + bi) + (c + di) = (a + c) + (b + d)i" />.</p>
<p>For a complex number <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_d21097041b32be657b9b67a074ca1685.png" title="a + bi" style="vertical-align:-20%;" class="tex" alt="a + bi" />, we call <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_3cad95c81df4676e1b14e93cbb0b18ae.png" title="a" style="vertical-align:-20%;" class="tex" alt="a" /> the <q>real part</q> and <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_97f4a1ba736119e3cd4de6fca35efd6b.png" title="b" style="vertical-align:-20%;" class="tex" alt="b" /> the <q>imaginary part</q>.  When we add two complex numbers, we add the real parts together and we add the imaginary parts together.  Subtraction, likewise, goes by part.  If we want <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_76f1d667d4ef8ce89e277ccf434c5405.png" title="(a + bi) - (c + di)" style="vertical-align:-20%;" class="tex" alt="(a + bi) - (c + di)" />, we subtract the real parts and subtract the imaginary parts to obtain <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_39a47965ed260d8c5e3b752f99c23845.png" title="(a - c) + (b - d)i" style="vertical-align:-20%;" class="tex" alt="(a - c) + (b - d)i" />.</p>
<p>When we multiply two numbers together, we do it like we did with <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_cc088c202a9485ae8918eb220e951297.png" title="(1 + i)^2" style="vertical-align:-20%;" class="tex" alt="(1 + i)^2" /> above with the <abbr title="Firsts Outers Inners Lasts">FOIL</a> method.  <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_eb648edb4c17d7a96893f4aadccf60b2.png" title="(a + bi) \cdot (c + di) = ac + adi + bic + bidi" style="vertical-align:-20%;" class="tex" alt="(a + bi) \cdot (c + di) = ac + adi + bic + bidi" />.  We rearrange the orders of some of the bits as we did with <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_06532e1cb171ae73340f6b0a07a3e9c2.png" title="2i\cdot2i" style="vertical-align:-20%;" class="tex" alt="2i\cdot2i" /> above to get: <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_53a022afc07da91c056863a3e4497444.png" title="ac + adi + bci + bdi^2" style="vertical-align:-20%;" class="tex" alt="ac + adi + bci + bdi^2" />.  And since <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_2effb75364932f653b3033ef36028f13.png" title="i^2 = -1" style="vertical-align:-20%;" class="tex" alt="i^2 = -1" />, we have:<br />
<center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_2f2599c74e26e719f7903916da0d8c11.png" title="ac + adi + bci - bd = (ac - bd) + (ad + bc)i" style="vertical-align:-20%;" class="tex" alt="ac + adi + bci - bd = (ac - bd) + (ad + bc)i" /></center></p>
<h3>Transforming the Plane</h3>
<p>You&#8217;ll notice above that a complex number is made up of two real numbers (and, of course, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_5477186a84cc2c889974ca6fd01ca96f.png" title="i" style="vertical-align:-20%;" class="tex" alt="i" />).  Every point in the plane has two real numbers as coordinates.  We can co-opt the real numbers in the complex number to use as coordinates for points in the plane.  If our points are: <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_df6a991ade7cc9ad3cd908b4e2ef9946.png" title="(x_1,y_1)" style="vertical-align:-20%;" class="tex" alt="(x_1,y_1)" />, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_c1e27f0abd9ad9572f3887ef067770ab.png" title="(x_2,y_2)" style="vertical-align:-20%;" class="tex" alt="(x_2,y_2)" />, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_4b30e31f5d5a5dbe4dcd2e370ee5d1ae.png" title="\ldots" style="vertical-align:-20%;" class="tex" alt="\ldots" />, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_dd0bee170fcdd06706728b42cc47c899.png" title="(x_k,y_k)" style="vertical-align:-20%;" class="tex" alt="(x_k,y_k)" />, then we can represent them as complex numbers with <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_28ae3644980623b0f7a77c898670cdc3.png" title="z_1 = x_1 + y_1i" style="vertical-align:-20%;" class="tex" alt="z_1 = x_1 + y_1i" />, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_08b436a2e08cd8bc08583466ab138831.png" title="z_2 = x_2 + y_2i" style="vertical-align:-20%;" class="tex" alt="z_2 = x_2 + y_2i" />, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_4b30e31f5d5a5dbe4dcd2e370ee5d1ae.png" title="\ldots" style="vertical-align:-20%;" class="tex" alt="\ldots" />, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_6d26aa7ee074b77157e823923c9236f0.png" title="z_k = x_k + y_ki" style="vertical-align:-20%;" class="tex" alt="z_k = x_k + y_ki" />.</p>
<p>We can plot these just as we would their normal coordinates if we put the real part on the x-axis and the imaginary part on the y-axis.  This is called an <a href="http://mathworld.wolfram.com/ArgandDiagram.html">Argand Diagram</a>.</p>
<p>Suppose now we want to translate all of our points by five units along the x-axis and negative two units along the y-axis.  We can simply let <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_d25d3e8d44f6c1eb6ada047a85f37ee6.png" title="t = 5 - 2i" style="vertical-align:-20%;" class="tex" alt="t = 5 - 2i" /> and then add this to each of our points so that <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_483aad77b980aa545aa0a1a03969b86d.png" title="z_j^\prime = z_j + t" style="vertical-align:-20%;" class="tex" alt="z_j^\prime = z_j + t" />.</p>
<p>Imagine instead that we want to scale the plane radially out from the origin by a factor of three.  We can simply multiply each of our points by <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_1d0af52a3cdde2fdbc455453f3812e5d.png" title="s = 3 + 0i" style="vertical-align:-20%;" class="tex" alt="s = 3 + 0i" /> so that <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_9a1111f05648bd17c3c50048d78f3abd.png" title="z_j^\prime = s \cdot z_j" style="vertical-align:-20%;" class="tex" alt="z_j^\prime = s \cdot z_j" />.  If we want to scale outward from <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_56cf2f11c08438ff33e442080a1ca952.png" title="(5,2)" style="vertical-align:-20%;" class="tex" alt="(5,2)" /> instead, we could translate by <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_873cb8d5053bdc96c2a08d726284ec4e.png" title="-t" style="vertical-align:-20%;" class="tex" alt="-t" />, scale by <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_5a4f530002151e61f4239aee0d82ad4a.png" title="s" style="vertical-align:-20%;" class="tex" alt="s" />, and then translate <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_4e156c4dfd6f5bd0adffc493c64bc7ca.png" title="t" style="vertical-align:-20%;" class="tex" alt="t" /> back.<br />
<center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_66656e80e1d57fbc78e0522339f0cdf8.png" title="z_j^\prime = s \cdot \left( z_j - t \right) + t = s \cdot z_j + (1 - s) \cdot t" style="vertical-align:-20%;" class="tex" alt="z_j^\prime = s \cdot \left( z_j - t \right) + t = s \cdot z_j + (1 - s) \cdot t" /></center></p>
<p>Suppose now that we&#8217;d like to rotate the plane by some angle <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_0004c76178a1d078888badee6891a8bd.png" title="\theta" style="vertical-align:-20%;" class="tex" alt="\theta" /> around the origin.  For that rotation, a point <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_1a4d392f8222c83b05eab4d12436f9ee.png" title="(x,y)" style="vertical-align:-20%;" class="tex" alt="(x,y)" /> should get rotated to the point <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_96e28a31d467902868cea0d38c9c319c.png" title="(x\cos\theta - y\sin\theta, x\sin\theta + y\cos\theta)" style="vertical-align:-20%;" class="tex" alt="(x\cos\theta - y\sin\theta, x\sin\theta + y\cos\theta)" />.  That is to say: the complex number <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_8b2a793cf0347bb25643542086c7fb58.png" title="x + yi" style="vertical-align:-20%;" class="tex" alt="x + yi" /> should get rotated to the complex number <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_54eb3f207cded71246b555ea4e6c09f3.png" title="(x\cos\theta - y\sin\theta) + (x\sin\theta + y\cos\theta)i" style="vertical-align:-20%;" class="tex" alt="(x\cos\theta - y\sin\theta) + (x\sin\theta + y\cos\theta)i" />.</p>
<p>Let&#8217;s look back to our equation for multiplying two complex numbers:<br />
<center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_b18d23815ab4cfee8f573603f73ef3c4.png" title="(a + bi) \cdot (c + di) = (ac - bd) + (ad + bc)i" style="vertical-align:-20%;" class="tex" alt="(a + bi) \cdot (c + di) = (ac - bd) + (ad + bc)i" /></center></p>
<p>We can see the similarity to the rotation.  If we take <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_5dd2cebbfc1f4ad422c9a3950cf267f8.png" title="(x + yi) \cdot (\cos\theta + i \sin\theta)" style="vertical-align:-20%;" class="tex" alt="(x + yi) \cdot (\cos\theta + i \sin\theta)" />, then we get precisely: <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_54eb3f207cded71246b555ea4e6c09f3.png" title="(x\cos\theta - y\sin\theta) + (x\sin\theta + y\cos\theta)i" style="vertical-align:-20%;" class="tex" alt="(x\cos\theta - y\sin\theta) + (x\sin\theta + y\cos\theta)i" />.</p>
<p>The points <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_ab5edd64e6aa0048b9551f1c5f4bf0e6.png" title="(\cos\theta,\sin\theta)" style="vertical-align:-20%;" class="tex" alt="(\cos\theta,\sin\theta)" /> are the points on the unit circle centered at the origin.  So, if we want to rotate all of our points by an angle <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_0004c76178a1d078888badee6891a8bd.png" title="\theta" style="vertical-align:-20%;" class="tex" alt="\theta" /> around the origin, we simply have to multiply them by the point on the unit circle that is at angle <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_0004c76178a1d078888badee6891a8bd.png" title="\theta" style="vertical-align:-20%;" class="tex" alt="\theta" /> around the origin from the x-axis:  <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_70c534a01e04cbae9705581c1eeb099a.png" title="r = \cos\theta + i \sin\theta" style="vertical-align:-20%;" class="tex" alt="r = \cos\theta + i \sin\theta" /> so that <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_b4cc18a857ea59ba3fafcec520137551.png" title="z_j^\prime = z_j \cdot r" style="vertical-align:-20%;" class="tex" alt="z_j^\prime = z_j \cdot r" />.  Again, if we want to rotate around the point <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_4e156c4dfd6f5bd0adffc493c64bc7ca.png" title="t" style="vertical-align:-20%;" class="tex" alt="t" />, we simply translate by <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_873cb8d5053bdc96c2a08d726284ec4e.png" title="-t" style="vertical-align:-20%;" class="tex" alt="-t" />, rotate by <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_de3adc820dbc4655c45b5555765fe84b.png" title="r" style="vertical-align:-20%;" class="tex" alt="r" />, and translate <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_4e156c4dfd6f5bd0adffc493c64bc7ca.png" title="t" style="vertical-align:-20%;" class="tex" alt="t" /> back again.<br />
<center><img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_5b30fcc567f5db71079946447fe4b680.png" title="z_j^\prime = r \cdot \left( z_j - t \right) + t = r \cdot z_j + (1 - r) \cdot t" style="vertical-align:-20%;" class="tex" alt="z_j^\prime = r \cdot \left( z_j - t \right) + t = r \cdot z_j + (1 - r) \cdot t" /></center></p>
<p>So, now we can translate points in the plane with complex addition (or subtraction).  We can scale points in the plane by multiplying by a real number.  We can rotate the plane by multiplying by a complex number.</p>
<h3>Conformal maps</h3>
<p>There are some other transformations that naturally arise from complex arithmetic.  A <a href="http://en.wikipedia.org/wiki/Conformal_map">conformal transform</a> is one that keeps angles constant.  All of the transformations we&#8217;ve done above are conformal.  If you translate the whole plane, the angles between lines are unchanged.  If you scale the whole plane, the angles between lines are unchanged.  If you rotate the whole plane, the angles between lines are unchanged.</p>
<p>As it happens, a transformation of the complex plane is a conformal map if and only if the transformation has a (complex) derivative everywhere and that derivative is non-zero everywhere.  Without getting into complex derivatives here, suffice it to say, they&#8217;re pretty much just like real derivatives for simple polynomials.  Let&#8217;s look at our cases above.  The derivative of translating by <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_4e156c4dfd6f5bd0adffc493c64bc7ca.png" title="t" style="vertical-align:-20%;" class="tex" alt="t" /> is <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_e04a0c4d52e7f8537abf80bb9beb4a8a.png" title="1" style="vertical-align:-20%;" class="tex" alt="1" /> which exists everywhere and is non-zero everywhere.  The derivative of multiplying by <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_5a4f530002151e61f4239aee0d82ad4a.png" title="s" style="vertical-align:-20%;" class="tex" alt="s" /> (or <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_de3adc820dbc4655c45b5555765fe84b.png" title="r" style="vertical-align:-20%;" class="tex" alt="r" />) is <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_5a4f530002151e61f4239aee0d82ad4a.png" title="s" style="vertical-align:-20%;" class="tex" alt="s" /> (or <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_de3adc820dbc4655c45b5555765fe84b.png" title="r" style="vertical-align:-20%;" class="tex" alt="r" />).  This exists everywhere and is non-zero everywhere (if anywhere).</p>
<p>Another conformal transformation of the complex plane is the <a href="http://en.wikipedia.org/wiki/Möbius_transformation">Möbius transformation</a>.  The Möbius transformations preserve angles where lines meet, but they generally turn lines into curves.  The Möbius transformations are of the form:  <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_7ff1d71a337997aab0ae6bd075f53992.png" title="z_j^\prime = \frac{a z_j + b}{c z_j + d}" style="vertical-align:-20%;" class="tex" alt="z_j^\prime = \frac{a z_j + b}{c z_j + d}" /> for complex numbers <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_3cad95c81df4676e1b14e93cbb0b18ae.png" title="a" style="vertical-align:-20%;" class="tex" alt="a" />, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_97f4a1ba736119e3cd4de6fca35efd6b.png" title="b" style="vertical-align:-20%;" class="tex" alt="b" />, <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_08c1898a88651cdd0a9fdb2d6ce6e8a1.png" title="c" style="vertical-align:-20%;" class="tex" alt="c" />, and <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_fa25a1c273232af978e96f1ea4331d79.png" title="d" style="vertical-align:-20%;" class="tex" alt="d" /> (so long as <img src="http://nklein.com/wp-content/plugins/easy-latex/cache/tex_35360b379fbc4947d129676e9be98d6b.png" title="ad - bc \neq 0" style="vertical-align:-20%;" class="tex" alt="ad - bc \neq 0" />).  You can see the <a href="http://www.youtube.com/watch?v=JX3VmDgiFnY">Möbius transform in action</a> on YouTube.</p>
<h3>What&#8217;s next</h3>
<p>Next, we&#8217;re going to see how Clifford algebras can represent all we have done here.  But, that is for another day.</p>
]]></content:encoded>
			<wfw:commentRss>http://nklein.com/2009/06/complex-numbers-for-rotating-translating-and-scaling-the-plane/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
