# Math

You are currently browsing the archive for the Math category.

## “Old and New Matrix Algebra Useful for Statistics”

Sometimes I can’t remember the formulas for matrix calculus.  Fortunately there are some good references on the web.  One of my favorites is “Old and New Matrix Algebra Useful for Statistics” (Minka 2000 1, 2).

## Proofs without Words

On mathoverflow, they have this wonderful question “Can you give examples of proofs without words?”.  The answers are beautiful. They visually “prove”

$$1 + 2 + 3 + \cdots + n = n (n + 1) / 2 = \left({ \begin{matrix} n \\ 2 \end{matrix}}\right),$$

$$32.5 = 31.5,$$

$$1^2 + 2^2 + 3^2 + \cdots + n^2 = n(n + 1)(n + 1/2)/3,$$

$$F^2_0 + F^2_1 + \cdots + F^2_n = F_n F_{n+1},$$

with $F_0 = 1$ for Fibonacci numbers $F_n$, and more than 15 other facts visually.

## Rolling Dice Mod 3

It is fairly obvious if you think about it and if you are a mathematician, but I was surprised by this theorem.

Theorem:  Roll any number of dice all of which can have any (finite) number of sides except at least one die which is the standard six sided die.  The probability that the sum is divisible by three is exactly 1/3.  Also, the probability that the sum is odd is exactly 1/2.

Corollary:  Roll any number of six sided dice. The probability that the sum is divisible by 3 is 1/3.  The probability that the sum is even is exactly 1/2.

## Venn Diagrams

Carl sent me a link to a Venn Diagrams post, so that got me thinking. A Venn Diagram with $n$ atoms has to represent $2^n$ regions. For example if $n$ is $2$, then you have the standard Venn Diagram below.

Each time you increase $n$ by one, you double the number of regions.  This makes me think of binary codes and orthogonal functions. Everybody’s favorite orthogonal functions are the trig functions, so you should be able to draw Venn diagrams with wavy trig functions. Here was my first try.

Those seemed kind of busy, so I dampened the amplitude on the high frequencies (making the slopes that same and possibly increasing artistic appeal.)

I really like the last one.

## Andrew’s Commentary on Even Denominator Fractions

My Friend Andrew wrote:

Initially, I thought it was dependent on your definition of “random rational number”, but then I saw your second example that removed duplicates (1/2, 2/4, etc..).

I tried a different method by sampling from a real distribution and then rationalizing it:

Mean@Mod[Denominator@Rationalize[#, 1*^-6] & /@ RandomReal[{0, 1}, 100000], 2]


Then, I tried changing the distribution, and still get the same result:

Mean@Mod[Denominator@Rationalize[#, 1*^-6] & /@ RandomReal[NormalDistribution[0, 1], 100000], 2]


— Andrew

## 1/3 of all fractions have an even denominator!

What percentage of “random fractions” have an even denominator? My friend Pig told me that the answer is around 1/3. (At least the answer is 1/3 for two somewhat natural definitions of the term “random fraction”.) Here is the experimental “proof” in Mathematica.

Mathematica input for test #1:

percentage[v_List, pred_] := N[ Length[Select[v, pred]] / Length[v] ];

percentage[ Table[ RandomInteger[{1, 1000}] / RandomInteger[{1, 1000}],
{100000} ], EvenQ[Denominator[#]] ]


Output for test #1:

0.33343

Mathematica input for test #2:

percentage[ Table[i/j, {i, 1000}, {j, 1000}] // Flatten // Union,
EvenQ[Denominator[#]] ]


Output for test #2 :

0.333443