Number of terms in product of two monomials with common terms I am trying to find the number of terms in the expression
$$(x+y+z)^{20}(w+x+y+z)^2$$.
I understand that the number of terms in $(x+y+z)^{20} = \binom{22}{2}$ and the number of terms in $(w+x+y+z)^2 = \binom{5}{3}$. If the variables were distinct, then you would simply multiply the terms together. However, in this case it seems that the number of terms would be lower as there may be terms that overlap when you multiply them out.
I am very confused on how to find the number of overlapping terms and any help would be appreciated
 A: Each term in the product $(x+y+z)^{20}(w+x+y+z)^2$ is of degree $22$.
A typical term looks like $x^\alpha y^\beta z^\gamma w^\delta, 0\leq \alpha,\beta,\gamma\leq 22,0\leq \delta\leq 2, \alpha+\beta+\gamma+\delta=22 $.
So, the problem surmounts to finding the number of non-negative integer solutions of solving $$\alpha+\beta+\gamma+\delta=22 \hspace{5mm}\text{with} \hspace{5mm} 0\leq\delta\leq 2 $$
For $\delta=0,1,2$, the numbers of solutions of $\alpha+\beta+\gamma+\delta=22$ are respectively $\binom{24}{2}$,$\binom{23}{2}$ and $\binom{22}{2}$.
Consequently, the required number of solutions (or terms) is   $\binom{24}{2}+\binom{23}{2}+\binom{22}{2}=760$.
A: This is a variation continuing OPs approach. OP already observed the number of different terms in
\begin{align*}
(x+y+z)^{20}\quad\text{is}\quad\binom{22}{2}\text{.}
\end{align*}

Since
\begin{align*}
(x+y+z)^{20}&(w+\left(x+y+z\right))^2\\
&=(x+y+z)^{20}(w^2+2w\left(x+y+z\right)+\left(x+y+z\right))\\
&=w^2(x+y+z)^{20}+2w(x+y+z)^{21}+(x+y+z)^{22}
\end{align*}
we obtain
\begin{align*}
\binom{22}{2}+\binom{23}{2}+\binom{24}{2}=231+253+276=760
\end{align*}

