Pascal's Triangle

Pascal's Triangle is used to find the coefficients of the expansion of (a+b)n, where n is positive.

For example :

(a+b)0=1
(a+b)0 = 1
(a+b)1 = 1a + 1b
(a+b)2 = (a + b)(a + b )
= 1a2 + 2ab + 1b2
(a+b)3 = (a + b)(a + b)2
= (a + b)(a2 + 2ab + b2)
= a3 + a2b + 2a2b + 2ab2 + ab2 + b3
= 1a3 + 3a2b + 3ab2 + 1b3
(a+b)4 = (a + b)(a + b)3
= (a + b)(a3 + 3a2b + 3ab2 + b3)
= a4 + a3b + 3a3b + 3a2b2 + 3a2b2 + 3ab3 + ab3 + b4
= 1a4 + 4a3b + 6a2b2 + 4ab3 + 1b4

Writing the coefficients of each expansion in a triangular form :

1
1    1
1   2   1
1   3   3   1
1   4   6   4   1

It can be noticed that there is a pattern to form the coefficients :

1
1 + 1
1   2   1
1 + 3 +  3   1
1   4   6   4   1

For example the expansion of (a+b)5 is :

1a5 + 5a4b + 10a3b2 + 10a2b3 + 5ab4 + 1b5