# How to use stars and bars to count how many terms there are in a polynomial expansion?

Mathematics Asked by grompchompz on December 19, 2020

So here’s what I understand from this.

The number of terms in the expansion (before combining like terms) of any polynomial is given by $${k^{n}}$$ where $${k}$$ is the number of variables and $${n}$$ is the degree of the polynomial. For example, $${(x + y + z)^4}$$ is given by $${3^{4}=81}$$.

To find the number of terms after combining, I can use the binomial theorem. This gives me $${n + 1}$$ terms for an $${n}$$th-degree binomial. For example, $${(x+y)^{12}}$$ has 13 terms.

But the thing is, this doesn’t work with trinomials and higher. My teacher instructed me to use the stars and bars method to find terms for such problems. I understand how to plug values in but don’t quite understand how it works.

For example, the number of terms in the trinomial $${(x+y+z)^{7}}$$ is given by $${n + k – 1 choose k – 1 }={9 choose 2} = {36}$$. How exactly does this work? It seems relatively simple if you use the whole "distribute $${n}$$ pieces of candies among $${k}$$ number of children" type of problems, but I don’t quite get it for this specific case.

When you expand $$(a+b+c+....)^n$$, the sum of the exponents in every term must be $$n$$, and every possible term whose exponents have a sum of $$n$$ will be present. For example, in$$(x+y+z)^7$$, some possible terms are $$x^2y^3z^2, xy^4z^2, x^7, y^2z^5$$, plus every other term whose exponents add to $$7$$. Thus you are "distributing" the exponent $$n$$ among the $$k$$ terms in the bracket, which is why the calculation is the same as for distributing $$n$$ candies among $$k$$ children.

Correct answer by A.J. on December 19, 2020

When you expand $$(x_1+x_2+...+x_k)^n$$ and combine the terms, the sum will look like this: $$sum_{0leqlambda_1,lambda_2,...,lambda_kleq n, lambda_1+lambda_2+...+lambda_k=n}x_1^{lambda_1}x_2^{lambda_2}...x_k^{lambda_k}cdot c_i$$ where $$c_i$$s are random constants.

So the number of terms after you expand and combine is the number of ordered triplets $$(lambda_1,lambda_2,...,lambda_k)$$ with the property that $$0leqlambda_1,lambda_2,...,lambda_kleq n$$ and $$lambda_1+lambda_2+...+lambda_k=n$$ which gives you stars and bars. (you distribute $$n$$ candies to $$k$$ children)

## Related Questions

### Is a convex set of permutation matrices $ntimes n$ ($mathbb{P}_{n}cap mathbb{C}$) a singleton?

0  Asked on November 14, 2021 by joey-cho

### Let $0leq a leq b leq 1$. Then we have for all natural numbers $mgeq 2$ the inequality $b^{frac m2}-a^{frac m2} leqfrac m2(b-a)$

3  Asked on November 14, 2021 by giuliano-cantina

### Let $x=begin{bmatrix}3cr4end{bmatrix}$ and $A=begin{bmatrix}0&x^Tcr x&0end{bmatrix}$ is A diagonizable?

1  Asked on November 14, 2021

### Is a directed graph different from a flow graph?

1  Asked on November 14, 2021

### The diophantine equation $m = x^2 + 7y^2$

2  Asked on November 14, 2021 by peter-petrov

### Is there any visual representation on why (certain) trigonometric functions have infinite derivatives.

2  Asked on November 14, 2021 by teabx

### Is $(I circ A – I circ B)$ positive semi-definite if $A$, $B$ and $A – B$ are positive semi-definite?

1  Asked on November 14, 2021

### $f^{*}$ is surjective if and only if $f$ is injective

2  Asked on November 14, 2021 by air-mike

### Rational singularity of Spec, Proj and Spec of localization of a standard graded $2$-dimensional ring

0  Asked on November 14, 2021

### Determine the lie algebra of the subgroup of SO(4)

3  Asked on November 14, 2021 by shreedhar-bhat

### How to use general recursion to generate a set of words?

2  Asked on November 14, 2021 by pwelb

### Calculate Hessian of a “weird” function

2  Asked on November 12, 2021 by ben-schneider

### Find volume under given contraints on the Cartesian plane.

2  Asked on November 12, 2021 by pavel-fedotov

### Equivalence of Classical Nullstellensatz to “Affine schemes have points”

1  Asked on November 12, 2021

### A donut shop sells 12 types of donuts. A manager wants to buy six donuts, one for himself and 5 for his employees.

1  Asked on November 12, 2021 by daniel-sidorkin

### A compact normal operator is diagonalisable.

1  Asked on November 12, 2021 by user745578

### If complex matrices $A$, $B$, $AB-BA$ are nilpotent, show that $A+B$ is nilpotent.

0  Asked on November 12, 2021 by rex-wang

### Integral with an index

1  Asked on November 12, 2021

### How do I find the probability distribution of a dependent variable given the probability distributions of its independent variables?

0  Asked on November 12, 2021 by tempuserperson

### Show that $sup_{k geq 1 }inf_{n geq k} a_n = inf_{k geq 1} sup_{n geq k} a_n$ for an alternating sequence

1  Asked on November 12, 2021 by fratsourced

Get help from others!