What will be the expansion of $(a_1+a_2+...a_n)^2$ I have learnt binomial expansion in case of two terms, but I wondered how will one expand such whole squares,  will we express it in terms of $(1+x)^2$, where $x$ can be $(a_1+a_2+...a_n) -1$
 A: The formula you're thinking of is the multinomial theorem. The Wikipedia page goes pretty in depth about it and how it works.

In addition to that, we can derive another expansion similar to that.$$\left(\sum\limits_{k=0}^{n}a_k\right)^2=\sum\limits_{k=0}^{n}a_k^2+2\sum\limits_{0\leq i < j\leq n}a_ia_j$$
I'll explain a bit what this means. The left-hand side is obviously the sum of the terms you want to expand, such as $a_0,a_1,a_2,$ etc. The right-hand side is the expansion.
The first sum is simple all the terms from the left-hand side squared. The second sum is interpreted as the sum of all of the products of the terms taken two at a time.
Some examples are$$\begin{align*}(a_0+a_1+a_2)^2 & =a_0^2+a_1^2+a_2^2+2a_0\left(a_1+a_2\right)+2a_1a_2\\ & =a_0^2+a_1^2+a_2^2+2a_0a_1+2a_0a_2+2a_1a_2\end{align*}$$$$\begin{align*}(a_0+a_1+a_2+a_3)^2 & =\sum\limits_{i=0}^{3}a_i^2+2a_0(a_1+a_2+a_3)+2a_1(a_2+a_3)+2a_2a_3\\ & =\sum\limits_{i=0}^3a_i^2+2a_0a_1+2a_0a_2+2a_0a_3+2a_1a_2+2a_1a_3+2a_2a_3\end{align*}$$
And so on...
