Given a positive ineteger n. The task is to find the sum of product of consecutive binomial coefficient i.e
nC0*nC1 + nC1*nC2 + ….. + nCn-1*nCn
Input : n = 3 Output : 15 3C0*3C1 + 3C1*3C2 +3C2*3C3 = 1*3 + 3*3 + 3*1 = 3 + 9 + 3 = 15 Input : n = 4 Output : 56
Method 1: The idea is to find all the binomial coefficients up to nth term and find the sum of the product of consecutive coefficients.
Below is the implementation of this approach:
(1 + x)n = nC0 + nC1*x + nC2*x2 + …. + nCn*xn … (1)
(1 + 1/x)n = nC0 + nC1/x + nC2/x2 + …. + nCn/xn … (2)
Multiplying (1) and (2), we get
(1 + x)2n/xn = (nC0 + nC1*x + nC2*x2 + …. + nCn*xn) * (nC0 + nC1/x + nC2/x2 + …. + nCn/xn)
(2nC0 + 2nC1*x + 2nC2*x2 + …. + 2nCn*xn)/xn = (nC0 + nC1*x + nC2*x2 + …. + nCn*xn) * (nC0 + nC1/x + nC2/x2 + …. + nCn/xn)
Now, find the coefficient of x in LHS,
Observe rth term of expansion in numerator is 2nCrxr.
To find the coefficient of x in (1 + x)2n/xn, r should be n + 1, because power of x in denominator will reduce it.
So, coefficient of x in LHS = 2nCn + 1 or 2nCn – 1
Now, find the coefficient of x in RHS,
r th term of first expansion of multiplication is nCr * xr
t th term of second expansion of multiplication is nCt / xt
So term after multiply will be nCr * xr * nCt / xt or
nCr * nCt * xr / xt
Put r = t + 1, we get,
nCt+1 * nCt * x
Observe there will be n such term in the expansion of multiply, so t range from 0 to n – 1.
Therefor, coefficient of x in RHS = nC0*nC1 + nC1*nC2 + ….. + nCn-1*nCn
Comparing coefficient of x in LHS and RHS, we can say,
nC0*nC1 + nC1*nC2 + ….. + nCn-1*nCn = 2nCn – 1
Below is implementation of this approach:
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Sum of Binomial coefficients
- Mathematics | PnC and Binomial Coefficients
- Sum of squares of binomial coefficients
- Find sum of even index binomial coefficients
- Program for Binomial Coefficients table
- Sum of product of r and rth Binomial Coefficient (r * nCr)
- Rearrange an array such that product of every two consecutive elements is a multiple of 4
- Maximize product of digit sum of consecutive pairs in a subsequence of length K
- Binomial Coefficient | DP-9
- Corollaries of Binomial Theorem
- Binomial Random Variables
- Central binomial coefficient
- Maximum binomial coefficient term value
- Middle term in the binomial expansion series
- Space and time efficient Binomial Coefficient
- Program to print binomial expansion series
- Maximum Product Subarray | Added negative product case
- Program for dot product and cross product of two vectors
- Eggs dropping puzzle (Binomial Coefficient and Binary Search Solution)
- Print numbers such that no two consecutive numbers are co-prime and every three consecutive numbers are co-prime
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.