How do you write an equation for the terms in an answer for a squared polynomial with x terms?

For example #(a+b)^2 = a^2+2ab+b^2# the polynomial has two terms, the squared answer has 3 terms

along with the pattern #(a+b+c)^2=a^2+b^2+c^2+2ab+2ac+2cb# the polynomial has three terms and the squared answer has 6.
and the pattern keeps going. How do I write an equation to show if x terms in polynomial then y terms in answer?

so #(a+b+c+d.......)^2= x#number of terms

1 Answer
Oct 20, 2017

#1/2(n^2+n)#

Explanation:

#(overbrace(a_1+a_2+...+a_n)^"n terms")^2 = overbrace(a_1^2+a_2^2+...+a_n^2)^"n terms"+overbrace(2a_1a_2+2a_1a_3+...+2a_(n-1)a_n)^(""^nC_2 = 1/2(n^2-n) "terms")#

The total number of terms on the right hand side is:

#n+1/2(n^2-n) = 1/2(n^2+n)#

Essentially the number of terms on the right hand side is #n^2# counting multiplicity - that is, if you count each of the terms of the form #2a_ja_k# twice. Since we don't want to do that, we have to subtract #1/2(n^2-n)# from #n^2# to get #1/2(n^2+n)#.