A sort-of explanation…

In the fall of 2005 I took a course in discrete mathematics. Some of the most fun, and the hardest math course I ever took, as well as being the first math course in at least 15 years. The whole Pascal’s Triangle thing was one of the things I was interested in when I signed up for the course: the cool math stuff.

I’ve used things like prime numbers an Fibonncci series in my art work for some time. That sort of mathematics always seemed to have a certain beauty (and mystery) to me. Pascal’s Triangle is the same.

What I’ve done here is a bit of goof. I started manually generating the Triangle, and got up to about row 15 when I figured it was time to stop doing the addition manually, even with a calculator, and do some scripting. This is the results.

Factorials

Dirt-simple explanation: a factorial, written like 4!, is calculated by (in this case) 1 × 2 × 3 × 4.

To get to the r-combinations, which you need for computing the numbers (coefficients) for the Triangle, you need to be able to calculate factorials. There is no built-in function for doing factorials (I don’t have the GMP library installed), and it was really no great feat to write the script. Put in a number here, and it will cumpute the factorial of that number.

r-combinations

Combinations are the number of pairs you can generate from a set of numbers. I defer (or at least link you to) Mathworld for more information. You use combinations to figure how many outcomes you get when order doesn’t matter. The formula for C(n r) is n!/r!(n-r)!.

For r-combination:

Pascal’s Triangle

Finally, the meat of it. Here’s the Mathworld entry. The numbers generated represent binomial coefficients (which is a cool term even if you don’t know what they are).

The two different entries are (respectively) for generating a particular row of the triangle, or for generating the triangle up to and including a particular row. To display properly, you need a pretty wide display, once you get over 15 rows or or so.