## Pascal's Triangle Coefficient Calculator

This program will calculate the coefficients of Pascal's Triangle up to any row "r" specified by the user. The formula used is from the Binomial Theorem where the coefficients of each term of the expansion of the binomial (x + y)n are given by nCr read "a (C)ombination of "n" things taken "r" at a time". The formula for nCr is n!/(n-r)!r! where "!" is the factorial symbol. Note that since "r' is indexed at zero, that is, the first row means r = 0, that means n, the exponent of the binomial expansion, will be n, but there will be n + 1 terms and therefore n +1 coefficients of Pascal's Triangle.

Factorial n written n! means (n)(n-1)(n-2)...(1)

By definition 0! = 1.

For example, row 3 of Pascals Triangle means n=3 (third row of Pascals Triangle starting at 0) and r = 3; n is fixed but r will run from 0 to n, i,e, 0, 1, 2, and 3 in this example, so the coefficients of Pascal's Triangle are:

• 3Cr = 3!/(3-r)!r!
• 3C0 = 3!/(3-0)!0! = 6/6*1 = 1
• 3C1 = 3!/(3-1)!1! = 6/2*1 = 3
• 3C2 = 3!/(3-2)!2! = 6/1*2 = 3
• 3C3 = 3!/(3-3)!3! = 6/1*6 = 1

This program is written in JavaScript.

By Mr. C. January, 2020

*********************results********************************