DGS Studio

Pascal's Triangle

Pascal Triangle

Show rows 0 through n and highlight row n.

Row 6 of Pascal's triangle is 1 6 15 20 15 6 1. Its entries add up to 2^6 = 64. pascal(6) draws rows 0 through 6. The bottom row is the one written above.

Each inside entry is the sum of the two entries above it. The ends of every row are 1. That recurrence is why the triangle can be built without computing a large factorial.

Equation

pascal(6)

Where the coefficients come from

Pascal's triangle stores binomial coefficients. The entry in row n, position k, is the number of ways to choose k items from n, and the row sums to 2ⁿ. DGS builds each entry from the multiplicative recurrence, so the numbers stay exact integers.

The triangle picture stops at row 20 so the drawing stays readable, but the coefficients themselves are still computed up to row 100. An expression (a+b)ⁿ uses the same row as its coefficients. That is why the algebra example and the triangle example belong together.

Reading the input

Try a change

Generate Graph draws the triangle or the requested row in the graph pane. The coefficients are exact integers from the recurrence.

Edit and generate

Generate Graph opens the studio homepage and runs this field. Open in DGS Studio loads the same text and waits for you to generate it. The equation is sent once, as a query parameter.

Related examples