<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-12400824</id><updated>2012-01-30T08:06:13.490-08:00</updated><title type='text'>Math Proofs</title><subtitle type='html'>Interesting mathematical results and elegant solutions to various problems.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://mathproofs.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12400824/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://mathproofs.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Phil</name><uri>http://www.blogger.com/profile/06843971969418366289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos11.flickr.com/14386676_7f60b1f328_m.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>17</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-12400824.post-115177546283988251</id><published>2006-07-01T10:37:00.000-07:00</published><updated>2006-07-08T19:34:45.923-07:00</updated><title type='text'>The Dot Product and Cosine</title><content type='html'>Next, we'll show that the dot product of two vectors is the product of their lengths and the cosine of the angle between them.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://static.flickr.com/54/185174580_49e841cfe7_o.png" width="182" height="33" alt="dot_cos1" /&gt;&lt;br /&gt;&lt;br /&gt;First consider two arbitrary vectors &lt;b&gt;A&lt;/b&gt; and &lt;b&gt;B&lt;/b&gt;.  We'll form a triangle with these two sides and a third side connecting the ends of &lt;b&gt;A&lt;/b&gt; and &lt;b&gt;B&lt;/b&gt;, which we'll call &lt;b&gt;C&lt;/b&gt;.  Also, let &lt;b&gt;&amp;theta;&lt;/b&gt; be the angle between sides &lt;b&gt;A&lt;/b&gt; and &lt;b&gt;B&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src="http://static.flickr.com/66/185172892_3f7014a2d8_o.png" width="306" height="206" alt="dot_cos_img" /&gt;&lt;br /&gt;&lt;br /&gt;Notice that &lt;b&gt;C&lt;/b&gt; = &lt;b&gt;A&lt;/b&gt; - &lt;b&gt;B&lt;/b&gt;, and so&lt;br /&gt;&lt;br /&gt;&lt;img src="http://static.flickr.com/71/185174596_9ac2cdf58e_o.png" width="330" height="113" alt="dot_cos2" /&gt;&lt;br /&gt;&lt;br /&gt;These simplifications rely on properties of the dot product that I worked out &lt;a href="http://mathproofs.blogspot.com/2006/06/dot-product.html"&gt;last week&lt;/a&gt;.  Also, since the dot product of a vector with itself is equal to its squared length, we have&lt;br /&gt;&lt;br /&gt;&lt;img src="http://static.flickr.com/66/185174607_862dd73af9_o.png" width="273" height="61" alt="dot_cos3" /&gt;&lt;br /&gt;&lt;br /&gt;and according to the &lt;a href="http://mathproofs.blogspot.com/2006/06/law-of-cosines.html"&gt;Law of Cosines&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src="http://static.flickr.com/1/185174619_e995e47641_o.png" width="293" height="33" alt="dot_cos4" /&gt;&lt;br /&gt;&lt;br /&gt;Combining these two we can see that&lt;br /&gt;&lt;br /&gt;&lt;img src="http://static.flickr.com/54/185174580_49e841cfe7_o.png" width="182" height="33" alt="dot_cos1" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12400824-115177546283988251?l=mathproofs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathproofs.blogspot.com/feeds/115177546283988251/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12400824&amp;postID=115177546283988251' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12400824/posts/default/115177546283988251'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12400824/posts/default/115177546283988251'/><link rel='alternate' type='text/html' href='http://mathproofs.blogspot.com/2006/07/dot-product-and-cosine.html' title='The Dot Product and Cosine'/><author><name>Phil</name><uri>http://www.blogger.com/profile/06843971969418366289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos11.flickr.com/14386676_7f60b1f328_m.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12400824.post-115090870576443559</id><published>2006-06-21T09:48:00.000-07:00</published><updated>2006-07-08T11:17:25.653-07:00</updated><title type='text'>The Dot Product</title><content type='html'>This week I just want to go over the definition of the dot product, and a few of its properties.&lt;br /&gt;&lt;br /&gt;The dot product of two vectors is the sum of the product of each of the components of two vectors.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://static.flickr.com/49/180054411_73fedc5e34_o.png" width="153" height="55" alt="dot_def1" /&gt;&lt;br /&gt;&lt;br /&gt;First, observe that for any vector &lt;b&gt;A&lt;/b&gt;,&lt;br /&gt;&lt;br /&gt;&lt;img src="http://static.flickr.com/78/180054513_a5ff6ba5f4_o.png" width="151" height="84" alt="dot_def2" /&gt;&lt;br /&gt;&lt;br /&gt;which is the squared length of &lt;b&gt;A&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Also, the dot product is commutative ...&lt;br /&gt;&lt;br /&gt;&lt;img src="http://static.flickr.com/78/180054434_7f0b50b81c_o.png" width="153" height="129" alt="dot_def3" /&gt;&lt;br /&gt;&lt;br /&gt;... distributive (with respect to vector addition) ...&lt;br /&gt;&lt;br /&gt;&lt;img src="http://static.flickr.com/56/180054445_3019ceefae_o.png" width="293" height="185" alt="dot_def4" /&gt;&lt;br /&gt;&lt;br /&gt;... and associative (with respect to scalar multiplication)  ... or perhaps bilinear as suggested by the first comment down below ...&lt;br /&gt;&lt;br /&gt;&lt;img src="http://static.flickr.com/55/180054473_841e0e26fe_o.png" width="187" height="163" alt="dot_def5" /&gt;&lt;br /&gt;&lt;br /&gt;Next time I'll show some more interesting properties of the dot product.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12400824-115090870576443559?l=mathproofs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathproofs.blogspot.com/feeds/115090870576443559/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12400824&amp;postID=115090870576443559' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12400824/posts/default/115090870576443559'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12400824/posts/default/115090870576443559'/><link rel='alternate' type='text/html' href='http://mathproofs.blogspot.com/2006/06/dot-product.html' title='The Dot Product'/><author><name>Phil</name><uri>http://www.blogger.com/profile/06843971969418366289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos11.flickr.com/14386676_7f60b1f328_m.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12400824.post-115082221869911589</id><published>2006-06-20T09:35:00.000-07:00</published><updated>2006-06-25T16:30:56.700-07:00</updated><title type='text'>The Law of Cosines</title><content type='html'>This week I'd like to prove the Law of Cosines.&lt;br /&gt;&lt;br /&gt;The Law of Cosines states that given any triangle with side lengths &lt;b&gt;a&lt;/b&gt;, &lt;b&gt;b&lt;/b&gt; and &lt;b&gt;c&lt;/b&gt; and opposing angles &lt;b&gt;A&lt;/b&gt;, &lt;b&gt;B&lt;/b&gt; and &lt;b&gt;C&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src="http://static.flickr.com/67/174462901_0a1de6a9d8_o.png" width="214" height="30" alt="coslaw1" /&gt;&lt;br /&gt;&lt;br /&gt;First we'll divide the triangle into two right triangles by drawing the line that passes through &lt;b&gt;B&lt;/b&gt; and is perpendicular to &lt;b&gt;b&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://static.flickr.com/47/174934856_0d72323279_o.png" width="306" height="198" alt="coslaw3" /&gt;&lt;br /&gt;&lt;br /&gt;Now we have a right triangle with &lt;b&gt;c&lt;/b&gt; as the hypotenuse.  And so according to the &lt;a href="http://mathproofs.blogspot.com/2006/06/pythagorean-theorem.html"&gt;Pythagorean Theorem&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src="http://static.flickr.com/53/174462902_03fce1cb53_o.png" width="360" height="118" alt="coslaw2" /&gt;&lt;br /&gt;&lt;br /&gt;The last step uses the result shown in the &lt;a href="http://mathproofs.blogspot.com/2006/06/definition-of-cosine-and-sine.html"&gt;previous post&lt;/a&gt; which was that&lt;br /&gt;&lt;br /&gt;&lt;img src="http://static.flickr.com/72/171163101_940920c290_o.png" width="165" height="30" alt="cossindef2" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12400824-115082221869911589?l=mathproofs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathproofs.blogspot.com/feeds/115082221869911589/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12400824&amp;postID=115082221869911589' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12400824/posts/default/115082221869911589'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12400824/posts/default/115082221869911589'/><link rel='alternate' type='text/html' href='http://mathproofs.blogspot.com/2006/06/law-of-cosines.html' title='The Law of Cosines'/><author><name>Phil</name><uri>http://www.blogger.com/profile/06843971969418366289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos11.flickr.com/14386676_7f60b1f328_m.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12400824.post-115070577167498770</id><published>2006-06-18T23:40:00.000-07:00</published><updated>2006-06-20T02:19:19.993-07:00</updated><title type='text'>The Definition of Cosine and Sine</title><content type='html'>In this post I'd just like to briefly give the definition of cosine and sine, and also show a simple property involving both of them.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://static.flickr.com/64/171140740_947a399acf_o.png" width="413" height="145" alt="triangles" /&gt;&lt;br /&gt;&lt;br /&gt;Consider a right triangle containing an angle &lt;b&gt;&amp;theta;&lt;/b&gt;.  All such triangles are just scalar multiples of each other.  Therefore the ratio of the adjacent side to the hypotenuse is a fixed value.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://static.flickr.com/71/171163100_1ebd46961e_o.png" width="80" height="41" alt="cossindef1" /&gt;&lt;br /&gt;&lt;br /&gt;We'll call this ratio the &lt;b&gt;cosine&lt;/b&gt; of &lt;b&gt;&amp;theta;&lt;/b&gt;.  Similarly, we can define the &lt;b&gt;sine&lt;/b&gt; of &lt;b&gt;&amp;theta;&lt;/b&gt; as the ratio of the opposite side to the hypotenuse&lt;br /&gt;&lt;br /&gt;Now, we can show that&lt;br /&gt;&lt;br /&gt;&lt;img src="http://static.flickr.com/72/171163101_940920c290_o.png" width="165" height="30" alt="cossindef2" /&gt;&lt;br /&gt;&lt;br /&gt;First we'll substitute&lt;br /&gt;&lt;br /&gt;&lt;img src="http://static.flickr.com/68/171163102_060b0d466b_o.png" width="268" height="105" alt="cossindef3" /&gt;&lt;br /&gt;&lt;br /&gt;And by the &lt;a href="http://mathproofs.blogspot.com/2006/06/pythagorean-theorem.html"&gt;Pythagorean Theorem&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src="http://static.flickr.com/59/171163103_9ae3d3d6e6_o.png" width="122" height="67" alt="cossindef4" /&gt;&lt;br /&gt;&lt;br /&gt;And so&lt;br /&gt;&lt;br /&gt;&lt;img src="http://static.flickr.com/72/171163101_940920c290_o.png" width="165" height="30" alt="cossindef2" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12400824-115070577167498770?l=mathproofs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathproofs.blogspot.com/feeds/115070577167498770/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12400824&amp;postID=115070577167498770' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12400824/posts/default/115070577167498770'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12400824/posts/default/115070577167498770'/><link rel='alternate' type='text/html' href='http://mathproofs.blogspot.com/2006/06/definition-of-cosine-and-sine.html' title='The Definition of Cosine and Sine'/><author><name>Phil</name><uri>http://www.blogger.com/profile/06843971969418366289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos11.flickr.com/14386676_7f60b1f328_m.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12400824.post-115007526813911289</id><published>2006-06-11T17:51:00.000-07:00</published><updated>2006-06-13T08:48:46.230-07:00</updated><title type='text'>Pythagorean Theorem</title><content type='html'>After a long break from posting, I'm back with something a bit more fundamental.  I'd like to offer a graphical version of &lt;a href="http://mathworld.wolfram.com/PythagoreanTheorem.html"&gt;Euclid's proof&lt;/a&gt; to the Pythagorean Theorem (I'm just going to draw the shapes, rather than name them by their vertices).&lt;br /&gt;&lt;br /&gt;First, though, we need to make sure that you're comfortable with the fact that shearing a shape doesn't change its area.  In the following diagram, I've shown that shearing a rectangle doesn't change its area, because you can get the same shape by chopping off a triangle from one side of the rectangle and putting it on the other side.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://static.flickr.com/52/165565400_4414c6a54b_o.png" width="342" height="220" alt="shearing01" /&gt;&lt;br /&gt;&lt;br /&gt;So you can see that if shearing a parallelogram maintains its area, shearing any triangle (since a triangle is just half of a parallelogram) should maintain its area, as well.&lt;br /&gt;&lt;br /&gt;Now, we'll move on to the Pythagorean Theorem.  We'll take an arbitrary right triangle, and attach squares to each of the sides.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://static.flickr.com/60/165565291_a6024b5ada_o.png" width="196" height="265" alt="proof_01" /&gt;&lt;br /&gt;&lt;br /&gt;Now, we'll show that the &lt;b&gt;c&lt;/b&gt; square has the area of both the &lt;b&gt;a&lt;/b&gt; square and the &lt;b&gt;b&lt;/b&gt; square.  We'll accomplish this by showing that, in the following diagram, the two blue rectangles have the same area, and the two green rectangles have the same area as well.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://static.flickr.com/76/165565309_b2f4487026_o.png" width="196" height="265" alt="proof_02" /&gt;&lt;br /&gt;&lt;br /&gt;First, notice that these two triangles (in the following diagram) are identical, and so they have the same area.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://static.flickr.com/77/165565322_1fd0c3187e_o.png" width="425" height="265" alt="proof_03" /&gt;&lt;br /&gt;&lt;br /&gt;Now shear the first triangle so that it becomes half of the &lt;b&gt;a&lt;/b&gt; square.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://static.flickr.com/56/165565331_74e7dabe6d_o.png" width="425" height="265" alt="proof_04" /&gt;&lt;br /&gt;&lt;br /&gt;Then shear the second triangle so that it becomes half of the left portion of the &lt;b&gt;c&lt;/b&gt; square.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://static.flickr.com/54/165565338_c5e71af6e1_o.png" width="425" height="265" alt="proof_05" /&gt;&lt;br /&gt;&lt;br /&gt;And since the two brown triangles have equal area, the two blue rectangles must have the same area as well (since they each have twice the area of one of the brown triangles)&lt;br /&gt;&lt;br /&gt;&lt;img src="http://static.flickr.com/47/165565345_44af48e825_o.png" width="425" height="265" alt="proof_06" /&gt;&lt;br /&gt;&lt;br /&gt;Now, we will use the same logic on another pair of identical triangles.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://static.flickr.com/61/165565360_4858321e2a_o.png" width="425" height="265" alt="proof_07" /&gt;&lt;br /&gt;&lt;br /&gt;Shear the first triangle so that it becomes half of the &lt;b&gt;b&lt;/b&gt; square.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://static.flickr.com/44/165565372_3f1ef43096_o.png" width="425" height="265" alt="proof_08" /&gt;&lt;br /&gt;&lt;br /&gt;Shear the second triangle so that it becomes half of the right portion of the &lt;b&gt;c&lt;/b&gt; square.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://static.flickr.com/45/165565379_5cb62d819d_o.png" width="425" height="265" alt="proof_09" /&gt;&lt;br /&gt;&lt;br /&gt;And since these two triangles have equal area, the two green rectangles must have the same area as well.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://static.flickr.com/51/165565390_c0e2514c17_o.png" width="425" height="265" alt="proof_10" /&gt;&lt;br /&gt;&lt;br /&gt;And so the &lt;b&gt;c&lt;/b&gt; square has an area equal to the sum of the areas of the &lt;b&gt;a&lt;/b&gt; square and the &lt;b&gt;b&lt;/b&gt; square.  In other words &lt;b&gt;c&lt;sup&gt;2&lt;/sup&gt; = a&lt;sup&gt;2&lt;/sup&gt; + b&lt;sup&gt;2&lt;/sup&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src="http://static.flickr.com/76/165565309_b2f4487026_o.png" width="196" height="265" alt="proof_02" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12400824-115007526813911289?l=mathproofs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathproofs.blogspot.com/feeds/115007526813911289/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12400824&amp;postID=115007526813911289' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12400824/posts/default/115007526813911289'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12400824/posts/default/115007526813911289'/><link rel='alternate' type='text/html' href='http://mathproofs.blogspot.com/2006/06/pythagorean-theorem.html' title='Pythagorean Theorem'/><author><name>Phil</name><uri>http://www.blogger.com/profile/06843971969418366289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos11.flickr.com/14386676_7f60b1f328_m.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12400824.post-112770714698989550</id><published>2005-09-25T20:49:00.000-07:00</published><updated>2005-10-05T03:49:22.306-07:00</updated><title type='text'>Number Divisibility Tricks</title><content type='html'>I didn't need these for anything I'm working on currently, but I thought it was interesting and I haven't had anything to write about in a while anyway.  Also, these tricks assume the number is in base ten, although similar tricks can be divised for other bases (in case you want to do something with a number stored in binary, say).&lt;br /&gt;&lt;br /&gt;Everyone's heard of the trick for finding out if a number is divisible by 9.  Just add up all the digits, and if the result is divisible by 9, then the original number is divisible by 9 as well.  Another trick for finding if a number is divisible by 11 is to add, and then subtract alternatively each digit of the number, and if the result is divisible by 11, then the original number is divisible by 11.&lt;br /&gt;&lt;br /&gt;These tricks (as well as others) can be explained pretty easily with modular arithmetic.  Modular arithmetic is another way of thinking about numbers that places all the integers into what are called equivalence classes.  For example, when considering the integers modulo 9, there are 9 equivalence classes, let's call them 0, 1, 2, 3, 4, 5, 6, 7 and 8.  And a number is placed into the equivalence class given by the remainder when you divide by 9.  So the numbers in the 0 equivalence class are 0, 9, 18, 27, 36, etc (as well as -9, -18, -27, etc), and the numbers in the 1 equivalence class are 1, 10, 19, 28, -8, -17, etc.  An interesting consequence is if you pick 2 classes, A and B, then regardless of the elements you choose from those classes, when you add them, the result is always in the same equivalence class, namely A + B mod 9.  Similarly when you multiply any 2 elements from those classes, the result is always in the same equivalence class, namely A * B mod 9.&lt;br /&gt;&lt;br /&gt;Okay, now we get back to the divisibility tricks.  For the divisible-by-9 trick, let's look at the numbers modulo 9 (or mod 9 for short).  Notice that 1, 10, 100, 1000 and all positive integer powers of 10 fall into the same equivalence class, namely the 1 class.  Given a number&lt;br /&gt;&lt;br /&gt;&lt;img src="http://static.flickr.com/25/46663782_8077fceb0b_o.jpg" width="397" height="30" alt="img1" /&gt;&lt;br /&gt;&lt;br /&gt;and modulo 9, this is&lt;br /&gt;&lt;br /&gt;&lt;img src="http://static.flickr.com/33/46663789_dcfc88410a_o.jpg" width="418" height="58" alt="img2" /&gt;&lt;br /&gt;&lt;br /&gt;And so a number is in the same class modulo 9 as the sum of its digits.&lt;br /&gt;&lt;br /&gt;The divisible-by-11 rule follows from the fact that the numbers 1, 100, 10000, etc are all in the 1 mod 11 class, and the numbers 10, 1000, 100000, etc are all in the 10 mod 11 class.  The 10 mod 11 class also has -1, so the number can be written&lt;br /&gt;&lt;br /&gt;&lt;img src="http://static.flickr.com/30/46663810_4bbc17f8a6_o.jpg" width="418" height="58" alt="img3" /&gt;&lt;br /&gt;&lt;br /&gt;Here's a list of tricks for finding if a number is divisible by the numbers 2 through 15.  All they actually do is tell you how to get another number in the same equivalence class that tends to be much smaller, so that it's easier to tell if it's in the 0 equivalence class (meaning that it's divisible).&lt;br /&gt;&lt;br /&gt;2 : Just take the ones digit (if the ones digit is divisible by 2, then the whole number is divisible by 2)&lt;br /&gt;&lt;br /&gt;3 : Add all the digits.  If the result is divisible by 3, then the original number was also.&lt;br /&gt;&lt;br /&gt;4 : The ones digit plus two times the tens digit.&lt;br /&gt;&lt;br /&gt;5 : The ones digit by itself&lt;br /&gt;&lt;br /&gt;6 : The ones digit minus two times the sum of the rest of the digits&lt;br /&gt;&lt;br /&gt;7 : The ones digit, plus three times the tens, plus two times the hundreds, minus the thousands, minus three times the ten-thousands, minus two times the hundred-thousands, plus the millions, etc (the pattern is 1, 3, 2, -1, -3, -2, repeat).  This is because&lt;br /&gt;&lt;br /&gt;&lt;img src="http://static.flickr.com/24/46663821_8ff61f7c22_o.jpg" width="589" height="60" alt="img4" /&gt;&lt;br /&gt;&lt;br /&gt;8 : The ones digit plus two times the tens digit plus four times the hundreds digit&lt;br /&gt;&lt;br /&gt;9 : Add all of the digits&lt;br /&gt;&lt;br /&gt;10 : The ones digit by itself&lt;br /&gt;&lt;br /&gt;11 : The ones digit, minus the tens digit, plus the hundreds digit, minus the thousands digit, etc&lt;br /&gt;&lt;br /&gt;12 : The ones digit, minus two times the tens digit, plus four times the sum of the rest of the digits&lt;br /&gt;&lt;br /&gt;13 : The ones digit, minus three times the tens, minus four times the hundreds, minus the thousands, plus three times the ten-thousands, plus four times the hundred-thousands, etc (the pattern is 1, -3, -4, -1, 3, 4, repeat)&lt;br /&gt;&lt;br /&gt;14 : The pattern is 1, -4, 2, 6, 4, -2, -6, then go to -4 and repeat&lt;br /&gt;&lt;br /&gt;15 : The ones digit, minus 5 times the sum of the rest of the digits&lt;br /&gt;&lt;br /&gt;I'll leave it at that.  I'm sure its obvious enough how to create these tricks by now (and they're getting a little too complicated anyway).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12400824-112770714698989550?l=mathproofs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathproofs.blogspot.com/feeds/112770714698989550/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12400824&amp;postID=112770714698989550' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12400824/posts/default/112770714698989550'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12400824/posts/default/112770714698989550'/><link rel='alternate' type='text/html' href='http://mathproofs.blogspot.com/2005/09/number-divisibility-tricks.html' title='Number Divisibility Tricks'/><author><name>Phil</name><uri>http://www.blogger.com/profile/06843971969418366289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos11.flickr.com/14386676_7f60b1f328_m.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12400824.post-112396725070258822</id><published>2005-08-13T13:53:00.000-07:00</published><updated>2012-01-15T10:10:48.793-08:00</updated><title type='text'>Smooth Interpolation</title><content type='html'>It is often useful when interpolating to accelerate into the interpolation and/or decelerate out of the interpolation.  For example, an object moving from one place to another looks a little better if it accelerates from its stationary state into the move, and then slows down before stopping again.  Here I'll talk about how to smooth out a linear interpolation as much (or as little) as you want.&lt;br /&gt;&lt;br /&gt;Without any smoothing, you just linearly increase the interpolation factor from zero to one.  Instead of this linear movement, let's try increasing the interpolation factor as a function of time f(t).  Now let's say that the length in time of the interpolation is 1 (you can easily scale this to any interpolation over any time length), and that the length of the acceleration is a, and the length of the deceleration is b.  Then we want the derivative of f(t) to look something like this&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/22/33726095_27df2cbf7f_o.jpg" width="491" height="250" alt="derivative" /&gt;&lt;br /&gt;&lt;br /&gt;Now we just need to determine the height of this trapezoid, such that the area under f'(t) is 1 so that f(1) = 1.  The area under the curve is&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/23/33726160_d395167d0f_o.jpg" width="252" height="200" alt="img1" /&gt;&lt;br /&gt;&lt;br /&gt;So for the acceleration (0 &amp;le; t &lt; a)&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/23/33726176_233669f9c5_o.jpg" width="122" height="92" alt="img2" /&gt;&lt;br /&gt;&lt;br /&gt;And for the linear part (a &amp;le; t &lt; 1-b)&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/22/33726185_912c4aa0d6_o.jpg" width="141" height="61" alt="img3" /&gt;&lt;br /&gt;&lt;br /&gt;Our initial condition for this part is that f is continuous at f(a), so&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/22/33726187_f2b78c35d7_o.jpg" width="143" height="137" alt="img4" /&gt;&lt;br /&gt;&lt;br /&gt;So the linear segment is&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/21/33726194_a97f98a0ce_o.jpg" width="124" height="46" alt="img5" /&gt;&lt;br /&gt;&lt;br /&gt;And finally, for the deceleration (1-b &amp;le; t &amp;le; 1) we have&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/23/33726197_9f1a8124d9_o.jpg" width="220" height="136" alt="img6" /&gt;&lt;br /&gt;&lt;br /&gt;Again, to satisfy continuity at f(1-b), we need&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/22/33726202_1dd4d82309_o.jpg" width="457" height="291" alt="img7" /&gt;&lt;br /&gt;&lt;br /&gt;So the deceleration segment is&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/30/38180746_bec6a9abf9_o.jpg" width="253" height="137" alt="img8" /&gt;&lt;br /&gt;&lt;br /&gt;And the function with the desired acceleration and deceleration is&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/29/38180749_ccad6cf825_o.jpg" width="358" height="122" alt="img9" /&gt;&lt;br /&gt;&lt;br /&gt;Here is a graph of f(t) for various values of a and b.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/21/33726119_ac9225ce4e_o.gif" width="389" height="389" alt="function" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12400824-112396725070258822?l=mathproofs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathproofs.blogspot.com/feeds/112396725070258822/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12400824&amp;postID=112396725070258822' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12400824/posts/default/112396725070258822'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12400824/posts/default/112396725070258822'/><link rel='alternate' type='text/html' href='http://mathproofs.blogspot.com/2005/08/smooth-interpolation.html' title='Smooth Interpolation'/><author><name>Phil</name><uri>http://www.blogger.com/profile/06843971969418366289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos11.flickr.com/14386676_7f60b1f328_m.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12400824.post-112064503690207905</id><published>2005-07-06T03:05:00.000-07:00</published><updated>2012-01-15T09:59:04.840-08:00</updated><title type='text'>Mapping a Cube to a Sphere</title><content type='html'>After the &lt;a href="http://mathproofs.blogspot.com/2005/07/mapping-square-to-circle.html"&gt;last post&lt;/a&gt;, I got to thinking about how to come up with a mapping from the cube&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/18/24013684_8d50231da9_o.jpg" width="114" height="87" alt="img1" /&gt;&lt;br /&gt;&lt;br /&gt;to the points in the unit sphere.  In the last post I used the mapping&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/18/24013686_b8b82150c1_o.jpg" width="163" height="78" alt="img2" /&gt;&lt;br /&gt;&lt;br /&gt;Taking the length of the new point gives&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/18/24013690_29cfaad71e_o.jpg" width="332" height="128" alt="img3" /&gt;&lt;br /&gt;&lt;br /&gt;So you can see that if x or y are either -1 or +1, this yeilds a vector with unit length.  So, beginning with this, I decided that I'd work backward from the guess that if I had a mapping from the cube to the unit sphere, the length of a generated point would need to be&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/18/24013696_f0f909c6b4_o.jpg" width="505" height="337" alt="img4" /&gt;&lt;br /&gt;&lt;br /&gt;Which leads to the mapping&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/18/24013697_73e20d567a_o.jpg" width="280" height="124" alt="img5" /&gt;&lt;br /&gt;&lt;br /&gt;Trying this out yields some pretty nice results.  This is the cube and its mapping onto the unit sphere.  The thick lines are lines where at least two of the components are -1 or +1.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/18/24012831_0f071f41bc_o.gif" width="335" height="287" alt="cubesphere" /&gt;&lt;br /&gt;&lt;br /&gt;And here's another view from inside the sphere&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/18/24013890_7f7d835efb_o.jpg" width="463" height="412" alt="sphereInside" /&gt;&lt;br /&gt;&lt;br /&gt;Sorry this post is a little light on justification.  I might try to explain this by looking at the level curves defined by constant x, y and z, but I'll save that for another day (maybe).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12400824-112064503690207905?l=mathproofs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathproofs.blogspot.com/feeds/112064503690207905/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12400824&amp;postID=112064503690207905' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12400824/posts/default/112064503690207905'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12400824/posts/default/112064503690207905'/><link rel='alternate' type='text/html' href='http://mathproofs.blogspot.com/2005/07/mapping-cube-to-sphere.html' title='Mapping a Cube to a Sphere'/><author><name>Phil</name><uri>http://www.blogger.com/profile/06843971969418366289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos11.flickr.com/14386676_7f60b1f328_m.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12400824.post-112054906550710608</id><published>2005-07-05T00:20:00.000-07:00</published><updated>2012-01-15T09:56:04.939-08:00</updated><title type='text'>Mapping a Square to a Circle</title><content type='html'>I wanted to come up with a nice way to map all the points in the square&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/18/23713479_4fe2573a30_o.jpg" width="114" height="60" alt="img1" /&gt;&lt;br /&gt;&lt;br /&gt;to the points in the unit circle, such that the points along the axes are unchanged, and the corners get normalized.  The way I went about this was to think of a line of constant x (as well as a line of constant y) getting mapped to an ellipse in the circle.  So for our first requirement to hold true, the ellipse for some constant x has the equation&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/18/23713483_9596474b80_o.jpg" width="105" height="48" alt="img2" /&gt;&lt;br /&gt;&lt;br /&gt;Now we want to make sure that points along the curve at the top of the circle (from 45 degrees to 135 degrees) are all accounted for.  So for x between -1 and 1, we want the ellipse to pass through the point&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/18/23713487_bb744811ab_o.jpg" width="152" height="74" alt="img3" /&gt;&lt;br /&gt;&lt;br /&gt;So we'll plug that in, and that should give us the b coefficient for our ellipse&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/18/23713488_0dfea1c0a0_o.jpg" width="162" height="125" alt="img4" /&gt;&lt;br /&gt;&lt;br /&gt;So the ellipse for constant x is&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/18/23713497_10effdf142_o.jpg" width="135" height="49" alt="img5" /&gt;&lt;br /&gt;&lt;br /&gt;Similarly, for a line of constant y, we get the ellipse&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/18/23713500_e41aedacc9_o.jpg" width="134" height="52" alt="img6" /&gt;&lt;br /&gt;&lt;br /&gt;Solving the first for x', we get&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/18/23713502_b38e4e3d4e_o.jpg" width="263" height="104" alt="img7" /&gt;&lt;br /&gt;&lt;br /&gt;Plugging this into the second equation gives&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/18/23713503_441fcb32a6_o.jpg" width="549" height="307" alt="img8" /&gt;&lt;br /&gt;&lt;br /&gt;and by symmetry we can see that the mapping&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/18/23714881_836dd09542_o.jpg" width="163" height="78" alt="img9" /&gt;&lt;br /&gt;&lt;br /&gt;takes the square from -1 to 1 on the x and y axes, to the unit circle.  Here's a demonstration of that mapping, which shows its effect on various grid lines.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/16/21509286_8cc734fd70_o.gif" width="686" height="340" alt="slices" /&gt;&lt;br /&gt;&lt;br /&gt;I'd like to find a way to map a cube to the unit sphere.  Hopefully I can get that ready for the next post.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12400824-112054906550710608?l=mathproofs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathproofs.blogspot.com/feeds/112054906550710608/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12400824&amp;postID=112054906550710608' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12400824/posts/default/112054906550710608'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12400824/posts/default/112054906550710608'/><link rel='alternate' type='text/html' href='http://mathproofs.blogspot.com/2005/07/mapping-square-to-circle.html' title='Mapping a Square to a Circle'/><author><name>Phil</name><uri>http://www.blogger.com/profile/06843971969418366289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos11.flickr.com/14386676_7f60b1f328_m.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12400824.post-111977759219104370</id><published>2005-06-26T02:09:00.000-07:00</published><updated>2012-01-15T09:53:27.834-08:00</updated><title type='text'>Smoothing a Sequence of Points (Part 2)</title><content type='html'>This is the second part of a method to smooth out sequences of points such that they maintain their rough shape, but loose all the high frequency noise.  Refer to &lt;a href="http://mathproofs.blogspot.com/2005/06/smoothing-sequence-of-points-part-1.html"&gt;Part 1&lt;/a&gt; for definitions and background.&lt;br /&gt;&lt;br /&gt;The second special case we'll consider is a zig-zag pattern, where the angle between consecutive points is always the same, the distance is consistent, and all the points are coplanar.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/17/21609274_36871794d4_o.jpg" width="401" height="198" alt="points1" /&gt;&lt;br /&gt;&lt;br /&gt;The desired result is that a sequence of points like this will get flattened out to a straight line in a single application of the filter.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/16/21609276_cf18cc4583_o.jpg" width="401" height="198" alt="points2" /&gt;&lt;br /&gt;&lt;br /&gt;This can be accomplished if&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/17/21608723_fd7d8d69f0_o.jpg" width="736" height="388" alt="img1" /&gt;&lt;br /&gt;&lt;br /&gt;Using this fact along with the constraint from Part 1 that&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/15/21608734_b0958aa598_o.jpg" width="77" height="45" alt="img2" /&gt;&lt;br /&gt;&lt;br /&gt;gives us&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/17/21608736_7fe6bab4f3_o.jpg" width="148" height="45" alt="img3" /&gt;&lt;br /&gt;&lt;br /&gt;Here's a couple of demos that show the effects of this filter over 30 iterations.  Each point alternates in color from blue to red, so that you can see the concentration of points along the line list.  The first is like the points generated from a character swinging a weapon around in a circle, with infrequent samples.  If you lay down 4 or 5 points per sample (along the straight lines between the samples), and then apply the filter, you'll get results like this&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/17/21612635_569872824c_o.gif" width="441" height="459" alt="spin" /&gt;&lt;br /&gt;&lt;br /&gt;The next example is more of a noisy data set, and you can see how the noise gets eliminated, but the general shape is preserved.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/15/21612596_199d071949_o.gif" width="441" height="459" alt="noise" /&gt;&lt;br /&gt;&lt;br /&gt;So finally, the filter that accomplishes both of our goals is&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/15/21723276_2d861cb3d8_o.jpg" width="471" height="180" alt="img4" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12400824-111977759219104370?l=mathproofs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathproofs.blogspot.com/feeds/111977759219104370/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12400824&amp;postID=111977759219104370' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12400824/posts/default/111977759219104370'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12400824/posts/default/111977759219104370'/><link rel='alternate' type='text/html' href='http://mathproofs.blogspot.com/2005/06/smoothing-sequence-of-points-part-2.html' title='Smoothing a Sequence of Points (Part 2)'/><author><name>Phil</name><uri>http://www.blogger.com/profile/06843971969418366289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos11.flickr.com/14386676_7f60b1f328_m.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12400824.post-111862694237868188</id><published>2005-06-12T18:27:00.000-07:00</published><updated>2012-01-15T09:49:13.438-08:00</updated><title type='text'>Smoothing a Sequence of Points (Part 1)</title><content type='html'>The problem came up of rendering a ribbon and making sure that the points used for the ribbon are nice and smooth.  This list of points is generated from an animated object that moves and rotates quickly, and sampling the animation tends to give really jagged results.  One solution is to evaluate the animation multiple times per frame to get extra samples to smooth the ribbon out.  This seems a little costly, so I wanted to figure out if there was some way to smooth out the ribbon without having to do extra animation updates.&lt;br /&gt;&lt;br /&gt;Let's call the nth point in the point sequence P&lt;sub&gt;n&lt;/sub&gt;.  Also (for convenience) let's define&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/14/18993962_1cb020a394_o.jpg" width="160" height="116" alt="img1" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/13/18993976_3c64767d9b_o.jpg" width="401" height="234" alt="img2" /&gt;&lt;br /&gt;&lt;br /&gt;We'll try to smooth out this point sequence by applying a filter to each point in the sequence that adds in bits of nearby points to try to smooth out the sequence.&lt;br /&gt;&lt;br /&gt;Note that specifying a filter as the sum of coefficients on the points P&lt;sub&gt;n-2&lt;/sub&gt; through P&lt;sub&gt;n+2&lt;/sub&gt; requires that all the coefficients add up to 1 (otherwize the filter will yield different results depending on where P&lt;sub&gt;n&lt;/sub&gt; is relative to the origin).  Using coefficients on the A&lt;sub&gt;i&lt;/sub&gt; vectors and the P&lt;sub&gt;n&lt;/sub&gt; point, the requirement is that the coefficient on P&lt;sub&gt;n&lt;/sub&gt; is 1 and the coefficients on the A&lt;sub&gt;i&lt;/sub&gt; vectors can be whatever we want.&lt;br /&gt;&lt;br /&gt;The first idea that came to mind to shave off sharp corners was to calculate the filtered P&lt;sub&gt;n&lt;/sub&gt; (call it P'&lt;sub&gt;n&lt;/sub&gt;) as a weighted average of P&lt;sub&gt;n&lt;/sub&gt; and the midpoint between P&lt;sub&gt;n-1&lt;/sub&gt; and P&lt;sub&gt;n+1&lt;/sub&gt;.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/12/18993982_c56af59eaf_o.jpg" width="401" height="234" alt="img3" /&gt;&lt;br /&gt;&lt;br /&gt;Not only would this flatten out sharp corners, but it also takes a non-uniformly distributed sequence of collinear points, and (after a number of iterations) distributes them evenly along the line.  In terms of the A&lt;sub&gt;i&lt;/sub&gt; we get &lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/15/18994033_187e9488ee_o.jpg" width="365" height="180" alt="img4" /&gt;&lt;br /&gt;&lt;br /&gt;This filter, however, tends to either flatten out curves quickly (for values of a close to zero), or not have much effect (for values of a close to one).  So I thought it might be worthwhile to introduce A&lt;sub&gt;-2&lt;/sub&gt; and A&lt;sub&gt;2&lt;/sub&gt; multiplied by a coefficient b, and then subtract that sum from the previous filter.  The idea is to try to push out points on a smooth curve that would otherwise get flattened, while still allowing more high frequency noise to get flattened out.&lt;br /&gt;&lt;br /&gt;Over the next few weeks we'll consider two uniform cases, and try to find coefficients a and b that will accomplish these goals.  The case that we'll consider this week is one of constant curvature, where the distance between each pair of consecutive points is the same, the angles formed between P&lt;sub&gt;n-1&lt;/sub&gt;, P&lt;sub&gt;n&lt;/sub&gt; and P&lt;sub&gt;n+1&lt;/sub&gt; is consistant, and all the points are coplanar.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/13/18994036_31536a316b_o.jpg" width="401" height="234" alt="img5" /&gt;&lt;br /&gt;&lt;br /&gt;Its easy to see that these points fall on a circle, and a vector toward the center of the circle (from P&lt;sub&gt;n&lt;/sub&gt;) is (A&lt;sub&gt;-1&lt;/sub&gt; + A&lt;sub&gt;1&lt;/sub&gt;).  So to measure whether a filter will shrink or grow one of these point sequences, we just need to check the sign of&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/16/19286204_3861b59dcd_o.jpg" width="724" height="117" alt="img6" /&gt;&lt;br /&gt;&lt;i&gt;Equation (1)&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Setting this to zero and solving for b gives&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/15/19286207_96191b81d7_o.jpg" width="422" height="234" alt="img7" /&gt;&lt;br /&gt;&lt;i&gt;Equation (2)&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Given a particular &amp;theta; and a particular a, this tells us what b will provide a root of equation (1).  Also, we can see that for any &amp;theta; from &amp;pi;/3 to &amp;pi;, cos &amp;theta; + cos 2 &amp;theta; &lt; 0.  So in this range (1) increases as b &lt;b&gt;increases&lt;/b&gt;.  For &amp;theta; from 0 to &amp;pi;/3, cos &amp;theta; + cos 2 &amp;theta; &gt; 0, so equation (1) increases as b &lt;b&gt;decreases&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/13/19286202_d211d33d08_o.jpg" width="609" height="369" alt="graph1" /&gt;&lt;br /&gt;&lt;i&gt;Graph of Equation (2) for a = 0.5 with extrema at 0 and &amp;pi;&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Therefore the allowable range of values for b is bounded below by the maximum for (2) with &amp;theta; in the range 0 to &amp;pi;/3, and above by the minimum of (2) with &amp;theta; in the range &amp;pi;/3 to &amp;pi;.  So to find these extrema of (2), we'll take it's derivative, and set it equal to zero.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/17/19286211_97c48d3c73_o.jpg" width="312" height="107" alt="img8" /&gt;&lt;br /&gt;&lt;br /&gt;This equals zero where sin &amp;theta; = 0.  And so the extrema are at &amp;theta; = 0 and &amp;pi;.  These extrema give the range&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/14/19286219_31ec49282b_o.jpg" width="252" height="91" alt="img9" /&gt;&lt;br /&gt;&lt;br /&gt;This maximum ((1-a)/6) turns out to work very well.  We haven't really proven anything about filtering general 3D point sequences, but this line of reasoning can be used on the 2D projections of 3D curves, and its pretty easy to see that the 2D projection of a filtered sequence is the same as filtering the 2D projection of the original sequence.  We'll leave it for next week to pursue this subject further and come up with another constraint in order to decide on a pair of values for a and b that will accomplish another desirable effect.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12400824-111862694237868188?l=mathproofs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathproofs.blogspot.com/feeds/111862694237868188/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12400824&amp;postID=111862694237868188' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12400824/posts/default/111862694237868188'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12400824/posts/default/111862694237868188'/><link rel='alternate' type='text/html' href='http://mathproofs.blogspot.com/2005/06/smoothing-sequence-of-points-part-1.html' title='Smoothing a Sequence of Points (Part 1)'/><author><name>Phil</name><uri>http://www.blogger.com/profile/06843971969418366289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos11.flickr.com/14386676_7f60b1f328_m.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12400824.post-111681392066117732</id><published>2005-05-22T18:47:00.000-07:00</published><updated>2012-01-15T09:44:38.126-08:00</updated><title type='text'>Player Position Prediction</title><content type='html'>In this post I'll describe a simple way to predict where the player will be in a few moments.  This method works well in the games I've worked on, and I would imagine this would work for any third person game with a free camera.&lt;br /&gt;&lt;br /&gt;The idea is that if a player pushes the analog control in any particular direction and holds it there, his character will move in either a straight line, or a circle (assuming it doesn't hit any obstacles).  So let's assume that the best way to predict the players position is to assume that the current turning speed and linear speed will stay the same over the desired prediction time.&lt;br /&gt;&lt;br /&gt;This method of prediction fixes the naive approach of just adding the current linear velocity times the number of seconds forward.  All the player has to do to fool this prediction is run in very tight circles.  The whole time the player would have a very large linear velocity, but he doesn't end up going anywhere, because of the large angular speed.  So this post will show you how to take the player's angular speed into account.&lt;br /&gt;&lt;br /&gt;So let's say P(t) is the position of the player at time t, and dt is the change in time from the last update.  So the estimated velocity is&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/9/15186302_d1d628d756_o.jpg" width="199" height="47" alt="img1" /&gt;&lt;br /&gt;&lt;br /&gt;Let's call D(t) the heading direction at time t, and s(t) is the speed (scalar) at time t.  Also, let's assume that the player moves mostly in the xz-plane, and the positive y-axis is the natural up vector.  We will only attempt to predict the player's xz movement, since jumping, double jumping, etc. tend to make the vertical movement more erratic.  So we'll calculate the speed and direction by&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/9/15186305_2b872792ba_o.jpg" width="145" height="76" alt="img2" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/12/15186312_e7c03434b0_o.jpg" width="118" height="33" alt="img3" /&gt;&lt;br /&gt;&lt;br /&gt;First, if s(t) = 0, then the predicted position is just the current position, P(t), and we're done.  Otherwise the players current heading direction is&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/13/15186315_ac06f618f0_o.jpg" width="111" height="52" alt="img4" /&gt;&lt;br /&gt;&lt;br /&gt;So now we can get a turning rate (angular velocity about the y-axis) as&lt;br /&gt;&lt;br /&gt;&lt;img src="http://photos10.flickr.com/10/15186326_baef99230b_o.jpg" width="270" height="49" alt="img5" /&gt;&lt;br /&gt;&lt;br /&gt;Given that D(t) is a unit vector with no y-component, we can calculate a "left" vector with&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/13/15186335_0ecae69c69_o.jpg" width="186" height="152" alt="img6" /&gt;&lt;br /&gt;&lt;br /&gt;So now that we have an angular velocity, and a linear velocity, we can extrapolate the player's position u seconds forward.  If a(t) = 0, then&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/10/15186336_8988cec3c8_o.jpg" width="129" height="33" alt="img7" /&gt;&lt;br /&gt;&lt;br /&gt;and&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/14/15186340_57e661e24b_o.jpg" width="214" height="33" alt="img8" /&gt;&lt;br /&gt;&lt;br /&gt;Otherwise (for non-zero a(t)), we have&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/9/15186344_d79745bda4_o.jpg" width="463" height="33" alt="img9" /&gt;&lt;br /&gt;&lt;br /&gt;Integrating this gives us&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/9/15186346_446ffd22da_o.jpg" width="542" height="137" alt="img10" /&gt;&lt;br /&gt;&lt;br /&gt;And solving for C&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/13/15186349_378af6eadd_o.jpg" width="371" height="103" alt="img11" /&gt;&lt;br /&gt;&lt;br /&gt;And so, the player's position at time t+u is given by&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/9/15186352_c7975375e6_o.jpg" width="546" height="52" alt="img12" /&gt;&lt;br /&gt;&lt;br /&gt;Once you have this set up, you'll probably notice that the predicted position jumps around quite a bit.  To help alleviate this, just keep track of the current linear and angular speeds, and smooth them out over a few updates.&lt;br /&gt;&lt;br /&gt;You can also use some fraction of their current linear and/or angular speed when evaluating a particular prediction in order to "lead" the player less (or not at all).  Or you can use multipliers greater than 1 to overshoot the player.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12400824-111681392066117732?l=mathproofs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathproofs.blogspot.com/feeds/111681392066117732/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12400824&amp;postID=111681392066117732' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12400824/posts/default/111681392066117732'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12400824/posts/default/111681392066117732'/><link rel='alternate' type='text/html' href='http://mathproofs.blogspot.com/2005/05/player-position-prediction.html' title='Player Position Prediction'/><author><name>Phil</name><uri>http://www.blogger.com/profile/06843971969418366289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos11.flickr.com/14386676_7f60b1f328_m.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12400824.post-111632782295436178</id><published>2005-05-17T03:44:00.000-07:00</published><updated>2012-01-15T09:41:10.105-08:00</updated><title type='text'>Uniformly Distributed Random Unit Quaternions</title><content type='html'>Okay, sorry it took me so long to get back to this problem, but I've been busy with getting ready for E3.  So I finally have a solution for uniformly distributed unit quaternions (or 4 vectors, whatever you want to call them)&lt;br /&gt;&lt;br /&gt;For background (and previous definitions) see &lt;a href="http://mathproofs.blogspot.com/2005/04/uniform-random-distribution-on-sphere.html"&gt;the previous post about random unit 3 vectors&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Now, we'll derive a way to randomly generate points on the surface of a 4-dimensional sphere.  Again, we'll calculate a formula for A.  The surface measure of a section swept out by&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/10/11682483_5186f703ee_o.jpg" width="218" height="106" alt="randomspherepoint10" /&gt;&lt;br /&gt;&lt;br /&gt;is&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/6/11682488_8eb6680e08_o.jpg" width="421" height="331" alt="randomspherepoint11" /&gt;&lt;br /&gt;&lt;br /&gt;So the probability of getting a point whose &amp;theta;&lt;sub&gt;2&lt;/sub&gt; is between 0 and x is&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/11/11682495_29b8a8bd18_o.jpg" width="248" height="254" alt="randomspherepoint12" /&gt;&lt;br /&gt;&lt;br /&gt;This would be difficult to invert, so instead, we'll use the fact that we can make &amp;theta;&lt;sub&gt;2&lt;/sub&gt; a function of multiple random numbers, as long as the probability comes out right.  So let's guess that it would take the form&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/11/14307409_6b914e2b18_o.jpg" width="261" height="141" alt="randomspherepoint13" /&gt;&lt;br /&gt;&lt;br /&gt;We multiply X by &amp;pi;, and add &amp;pi;/2 to arcsin(Y) to change the range of both expressions to (0, &amp;pi;).  If this guess is correct, the two coefficients will probably add up to 1 (making this a weighted average of the two expressions) &lt;br /&gt;So the probability that &amp;theta;&lt;sub&gt;2&lt;/sub&gt; is less than x (for x between 0 and &amp;pi;) is the sum of all probabilities (for all possible m's) that X is less than m and arcsin(Y)+&amp;pi;/2 is less than (x- m).  Therefore&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/14/14307442_2e6deaad91_o.jpg" width="662" height="708" alt="randomspherepoint14" /&gt;&lt;br /&gt;&lt;br /&gt;And setting these two equal gives&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/13/14307449_ab881a14e7_o.jpg" width="427" height="91" alt="randomspherepoint15" /&gt;&lt;br /&gt;&lt;br /&gt;so that means&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/9/14307467_c6e5420a32_o.jpg" width="280" height="80" alt="randomspherepoint16" /&gt;&lt;br /&gt;&lt;br /&gt;Which initially looks over constrained (3 equations and 2 unknowns), but fortunately we guessed well, and it turns out that&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/14/14307479_eda02e5e1e_o.jpg" width="164" height="68" alt="randomspherepoint17" /&gt;&lt;br /&gt;&lt;br /&gt;So, finally, we can say that to generate a uniformly random point on the surface of a 4-dimensional sphere&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/13/14307485_ea33e79a1c_o.jpg" width="443" height="278" alt="randomspherepoint18" /&gt;&lt;br /&gt;&lt;br /&gt;And it's pretty easy to see that (in terms of random number generation)&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/9/14307497_0ea8bc7536_o.jpg" width="236" height="63" alt="randomspherepoint18b" /&gt;&lt;br /&gt;&lt;br /&gt;yields the same results as&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/11/14307499_9293edc82d_o.jpg" width="191" height="56" alt="randomspherepoint18c" /&gt;&lt;br /&gt;&lt;br /&gt;Which looks a little nicer (you don't need to add the &amp;pi;/2).&lt;br /&gt;I'll leave it as an excersize for the reader to figure out that to generate a uniformly random point throughout the sphere (not just on the surface) you just need to pick a random radius by&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/7/11682543_2b5cbbded3_o.jpg" width="195" height="55" alt="randomspherepoint19" /&gt;&lt;br /&gt;&lt;br /&gt;where n is the number of dimensions of the sphere&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12400824-111632782295436178?l=mathproofs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathproofs.blogspot.com/feeds/111632782295436178/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12400824&amp;postID=111632782295436178' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12400824/posts/default/111632782295436178'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12400824/posts/default/111632782295436178'/><link rel='alternate' type='text/html' href='http://mathproofs.blogspot.com/2005/05/uniformly-distributed-random-unit.html' title='Uniformly Distributed Random Unit Quaternions'/><author><name>Phil</name><uri>http://www.blogger.com/profile/06843971969418366289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos11.flickr.com/14386676_7f60b1f328_m.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12400824.post-111490869187526086</id><published>2005-04-30T17:00:00.000-07:00</published><updated>2012-01-15T09:36:09.071-08:00</updated><title type='text'>Uniform Random Distribution on a Sphere</title><content type='html'>Today we'll derive how to pick a uniformly distributed random point on the surface of a sphere (as well as on the surface of a 4-dimensional sphere .. useful for picking random orientations by generating random quaternions).&lt;br /&gt;&lt;br /&gt;Note : When you refer to an n-sphere, the n refers to the dimension of the manifold, but in this topic, I consider a sphere as a solid (rather than just a manifold), and refer to the manifold as its border.  So a 3-dimensional sphere is a ball in R&lt;sup&gt;3&lt;/sup&gt;, rather than the 3-dimensional border of a ball in R&lt;sup&gt;4&lt;/sup&gt;.  Sorry for the confusion to all the math majors out there, but I think the average person thinks of a "normal" sphere as a 3-dimensional solid (rather than a 2-dimensional manifold) .. thanks, Andy.&lt;br /&gt;&lt;br /&gt;First, let's say that we have a random number generator UnitRand() that generates a uniformly distributed number on the interval [0, 1).  Given a generator of random points on the border of a circle, the probability of getting a point whose angle is between 0 and x is&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/7/11682434_79ad9b0da6_o.jpg" width="109" height="71" alt="randomspherepoint01" /&gt;&lt;br /&gt;&lt;br /&gt;So our random circle point generator needs to be&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/6/11682450_f3f1c25ab7_o.jpg" width="358" height="115" alt="randomspherepoint02" /&gt;&lt;br /&gt;&lt;br /&gt;Now, to get a random point on a sphere, we'll need to derive the surface area of a part of a sphere defined by sweeping a certain angle in longitude and latitude.  We'll use this to  write a formula for the probability of generating a point in that section, which we'll use to derive a random sphere point generator.&lt;br /&gt;&lt;br /&gt;Let's define a function A(r, &amp;theta;&lt;sub&gt;0&lt;/sub&gt;, ... , &amp;theta;&lt;sub&gt;n-1&lt;/sub&gt;) that is the surface "measure" of a portion of an n-dimensional sphere (1-dimensional sphere is a line segment, 2-dimensional sphere is a circle, etc) subtended by (n-1) ranges of angles (1 for a circle, 2 for a sphere .. longitude and latitude,  etc).  We know that A(r,&amp;theta;) = r&amp;theta; is a formula for the arc length of a circular arc of &amp;theta; radians and radius r.  I'll propose that the formula for the surface area of a portion of a sphere is based off of it&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/6/11682454_fe0948a60b_o.jpg" width="271" height="77" alt="randomspherepoint03" /&gt;&lt;br /&gt;&lt;br /&gt;In fact, you can always find the next formula from the previous one by the relation&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/8/11682457_707a041245_o.jpg" width="353" height="77" alt="randomspherepoint04" /&gt;&lt;br /&gt;&lt;br /&gt;I won't prove this part (this is going to be long enough already).  So, the part of the surface of a sphere swept out by&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/8/11682461_5fbe26818e_o.jpg" width="213" height="71" alt="randomspherepoint05" /&gt;&lt;br /&gt;&lt;br /&gt;has the area&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/10/11682469_035ef12e40_o.jpg" width="276" height="287" alt="randomspherepoint06" /&gt;&lt;br /&gt;&lt;br /&gt;With a uniform distribution on the surface of a sphere, the probability of getting a point whose &amp;theta;&lt;sub&gt;1&lt;/sub&gt; is between 0 and x is&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/9/11723777_2f721f6011_o.jpg" width="245" height="200" alt="randomspherepoint07" /&gt;&lt;br /&gt;&lt;br /&gt;Therefore the formula for &amp;theta;&lt;sub&gt;1&lt;/sub&gt; is&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/11/11682477_acbb382f8a_o.jpg" width="339" height="147" alt="randomspherepoint08" /&gt;&lt;br /&gt;&lt;br /&gt;So, a formula for an evenly distributed random point on the surface of a sphere is&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/10/11682480_cab0863949_o.jpg" width="277" height="185" alt="randomspherepoint09" /&gt;&lt;br /&gt;&lt;br /&gt;The rest of this post has been removed until I can figure out what I did wrong.  Look forward to having a nice formula for uniformly distributed points on the surface of a sphere in R&lt;sup&gt;4&lt;/sup&gt; soon.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12400824-111490869187526086?l=mathproofs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathproofs.blogspot.com/feeds/111490869187526086/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12400824&amp;postID=111490869187526086' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12400824/posts/default/111490869187526086'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12400824/posts/default/111490869187526086'/><link rel='alternate' type='text/html' href='http://mathproofs.blogspot.com/2005/04/uniform-random-distribution-on-sphere.html' title='Uniform Random Distribution on a Sphere'/><author><name>Phil</name><uri>http://www.blogger.com/profile/06843971969418366289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos11.flickr.com/14386676_7f60b1f328_m.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12400824.post-111439779391682118</id><published>2005-04-24T19:24:00.000-07:00</published><updated>2012-01-15T09:32:49.949-08:00</updated><title type='text'>Nth Term of the Fibonacci Sequence</title><content type='html'>I can't remember how I first found this proof .. I think it might have been a homework assignment. Regardless, it's been one of my favorite proofs ever since, so I figured I should probably include it here. The object is to come up with a closed form solution for the nth term of the Fibonacci sequence f={0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, ...} (I start with zero for the zeroth fibonacci number, and one for the first, but you'll see that this method allows you to easily compute a Fibonacci-like sequence with any two initial values)&lt;br /&gt;&lt;br /&gt;Now lets write an iterative formula for the nth and (n+1)th term, and then we'll solve for a closed form solution.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/7/11157004_407484ccff_o.jpg" width="249" height="107" alt="fibonacci01" /&gt;&lt;br /&gt;&lt;br /&gt;So you can see, by multiplying this matrix repeatedly, it yields the nth and (n+1)th term&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/8/11157007_552108a19d_o.jpg" width="220" height="105" alt="fibonacci02" /&gt;&lt;br /&gt;&lt;br /&gt;Now to simplify that nasty nth power of A, we'll use a trick known as diagonalization. If we can write A as a product of 3 matrices P, D and P inverse, where D is a diagonal matrix, it gives us an easy way to write the nth power of A&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/6/11157009_8c2630dc87_o.jpg" width="174" height="350" alt="fibonacci03" /&gt;&lt;br /&gt;&lt;br /&gt;Now, I won't get into proving that this method of diagonalization works. If you want that much detail you can go &lt;a href="http://mathworld.wolfram.com/MatrixDiagonalization.html"&gt;here&lt;/a&gt;. Now, the next step is to find the eigenvectors and eigenvalues of A. So first we'll solve the characteristic equation of A.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/7/11157011_cc2f69db64_o.jpg" width="144" height="227" alt="fibonacci04" /&gt;&lt;br /&gt;&lt;br /&gt;So, now we find the eigenvectors for the two eigenvalues. For the eigenvalue&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/10/11157014_5b4ce71f1b_o.jpg" width="121" height="83" alt="fibonacci05" /&gt;&lt;br /&gt;&lt;br /&gt;we find&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/9/11157016_2866f1a2d3_o.jpg" width="270" height="348" alt="fibonacci06" /&gt;&lt;br /&gt;&lt;br /&gt;So our first eigenvalue-eigenvector pair is&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/9/11157017_1bc943cd48_o.jpg" width="247" height="122" alt="fibonacci07" /&gt;&lt;br /&gt;&lt;br /&gt;Now, for the second eigenvalue&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/9/11157018_cfcb2df7d3_o.jpg" width="115" height="73" alt="fibonacci08" /&gt;&lt;br /&gt;&lt;br /&gt;we find&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/9/11157021_c2a5d973c5_o.jpg" width="268" height="353" alt="fibonacci09" /&gt;&lt;br /&gt;&lt;br /&gt;So our second eigenvalue-eigenvector pair is&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/8/11157022_8d1335a207_o.jpg" width="268" height="120" alt="fibonacci10" /&gt;&lt;br /&gt;&lt;br /&gt;Now we can construct our matrices&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/6/11157023_305aa6b09e_o.jpg" width="199" height="256" alt="fibonacci11" /&gt;&lt;br /&gt;&lt;br /&gt;And to calculate P inverse, we'll need the determinant of P (the invese of P is the transpose of the cofactor matrix times one over the determinant)&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/7/11157025_29f39e4b6c_o.jpg" width="262" height="72" alt="fibonacci12" /&gt;&lt;br /&gt;&lt;br /&gt;and so&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/10/11157029_7e508974f7_o.jpg" width="220" height="134" alt="fibonacci13" /&gt;&lt;br /&gt;&lt;br /&gt;And now we plug it all in to find a formula for the nth power of A&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/7/11157032_c370efb8a1_o.jpg" width="542" height="464" alt="fibonacci14" /&gt;&lt;br /&gt;&lt;br /&gt;And so we can see (from our second equation) that the formula for the nth number in the Fibonacci sequence is the lower left entry in this matrix&lt;br /&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/6/11157043_4aabe5a627_o.jpg" width="280" height="93" alt="fibonacci15" /&gt;&lt;br /&gt;&lt;br /&gt;Using this result, you can easily find a formula for the nth term of any Fibonacci-like sequence (same rules for generating the sequence, but with different starting numbers) just by changing the vector that you multiply with the nth power of A.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12400824-111439779391682118?l=mathproofs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathproofs.blogspot.com/feeds/111439779391682118/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12400824&amp;postID=111439779391682118' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12400824/posts/default/111439779391682118'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12400824/posts/default/111439779391682118'/><link rel='alternate' type='text/html' href='http://mathproofs.blogspot.com/2005/04/nth-term-of-fibonacci-sequence.html' title='Nth Term of the Fibonacci Sequence'/><author><name>Phil</name><uri>http://www.blogger.com/profile/06843971969418366289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos11.flickr.com/14386676_7f60b1f328_m.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12400824.post-111438685391748593</id><published>2005-04-24T16:36:00.000-07:00</published><updated>2012-01-15T09:26:38.771-08:00</updated><title type='text'>Trig Identities</title><content type='html'>This is a simple trick that helps me remember a number of useful trig identities in one derivation.  We'll derive formulas for both cos(A+B) and sin(A+B) at the same time.  First we'll derive a useful relationship between the exponential function, sine and cosine.  The Taylor expansion of a function is &lt;BR&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/8/11156979_f45f1ca54a_o.jpg" width="192" height="69" alt="doublesincos01" /&gt;&lt;BR&gt;&lt;br /&gt;So the Taylor expansion of the the exponential function is&lt;BR&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/7/11156982_7f7041845c_o.jpg" width="307" height="75" alt="doublesincos02" /&gt;&lt;BR&gt;&lt;br /&gt;And the Taylor expansion of sine and cosine are&lt;BR&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/6/11156983_4f374b0f8e_o.jpg" width="366" height="79" alt="doublesincos03" /&gt;&lt;BR&gt;&lt;br /&gt;and&lt;BR&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/10/11156986_332c02a69b_o.jpg" width="390" height="86" alt="doublesincos04" /&gt;&lt;BR&gt;&lt;br /&gt;Now, expanding the exponential function of i (a square root of -1) times a number theta gives&lt;BR&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/7/11156989_6c20b8977d_o.jpg" width="377" height="228" alt="doublesincos05" /&gt;&lt;BR&gt;&lt;br /&gt;So, now we'll use the fact that the product of two exponentials is the exponential of the sum of their powers to give&lt;BR&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/10/11156995_79ca3c3424_o.jpg" width="498" height="245" alt="doublesincos06" /&gt;&lt;BR&gt;&lt;br /&gt;Now given that the real parts of both sides must be equal, as well as the imaginary parts, this one equation yields the following two identities&lt;BR&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/10/11156997_c53b90a2b8_o.jpg" width="363" height="47" alt="doublesincos07" /&gt;&lt;BR&gt;&lt;br /&gt;and&lt;BR&gt;&lt;br /&gt;&lt;img src="http://farm1.staticflickr.com/8/11157001_e8e8dba468_o.jpg" width="361" height="47" alt="doublesincos08" /&gt;&lt;BR&gt;&lt;br /&gt;And that wraps her all up.  Now you can easily derive cos(2A) and sin(2A) (the double angle identities) by plugging in A for B in the above equations.  Similarly, you can derive sin(A-B) and cos(A-B) by substituting -B for B, and remembering that sin(-x) = -sin(x) and cos(-x) = cos(x).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12400824-111438685391748593?l=mathproofs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathproofs.blogspot.com/feeds/111438685391748593/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12400824&amp;postID=111438685391748593' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12400824/posts/default/111438685391748593'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12400824/posts/default/111438685391748593'/><link rel='alternate' type='text/html' href='http://mathproofs.blogspot.com/2005/04/trig-identities.html' title='Trig Identities'/><author><name>Phil</name><uri>http://www.blogger.com/profile/06843971969418366289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos11.flickr.com/14386676_7f60b1f328_m.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-12400824.post-111435543509517593</id><published>2005-04-24T08:07:00.000-07:00</published><updated>2005-09-28T08:31:34.820-07:00</updated><title type='text'>Blog Intro</title><content type='html'>I just started this blog as a way to keep track of the different interesting results I find in my day to day work as a video game programmer.  You can look forward to seeing solutions to specific problems I've encountered, or just general mathematical grab-bag type stuff.  I'll try to make at least one new post a week.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/12400824-111435543509517593?l=mathproofs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mathproofs.blogspot.com/feeds/111435543509517593/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=12400824&amp;postID=111435543509517593' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/12400824/posts/default/111435543509517593'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/12400824/posts/default/111435543509517593'/><link rel='alternate' type='text/html' href='http://mathproofs.blogspot.com/2005/04/blog-intro.html' title='Blog Intro'/><author><name>Phil</name><uri>http://www.blogger.com/profile/06843971969418366289</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://photos11.flickr.com/14386676_7f60b1f328_m.jpg'/></author><thr:total>0</thr:total></entry></feed>
