**Understanding the Binomial Coefficient:**

Imagine you have a group of 5 friends (let's name them A, B, C, D, and E), and you want to select 3 of them to form a team for a game. The binomial coefficient $\left(\genfrac{}{}{0px}{}{5}{3}\right)$ tells you how many different teams of 3 you can form from the 5 friends.

Breaking Down the Formula:

The formula for the binomial coefficient is $\left(\genfrac{}{}{0px}{}{\ufffd}{\ufffd}\right)=\frac{\ufffd!}{\ufffd!(\ufffd-\ufffd)!}$. Let's break it down using our example where $\ufffd=5$ and $\ufffd=3$:

1. Factorials: The "!" symbol stands for factorial. For any positive integer $\ufffd$, $\ufffd!$ (x factorial) is the product of all positive integers up to $\ufffd$. For example, $5!=5\times 4\times 3\times 2\times 1=120$.

2. Applying the Formula: To find $\left(\genfrac{}{}{0px}{}{5}{3}\right)$, we plug our numbers into the formula:

$\left(\genfrac{}{}{0px}{}{5}{3}\right)=\frac{5!}{3!(5-3)!}=\frac{5!}{3!2!}$

Calculating each factorial:

- $5!=120$
- $3!=6$
- $2!=2$

So, $\left(\genfrac{}{}{0px}{}{5}{3}\right)=\frac{120}{6\times 2}=\frac{120}{12}=10$.

This means there are 10 different ways to choose 3 friends out of 5.

**Why Does the Formula Work?**1. Starting with Permutations: Initially, if we were to line up 3 of your friends out of 5, not just choose them, we'd have to consider the permutations (different arrangements). For the first friend, you have 5 choices, for the second, you have 4 (since one friend is already chosen), and for the third, 3 choices left. So, for permutations, you multiply these:

$5\times 4\times 3=60$.

2. Adjusting for Order Not Mattering: The 60 permutations include different orders of the same 3 friends (like ABC, ACB, BAC...). But in our case, the order doesn't matter; ABC is the same team as BAC. Each group of 3 friends can be arranged in $3!=6$ ways (3 options for the first position, 2 for the second, and 1 for the last), so we've counted each group 6 times in our 60 permutations.

3. Getting to Combinations: To correct for this and count each unique group once, we divide the number of permutations by the number of ways to arrange 3 friends:

$\frac{60}{6}=10$. This matches our calculation using the binomial coefficient formula, showing that there are 10 unique ways to choose 3 friends out of 5.

Conclusion:

The binomial coefficient formula $\left(\genfrac{}{}{0px}{}{\ufffd}{\ufffd}\right)$ gives us a way to calculate the number of unique groups (combinations) of $\ufffd$ items we can choose from a larger set of $\ufffd$ items, without caring about the order of selection. It corrects for the overcounting of arrangements (permutations) by dividing by the factorial of the group size $\ufffd!$, ensuring each unique group is only counted once.

Now lets gets into the most interesting part. The pascals triangle and creating it with Binomial Coefficients.

First lets start with writing a small program to print pascals matrix to the nth row.

Idea behind this program is pretty simple List<List> basically represents Column<Rows> or a matrix.

Each rows first and last value will be one that we hard code. Then iterate over numRows and construct each rows. One small thing to notice here is the inner for loop it has to run from 1 to < less than rowNum. Basically it runs 1, 2, 3 times from the 2nd row. So basically rowNum-1 times it runs, basically skipping for first two rows.

Lets move forward to to understand the relation between binomial coefficient and the pascals triangle. If you look closely you can find something really interesting. Below is the representation of of pascals triangle

If you did not catch this yet see the below which will unlock the hidden pattern of the relation between binomial coefficient and pascals triangle

with this we now understood the relation between pascals triangle and binomial coefficient. Great now for a very dumb person like me can easily understand what Striver is saying in his video. Now the below program makes a lot of sense. Check the below program which will show you how to calculate the value in a particular position of the pascals triangle.

If you reached this far of the blog then great you are upto something special in your life. Stay tuned for the next blog

## No comments:

## Post a Comment