Pascal's Triangle

In this article, you will get brief description about Pascal's triangle. Here, the simplest description of Pascal's triangle is given. I'm not going in detail about it. Because, this article is only created to give an idea about it for every programmer over here, so that they can easily create a program on it.

How Pascal's Triangle Expanded

Here is the algorithm to create a Pascal's triangle. These steps can be used to create it in any of your favourite languages such as C, C++, Java, or Python etc.

  • There is only one column at first row with value 1
  • The value of first and last column for every row is 1
  • In second row, there are two columns. So the addition of both the columns gets placed as the value of second column of next (third) row
  • In third row, there are three columns. So the addition of first and second column gets placed as the value of second column of next (fourth) row. Again the addition of second and third column gets placed as the value of third column of next (fourth) row
  • In fourth row, there are four columns. So the addition of first and second column gets placed as the value of second column of next (fifth) row. Again the addition of second and third column gets placed as the value of third column of next (fifth) row. Again the addition of third and fourth column gets placed as the value of fourth column of next (fifth) row
  • and so on, if there are more number of rows

Structure of Pascal's Triangle

Pascal's triangle is like equilateral triangle. In it, there is/are:

  • Only 1 column at first row
  • 2 columns at second row
  • 3 columns at third row
  • and so on

Where every next row is created in a way that

  • The second column's value, is the summation of first and second column of previous row
  • The third column's value, is the summation of second and third column of previous row
  • The fourth column's value, is the summation of third and fourth column of previous row
  • and so on

Now let's see the pictorial representation of Pascal's triangle.

Pascal's Triangle Formula

Here is a simple formula to find the column value of every row of a Pascal's triangle.

value = (row!)/((column!)*(row-columns)!)

The ! indicates factorial. row and column both starts from 0. That is, to find the value of 2nd column of 4th row. Therefore on putting the value of row and column, we will get:

value = (row!)/((column!)*(row-columns)!)
      = (4!)/((2!)*(4-2)!)
      = (24)/(2*(2!))
      = 24/(2*2)
      = 24/4
      = 6

So 6 is the number present at fourth row and second column. Factorial of a number n is calculated as:

n! = n*(n-1)(n-2)*(n-3)*....*1

So the factorial of 4 is:

4! = 4*3*2*1
   = 24

Pictorial Representation of Pascal's Triangle

Here is the step by step pictorial representation of a Pascal's triangle that is of 5 rows. Here is the first one:

pascal triangle 1

This is the second one

pascal triangle 2

Below is the third one:

pascal triangle 3

And here is the final one:

pascal triangle final

To learn more about it, you can google it. But the required knowledge about Pascal's triangle is given. Now you can go for the programming purpose to create it using any of your desired programming languages.

Programs Made on This


« Previous Tutorial Next Tutorial »

Like/Share Us on Facebook 😋