파스칼 삼각형 공식과 예시

⚡ 스마트 요약

Pascal's Triangle is a triangular arrangement of numbers where each value equals the sum of the two numbers directly above it, revealing deep patterns in combinatorics, binomial expansions, and probability that have fascinated mathematicians for centuries.

  • 🔺 논리적 구조: 각 행은 1로 시작하고 1로 끝나며, 내부 값은 위의 두 숫자를 더하여 만들어집니다.
  • 📐 이항 연결: n번째 행의 k번째 열은 이항 계수 C(n, k)와 같으므로 삼각형은 조합을 시각적으로 찾아보는 데 사용됩니다.
  • 🔢 숨겨진 패턴: 행의 합은 2의 거듭제곱과 같고, 대각선의 합은 피보나치 수열을 이룬다.
  • ✅ 세 가지 방법: 이전 행을 이용하거나, 이항 계수를 계산하거나, 수정된 계수를 반복적으로 사용하는 단축 방법을 통해 이를 구축할 수 있습니다.
  • 🧪 어플리케이션 : 현대 교육과정 전반에 걸쳐 대수학, 확률론, 컴퓨터 과학 및 조합론적 증명에 사용됩니다.

파스칼의 삼각형은 무엇입니까?

Pascal's Triangle is a triangular array of numbers that follows a simple pattern based on the row above it. It was popularized by French mathematician Blaise Pascal in the 17th century. The triangle begins with a single "1" at the top, and every subsequent row starts and ends with "1" as well.

파스칼의 삼각형

Beyond its elegant shape, Pascal's Triangle encodes deep mathematical relationships. It is closely tied to the binomial theorem, combinatorial counting, and probability, which is why it appears in algebra, statistics, and computer science classrooms worldwide.

파스칼의 삼각형 역사

Although named after Blaise Pascal, the triangle predates him by centuries. The Chinese mathematical text "The Nine Chapters on the Mathematical Art" contains one of the earliest known examples, displaying many of the same patterns we use today.

페르시아 수학자 알 카라지와 인도 학자 Pingala also explored similar arrays. Pascal formalized the triangle's properties in his 1654 treatise "Traité du triangle arithmétique," which gave the structure its modern name in Western mathematics.

파스칼의 삼각형 만들기

Constructing Pascal's Triangle is straightforward. The only rule to remember is that each row starts and ends with 1, and every other number is built from the row above.

임의의 행 r과 열 c에 대해, 해당 값은 행 r-1의 c-1열과 c열에 있는 숫자의 합과 같습니다.

여기

  • r = 3, 4, 5, ...
  • n and c = 2, 3, 4, ..., r-1.

Here are the steps to build Pascal's Triangle:

단계 1) 첫 두 줄부터 채워주세요.

파스칼의 삼각형 만들기

단계 2) 세 번째 행의 두 번째 요소는 두 번째 행의 첫 번째 숫자와 두 번째 숫자의 합입니다.

파스칼의 삼각형 만들기

단계 3) The fourth row begins with "1". The second number is 3, which is the sum of 1 and 2 (highlighted in blue).

아래 이미지는 네 번째 줄을 채우는 방법을 보여줍니다.

파스칼의 삼각형 만들기

단계 4) 다섯 번째 행은 다섯 개의 숫자로 구성됩니다. 우리는 앞선 단계에서 행을 채우는 패턴을 이미 알고 있습니다.

파스칼의 삼각형 만들기

파스칼의 삼각형 공식 - 이항 계수

A binomial coefficient counts the number of ways to choose a subset of k elements from a collection of n elements. It is commonly written as "C(n, k)" or "n choose k."

이항계수는 다음과 같이 정의됩니다.

파스칼의 삼각형 공식 - 이항 계수

The "!" symbol denotes the factorial of a number.

n! = n.(n-1).(n-2)...3.2.1

예를 들어,

5! = 5.4.3.2.1

= 120

So, C(5, 3) or "5 choose 3" = 5! / 3!(5-3)!

= 120/12

= 10

방법 1: 이전 행을 이용하여 파스칼 삼각형 만들기

The procedure here mirrors how we drew the triangle manually. Suppose we want to generate Pascal's triangle up to seven rows.

그 방법은 다음과 같습니다.

단계 1) Start the topmost row with "1".

단계 2) For row "r", element "c" will be the sum of column "c-1" and column "c" of row "r-1".

단계 3) The first and last numbers in every row will always be "1".

이 세 가지 간단한 단계를 따르면 삼각형 전체를 체계적으로 구성할 수 있습니다.

C++ Code 이전 행의 파스칼 삼각형

#include <bits/stdc++.h>
using namespace std;
void printRow(int n)
{
  int numbers[n][n];
  for (int row = 0; row < n; row++)
  {
    for (int col = 0; col <= row; col++)
    {
      if (col == 0 || col == row)
      {
        numbers[row][col] = 1;
      }
      else
      {
        numbers[row][col] = numbers[row - 1][col - 1] + numbers[row - 1][col];
      }
      cout << numbers[row][col] << "\t";
    }
    cout << endl;
  }
}
int main()
{
  int n;
  cout << "How many rows: ";
  cin >> n;
  printRow(n);
}

출력:

How many rows: 7
1
1       1
1       2       1
1       3       3       1
1       4       6       4       1
1       5       10      10      5       1
1       6       15      20      15      6       1

Python Code 이전 행의 파스칼 삼각형 공식

def printRow(n):
    numbers = [[0 for row in range(n)]
               for col in range(n)
               ]
    for row in range(len(numbers)):
        for col in range(0, row+1):
            if row == col or col == 0:
                numbers[row][col] = 1
            else:
                numbers[row][col] = numbers[row-1][col-1]+numbers[row-1][col]

            print(numbers[row][col],end="\t")
        print("\n")
n = int(input("How many rows: "))
printRow(n)

Pascal's Triangle Example Output:

How many rows: 7
1
1       1
1       2       1
1       3       3       1
1       4       6       4       1
1       5       10      10      5       1
1       6       15      20      15      6       1

복잡성 분석

A XNUMX차원 배열 is used in this implementation. Given that N is the number of rows in Pascal's triangle, this requires N2 단위 공간입니다. 따라서 공간 복잡도는 O(N)입니다.2).

The function uses two nested loops, each running up to "N" times. So, the time complexity is also 의 위에2)또는 시간 복잡도의 제곱입니다.

방법 2: 이항계수 계산을 통한 파스칼 삼각형 구성

We can derive the numbers of Pascal's triangle directly using binomial coefficients. The diagram below illustrates the relationship:

이항계수 계산을 통한 파스칼 삼각형 만들기

Here are the steps to build Pascal's Triangle by calculating the binomial coefficient:

단계 1) 최상위 행은 C(0, 0)입니다. 위의 공식을 사용하면 0! = 1이므로 C(0, 0) = 1입니다.

단계 2) For row "i", there will be a total of "i" elements. Each item is calculated as C(n, r), where n is i-1.

단계 3) Repeat step 2 for as many rows of Pascal's triangle as you want to generate.

C++ Code 이항계수를 이용한 파스칼 삼각형

#include <iostream>
using namespace std;
int factorial(int n)
{
    int result = 1;
    for (int i = 1; i <= n; i++)
    {
        result *= i;
    }
    return result;
}
int binomialCoefficient(int n, int r)
{
    int result = 1;
    if (r > n)
    {
        return -1;
    }
    result = factorial(n) / (factorial(r) * factorial(n - r));
    return result;
}
void printPascalTriangle(int row)
{
    for (int i = 0; i <= row; i++)
    {
        for (int j = 0; j <= i; j++)
        {
            cout << binomialCoefficient(i, j) << "\t";
        }
        cout << endl;
    }
}
int main()
{
    int n;
    cout << "Enter row number: ";
    cin >> n;
    printPascalTriangle(n);
}

출력:

Enter row number: 9
1
1	1
1	2	1
1	3	3	1
1	4	6	4	1
1	5	10	10	5	1
1	6	15	20	15	6	1
1	7	21	35	35	21	7	1
1	8	28	56	70	56	28	8	1
1	9	36	84	126	126	84	36	9	1

Python Code 이항계수를 이용한 파스칼 삼각형

def factorial(n):
    result = 1
    for i in range(1,n+1):
        result*=i
    return result
def binomialCoefficient(n,r):
    result =1
    if r>n:
        return None
    result = factorial(n) / (factorial(r) * factorial(n - r))
    return int(result)
def printPascalTriangle(row):
    for i in range(row+1):
        for j in range(i+1):
            print(binomialCoefficient(i, j), end="\t")
        print()
# print(binomialCoefficient(3, 2))
n = int(input("Enter row number: "))
printPascalTriangle(n)

Pascal's Triangle Example Output:

Enter row number: 8
1
1       1
1       2       1
1       3       3       1
1       4       6       4       1
1       5       10      10      5       1
1       6       15      20      15      6       1
1       7       21      35      35      21      7       1
1       8       28      56      70      56      28      8       1

복잡성 분석

Three loops are used in this implementation: one to compute the binomial coefficient and two more to iterate through every row and column. With respect to the number of rows, all three loops run up to "n" times. Consequently, the overall time complexity is O(n3).

중간 결과를 저장하지 않으므로 공간 복잡도는 상수입니다. 프로그램은 각 요소를 즉시 계산하여 행 내에 출력하므로 공간 복잡도는 다음과 같이 줄어듭니다. O (1).

방법 3: 수정된 이항 계수로 파스칼의 삼각형 만들기

이전 기법에서는 이항계수 공식을 사용하여 각 요소를 계산했습니다. 수정된 접근 방식은 C(n, r)을 C(n, r-1)에서 직접 도출하여 계산량을 한 자릿수만큼 줄입니다.

Here are the steps to build Pascal's Triangle by the modified binomial coefficient:

단계 1) Initiate the first row with "1".

단계 2) Calculate C(n, r), where "n" is the row number and "r" is the column index. Assign that value to a variable C.

단계 3) For computing the next coefficient, use C * (n - k) / k. Assign this new value back to C.

단계 4) Continue step 3 until "k" reaches the end of the row. After each iteration, increment k by one.

C++ Code 수정된 이항계수를 이용한 파스칼 삼각형의 경우

#include <bits/stdc++.h>
using namespace std;
void printpascalTriangle(int n)
{
  for (int row = 1; row <= n; row++)
  {
    int previous_coef = 1;
    for (int col = 1; col <= row; col++)
    {
      cout << previous_coef << "\t";
      previous_coef = previous_coef * (row - col) / col;
    }
    cout << endl;
  }
}

int main()
{
  int n;
  cout << "How many rows: ";
  cin >> n;
  printpascalTriangle(n);
}

출력:

How many rows: 5
1
1       1
1       2       1
1       3       3       1
1       4       6       4       1

Python Code 수정된 이항계수를 이용한 파스칼 삼각형의 경우

def printpascalTriangle(n):
    for row in range(1, n+1):
        previous_coef = 1
        for col in range(1, row+1):
            print(previous_coef, end="\t")
            previous_coef = int(previous_coef*(row-col)/col)
        print()
n = int(input("How many rows: "))
printpascalTriangle(n)

Pascal's Triangle Patterns Output:

How many rows: 5
1
1       1
1       2       1
1       3       3       1
1       4       6       4       1

복잡성 분석

The implementation uses two loops, each running a maximum of "n" times, where "n" is the number of rows in the triangle. So, the time complexity is 의 위에2), 시간의 제곱.

공간 복잡도 측면에서 보면, 저장을 위한 배열은 필요하지 않습니다. 이전 이항 계수를 저장하는 데 하나의 변수만 사용하므로 추가 공간은 하나만 필요합니다. 따라서 공간 복잡도는 다음과 같습니다. O (1).

파스칼의 삼각형 응용

Here are some practical applications of Pascal's Triangle:

이항 확장: The coefficients of any binomial expansion can be read directly from Pascal's triangle. Here is an example:

(x + y)0 1
(x + y)1 1.x + 1.y
(x + y)2 1x2 + 2XY + 1y2
(x + y)3 1x3 + 3x2그리고 + 3xy2 + 1y3
(x + y)4 1x4 + 4x3그리고 + 6x2y2 + 4xy3 + 1y4

조합 계산: The elements of Pascal's triangle correspond directly to binomial coefficients. For example, if you have 6 balls and want to choose 3, the answer is 6C3. You can find that value in the 3rd element of the 6th row of Pascal's triangle.

개연성: Pascal's Triangle is widely used to compute probabilities in coin tosses, dice problems, and other combinatorial events where each outcome corresponds to a binomial distribution.

파스칼의 삼각형에 관한 흥미로운 사실

Here are some facts you will find interesting about Pascal's triangle:

  • 어떤 행에 있는 모든 요소의 합은 항상 2의 거듭제곱입니다.

파스칼 삼각형에 관한 사실들

  • 각 행의 대각선 합이 피보나치 수열을 이룹니다.

파스칼 삼각형에 관한 사실들

  • 각 행은 (a+b)의 전개식에서 계수에 해당합니다.n.
  • 홀수 부분만 색칠하면 시에르핀스키 삼각형 프랙탈이 만들어집니다.

자주 묻는 질문

1654년에 이를 공식화한 블레즈 파스칼의 이름을 따서 명명되었지만, 이 삼각형은 그보다 수 세기 전에 중국, 인도, 페르시아에서 알려져 있었습니다. 가현, 양회와 같은 수학자들은 Ping알라와 알-카라지는 파스칼보다 훨씬 이전에 유사한 배열을 연구했습니다.

파스칼 삼각형의 각 항목은 이항식 계수 C(n, k)에 해당합니다. n번째 행의 숫자는 (a + b)의 n제곱의 계수를 나타내므로, 이 삼각형은 이항식 전개를 빠르게 찾아볼 수 있는 표 역할을 합니다.

파스칼 삼각형의 n번째 행에 있는 모든 수의 합은 2의 n제곱입니다. 예를 들어, 4번째 행에는 1, 4, 6, 4, 1이 있는데, 이 수들의 합은 16으로, 정확히 2의 4제곱입니다.

파스칼 삼각형의 얕은 대각선을 따라 숫자를 더하면 그 합은 피보나치 수열(1, 1, 2, 3, 5, 8, 13 등)이 됩니다. 이것은 삼각형에 숨겨진 가장 우아한 패턴 중 하나입니다.

파스칼 삼각형은 동전 던지기처럼 두 가지 결과가 나올 확률이 같은 사건의 확률을 나타냅니다. n번째 행은 n번 던졌을 때 k번 앞면이 나오는 경우의 수를 보여주며, 이는 이항 확률 분포에 직접적으로 사용됩니다.

인공지능 시스템은 특징 선택, 샘플링 및 조합 최적화를 위해 파스칼 삼각형에서 도출된 이항 계수를 사용합니다. 강화 학습 에이전트와 기호 수학 솔버 또한 다항식 전개 및 이산 선택 문제를 추론할 때 파스칼 삼각형을 참조합니다.

네. AI 기반 수학 튜터는 행별 시각화, 적응형 연습 문제, 이항 계수 연습에 대한 즉각적인 피드백을 제공합니다. 학습자가 자신의 속도에 맞춰 삼각형과 조합, 확률, 이항 정리를 연결할 수 있도록 도와줍니다.

이 게시물을 요약하면 다음과 같습니다.