<?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; non-commutativity</title>
	<atom:link href="http://nklein.com/tags/non-commutativity/feed/" rel="self" type="application/rss+xml" />
	<link>http://nklein.com</link>
	<description>software development and consulting</description>
	<lastBuildDate>Tue, 22 May 2012 03:48:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<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 [...]]]></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 explain [...]]]></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>4</slash:comments>
		</item>
	</channel>
</rss>

