Friday, February 22, 2013

Brouwer Fixed-Point Theorem


Imagine you have two sheets of graph paper of the same size, one atop the other. Your friend takes one piece, crumples it into a ball, and tossies it onto the other sheet so that no piece of the ball extends beyond the edge of the bottom paper. Brouwer's Fixed-Point theorem tells us that there is atleast one point in the ball that lies directly above its corresponding point on the flat piece, in other words, there is atleast one point that is directly above its original position.

The theorem works in other dimensions too. Imagine a bowl of punch. The theorem insists that when your friend stirs the punch, atleast one liquid particle is in the same position as it was before stirring.

In more precise language, a continuous function from an $n$-ball to an $n$-ball (where $n$>0 is the dimension) must have a fixed point.

Short of a proof, it is easier to understand why it works if you think of a one dimensional line. To be concrete, suppose we map the real number line $[0,1]$ continuously to $[\frac{1}{3},\frac{5}{6}]$ via $f(x) = \frac{1}{2}x + \frac{1}{3}$. We get the following map:

0 _________________________ 1 $\rightarrow$
           $\frac{1}{3}$________________ $\frac{5}{6}$

We notice that $\frac{1}{3} = f(0) > 0$ and that $f(x)$ continues to be greater than $x$ for a while. Since $\frac{5}{6} = f(1) < 1$, it must flip, and thereafter $f(x) < x$. In this case, Brouwer's Fixed-Point theorem, that there must exist a point with $f(x)=x$, follows directly from the Intermediate Value theorem. In fact, it is easy to check that there is a fixed point at $x=\frac{2}{3}$.



___________________________________________________________________________________

Tuesday, February 19, 2013

Puzzler - Snow



It starts snowing in the morning and continues steadily throughout the day. A snowplow that removes snow at a constant rate starts plowing at noon. It plows 2 miles in the first hour, and 1 mile in the second. What time did it start snowing?

Solution: 11:23 am 
Solution Explanation


___________________________________________________________________________________

Friday, February 15, 2013

Happy Valentines Day


Here is a Java game I made. You need to have the latest Java installed. Works best in Safari on a Mac.
  • 'c' : change colors
  • "=" : speed up time
  • '-' : slow down time
  • '1': change movement type
  • [arrow keys]: move

Java Applet

Wednesday, February 13, 2013

Irrational^Irrational


In an earlier post I proved that $\sqrt{2}$ is an irrational number. What about $\sqrt{2}^{\sqrt{2}}$? We can actually use this number to prove that it's possible to have an irrational$^{\text{irrational}}$ = rational, without actually constructing an example.
    • Either $\sqrt{2}^{\sqrt{2}}$ is rational $\checkmark$
    • Or it is irrational and $\left(\sqrt{2}^{\sqrt{2}}\right)^{\sqrt{2}} = 2$ is rational $\checkmark$
The Gelfond Schneider Theorem tells us that $\sqrt{2}^{\sqrt{2}}$ is transcendental, and since it is real, it is irrational.
    • If $\alpha$ and $\beta$ are algebraic numbers with $\alpha \neq 0,1$ and if $\beta$ is not a rational number, then any value of $\alpha^{\beta} = e^{\beta \text{log} \alpha}$ is a transcendental number.
In fact, it's not too difficult to find examples for all of the 8 possible rational/irrational triples $\alpha^{\beta} = \gamma$. Let's explore a bit further and look at infinite tetrations. For your amusement I wrote some hackish code that prompts you for a number $n>1$, then outputs the infinite tetration that converges to it. It is a surprising result that $$ \sqrt{2}^{{\sqrt{2}}^{{\sqrt{2}}^{{\sqrt{2}}^{...}}}} = 2 $$


 from math import *
 LIMIT,em = 2,2**-52
 
 def tetration(b, LIMIT):
  a = 1
  for i in xrange(1000):
   try:
    a = b**a
    if a > LIMIT: return False
   except OverflowError:
    return False
  return a
 
 while LIMIT >= 1:
  LIMIT = input('\nTetration Limit: ')
  em = 2**-52
  lo, hi = 1.0,2.0
  
  while hi-lo > em:
   mid = (hi+lo)/2
   tetmid = tetration(mid, LIMIT)
   if tetmid: lo = mid
   else: hi = mid
   
  print lo, tetration(lo, LIMIT)



___________________________________________________________________________________

Sunday, February 10, 2013

Sylvester's Line


In 1893 Sylvester asked the mathematical community to prove that given a finite number of points in the plane, either, 1) A line exists that passes thru exactly two of the points or 2) All the points are collinear, that is they lie on the same straight line. His conjecture stumped mathematicians for nearly 50 years until it was correctly solved by Gallai in 1944. A simple and elegant book proof was given by Kelly four years later:

Proof Sketch:
Let $S$ be the given set of points (not all collinear). Consider the collection $C$ of pairs $(L,p)$, where $L$ is a line through at least two distinct points in $S$ and where $p \in S$ is a point not on $L$. Then $C$ is a nonempty finite set of pairs. Among those, pick $(L,p)$ such that the distance from $p$ to $L$ is minimal. We claim that $L$ harbors exactly two points from $S$.

Assume NOT, then $L$ contains 3 or more points. Let $q$ be the projection of $p$ onto $L$. In the figure below, on the horizontal line $L$ we label $q$ and the three points $a,b,c$ in $S$. Two of $a,b,c$ must be on either side of $q$, WLOG as in the figure. Consider $b$ and draw the line $L'$ through $p$ and $c$. In the figure, $L'$ is the slanted line. Then $(L',b)$ belongs to $C$ and the distance from $b$ to $L'$ is strictly less than the distance from $p$ to $L$, a CONTRADICTION.





___________________________________________________________________________________

Saturday, February 9, 2013

Gram Schmidt


Suppose we have a set of linearly independent vectors $V = \{v_1, v_2, ..., v_n\}$ and we want to find a new set of orthonormal vectors $Q = \{q_1, q_2, ..., q_n\}$ that span the same space. We can use the Gram Schmidt (GS) process, commonly implemented in three ways:

  • Initially let $Q = \{\emptyset\}$
  • Pivot: Find the vector $v_i$ not in $Q$ with the largest $\ell^2-$norm
    • Classical: Orthogonalize the next vector $v_i$ against all vectors previously added to $Q$. Then normalize $v$ and add it to $Q$.
    • Modified: Normalize $v$ and add it to $Q$. Then orthogonalize all vectors not in $Q$ against $v$ .
    • Complete: When adding $v$, do Classical twice, or Modified twice, or both once.

By orthogonalize v against u, I mean to subtract the $u$-component from $v$ ($v - $proj$_uv$). Each method is more numerically stable than the last, and the stability of complete Gram Schmidt is on par with the Householder reflections or Givens rotations. A good example is if you let your vectors be the columns of matrix $A_{i,j} = 1/(j+k^2) \;\; ; \;\; j = 1,2,...,100 \;\; , \;\; k = 1,2,...,50$. The maximum dot product of any two vectors in $Q$ for classical = $0.62$, modified $= 0.02$, and complete $= 3.47$e-16, found using the Matlab code below.

GS can be used to find the $QR$ decomposition of a matrix, $Q$ unitary and $R$ upper-triangular, which lets you solve the linear system $Ax=b$ more efficiently than directly computing $A^{-1}$.


    function [Q] = GramSchmidt(Q, type)
       
        EM = 2^-53;
        n = size(Q,2);

        for i = 1:n

            % PIVOT
            qdotq = sum(Q(:,i:n).^2,1);
            j = i-1 + find(qdotq == max(qdotq),1);
            Q(:,[i,j]) = Q(:,[j,i]);
            if norm(Q(:,i)) < EM, break, end

            % CLASSIC AND COMPLETE
            if ~strcmp(type,'modified')
                for j = 1:i-1
                    Q(:,i) = Q(:,i) - dot(Q(:,i),Q(:,j))*Q(:,j);
                end
                Q(:,i) = Q(:,i) / norm(Q(:,i));
            end

            % MODIFIED AND COMPLETE
            if ~strcmp(type,'classical')
                Q(:,i) = Q(:,i) / norm(Q(:,i));
                for j = i+1:n
                    Q(:,j) = Q(:,j) - dot(Q(:,j),Q(:,i))*Q(:,i);
                end
            end
        end
    end



___________________________________________________________________________________


Friday, February 8, 2013

Puzzler - Purgatory


Solution to Puzzler 1




Solution: While pointing at one door, ask, "is it true that you are a either a truthful bird and that door leads to heaven or a lying bird and that door leads to hell?" If the bird says yes or no, the door leads to heaven or hell, respectively.



___________________________________________________________________________________

Tuesday, February 5, 2013

Pascals Triangle

Pascals Triangle was originally discovered by the Chinese in the $11^{th}$ century, but was later studied in depth by the French mathematician Blaise Pascal in the 17th century. Pascals triangle has many interesting properties.


  • The $k^{th}$ number in the $n^{th}$ row is the binomial coefficient ${n \choose k} = \frac{n!}{k!(n-k)!}$
    • The number of ways to choose $k$ socks out of a drawer filled with $n$ different socks
    • The coefficient in front of $a^kb^{n-k}$ when $(a+b)^n$ is expanded
  • Each number is the sum of the two above it. ${n \choose k} = {n-1 \choose k-1} + {n-1 \choose k}$
  • The triangle is symmetric. ${n \choose k} = {n\choose n-k}$
  • The sum of the $n^{th}$ row is $2^n$. $\sum_{k}{n \choose k} = 2^n$
  • The sum of the squares of the values in the $n^{th}$ row is the middle of the $2n^{th}$ row. $\sum_{k}{n \choose k}^2 = {2n \choose n}$
  • The semi-diagonals sum to the Fibonacci Numbers
  • The third diagonal from the left gives the Triangular Numbers
  • On the third diagonal from the left, each subsequent pair of numbers sums to the next perfect square
  • If you squeeze together the $n^{th}$ row into one number you get $11^n$
  • The Hockey Stick identity
    • ${n+1 \choose k+1} = {k \choose k} + {k+1 \choose k} + ... + {n \choose k}$
    • ${n+k+1 \choose k} = {n \choose 0} + {n+1 \choose 1} + ... + {n+k \choose k}$


Modular Pascals Triangle

One of the cooler properties of Pascals triangle is how when you display the remainder of each value when divided by $n$ (mod $n$), it forms a Sierpinski Triangle in the limit. The following are for $n = 2,3,5,7$.





When $n$ is a prime number it is easy to see the recurrence for $R_p(n)$, the number of elements in the $n^{th}$ row not equivalent to 0 (mod p) and the recurrence for $T_p(n)$, the number of elements in the triangle up thru the $n^{th}$ row not equivalent to 0 (mod p). If $n$ written out in base $p$ is $\eta_k\eta_{k-1}...\eta_0$, then

$$R_p(\eta_k...\eta_0) = \prod_{k}(\eta_k + 1)$$
$$T_p(\eta_k...\eta_0) =  \frac{\eta_k(\eta_k+1)}{2} T_p(1_k00...0) +  (\eta_k+1)\,T_p(\eta_{k-1}...\eta_0)$$
$T_p(p^k) = T_p(1_k00...0) = \left(\frac{p(p+1)}{2}\right)^{k}$

Can we generalize this result to powers of primes, or numbers that are the product of two primes? You can play around with modular pascals triangle with this java applet, though you might need to use a browser other than Chrome. Here are some revealing pictures.



4: [0 = black, 1, 2, 3]               8: [0 = black, 1, 2, 3, 4, 5, 6, 7]



6: [0 = black, 1, 2, 3, 4, 5]               6 : [0 = black, 1, 2, 3, 4, 5]



10: [0 = black, 1, 2, 3, 4, 5, 6, 7, 8, 9]      10: [0 = black, 1,2,3,4,5,6,7,8,9]



___________________________________________________________________________________

Sunday, February 3, 2013

Powerball



The Powerball jackpot just broke 200 million. Is the ticket worth what we pay for it? Let's calculate the expected return of a ticket. Let $\mathcal{P}(n,m,q)$ be the probability of matching $q$ out of $m$ balls where each ball is selected from $[n]=\{1,2,\ldots,n\}$ (without replacement). This value is easily calculated:

$$\mathcal{P}(n,m,q) = \frac{\text{# winning tickets}}{\text{# total tickets}} = \frac{{m \choose q} {n-m \choose m-q}}{ {n \choose m} } $$

For the Powerball lottery we have $n = 59$ and $m=5$ and we have an extra powerball which is a number independently chosen from $[35]$. Let $P(\bullet^{\alpha} \circ^{q})$ be the probability of matching $\alpha \in \{0,1\}$ powerballs and $q \in \{0,1,2,3,4,5\}$ regular balls.

$$ P(\bullet^{\alpha} \circ^{q}) = {35}^{-\alpha} \, \mathcal{P}(59,5,q) $$

To calculate the expected return we need to sum over the 9 ways to win $\omega$, the probability $P(\omega)$ times the winnings $W(\omega)$. Let the jackpot be $X$ million.

$$ \sum_{\omega}P(\omega)W(\omega) \;\;\; = \;\;\; 4P(\bullet) + 4P(\bullet \circ) + 7P(\bullet \circ^2) + 7P(\circ^3) + ... \;\;\; = \;\;\; 0.37 + X/175 $$

The jackpot is currently 208 million, so the expected return is 1.56 dollars, 44 cents less than the 2 dollars you pay for the ticket -- and that's before taxes! In fact, your estimated jackpot winnings need to be 285 million before a ticket is worth buying.



_________________________________________________________________________________

Saturday, February 2, 2013

Irrationality of $\sqrt{2}$




A cool geometric proof first presented by Tom Apostol. If $\sqrt{2}$ is rational we can draw an isosceles right triangle with integer sides. Consider the smallest such triangle ABC -- that is with shortest hypotenuse. Let the apex be A and hypotenuse AC. Draw a circle centered at A with radius the length of AB and mark point D where it intersects the hypotenuse. Now draw the tangent to the circle at D and mark the point E where it cuts the base of the triangle. Then DEC is a smaller isosceles right triangle with integer sides. This is a contradiction.

Algebraically this leads to the proof that nonperfect squares have irrational roots. Suppose $p/q = \sqrt{n}$. Then $$ \frac{p'}{q'} = \frac{nq - \lfloor \sqrt{n} \rfloor p}{p - \lfloor \sqrt{n} \rfloor q} = \frac{p}{q}$$and $0 < p' < p$ and $0 < q' < q$ (You can follow the lines in the diagram). Exercise: what is the total area of the wedges? $(\sqrt{2}+1)\pi/16 = .47403$

Borwein and Bailey. Mathematics by Experiment. p73



___________________________________________________________________________________


Friday, February 1, 2013

Puzzler - Ants on a Stick


Ants on a Stick: 
One hundred ants are dropped on a meter stick. Each ant is traveling either to the left or the right with constant speed 1 meter per minute. When two ants meet, they bounce off each other and reverse direction. When an ant reaches an end of the stick, it falls off.

At some point all the ants will have fallen off. The time at which this happens will depend on the initial configuration of the ants. Over all the initial configurations, what is the longest time you have to wait for all the ants to fall off?


Hint (highlight to see): The answer is the same if there are only 10 ants.

Solution:
When two ants bump off each other it is equivalent to them crossing over. Therefore, the longest amount of time you have to wait for all the ants to fall off is the time it takes for one ant to travel the distance of the stick, 1 minute. If an ant is placed at each end, facing away from the edge, regardless of where the 98 other ants are placed, it will take exactly 1 minute for all the ants to fall off. 


___________________________________________________________________________________