Does there exist an explicit formula for the coefficient of $x^k$ in the square of a polynomials? So let's say we have a polynomial $P(x)$ of degree $n$, and we have: $$P(x)=\sum_{k=0}^{n}a_k x^k$$
I know that if you square $P(x)$, you get:
$$P(x)^2=\sum_{k=0}^n \sum_{l=0}^na_ka_lx^{k+l}$$
However I am wondering if there exists an explicit formula for just the coefficient of $x^k$ in terms of $k$ and the sequence $a_0,\dots,a_n$ for some given $k$. Does anyone know?
 A: If you set $a_k = 0$ for $k < 0$ and $k > n$, you can write the polynomial as
$$ P(x) = \sum_k a_k x^k $$
where $k$ ranges over all integers. This allows the simple argument
$$ P(x)^2 = \sum_{k,l} a_k a_l  x^{k+l} = \sum_{k,j} a_k a_{j-k} x^j
= \sum_j \left( \sum_k a_k a_{j-k} \right) x^j$$
where I've substituted $l \mapsto j-k$ so that I could make $x^j$ appear in the sum.
Some technical detail:


*

*this substitution makes sense as used, because $j$ also ranges over all the integers and it's invertible (I can substitute $j \mapsto l + k$)

*one way to justify swapping between iterated sums and double sums and swapping the order of summation is because only finitely many of the terms are nonzero, and you're allowed to rearrange a finite sum however you like

A: $$
[x^k]P(x)^2=\sum_{i+j=k}a_i a_j.
$$
A: Hint. A polynomial is a "finite" series, then by the Cauchy product, you get $$c_k=\sum\limits_{j=0}^{k} a_ja_{k-j}$$ for the coefficient of $x^k$ in $P^2(x)$. 
A: 
Let $S(x) = \left[P\right]^2(x)$ be a polynomial of degree  $(2m)$ in $x$. Then, in terms of the Heaviside-step function $u$, the coefficient of the $l^\text{th}$ term of $S(x)$, $s_l$, is
$$s_l = \left[\sum_{n=0}^{m-\left|l-m\right|}    a_{ (l- n - (l-m )\,u(l - m))  }\,a_{   [ ( n + (l - m )\,u(l - m))] }  \right].
$$

For some $m = 0,1,2,\ldots$, let
$$P(x)= \sum_{k=0}^m a_k\,x^k. $$
Further, let
\begin{align*}
S(x) 
&= 
\left[\sum_{k=0}^m a_k\,x^k\right]^2
\end{align*}
Then, expanding terms, we have
\begin{align*}
S(x) 
&= 
\left[a_0 \, a_0\right]x^{0} 
&& (l=0)
\\
&+ 
\left[a_1 \, a_0 + a_0 \, a_1\right]x^{1} 
&& (l=1)
\\
&\qquad\qquad\qquad \vdots 
\\
&+ 
\left[
a_{m-1} \, a_{0} + a_{m-2} \, a_{1}+ \cdots  
+ a_{1} \, a_{m-2} +   a_0\,a_{m-1}   \right]x^{m-1} 
&& (l=m-1)
\\
&+ 
\left[
a_{m } \, a_{0} + a_{m-1} \, a_{1}+ \cdots  
+ a_{1} \, a_{m-1} +   a_0\,a_{m }   \right]x^{m } 
&& (l=m )
\\
&+ 
\left[
a_{m } \, a_{1} + a_{m-1} \, a_{2}+ \cdots  
+ a_{2} \, a_{m-1} +   a_1\,a_{m }   \right]x^{m+1 } 
&& (l=m+1 )
\\
&\qquad\qquad\qquad \vdots 
\\
&+ 
\left[a_{m-1} \, a_m + a_{m} \, a_{m-1}\right]x^{2\,m-1}  
&& (l=2m-1)
\\
&+ 
\left[a_m \, a_m\right]x^{2\,m}  
&& (l=2m)
\end{align*}
Ultimately, there is structure here. The number of summands in the coefficient of each term is given by a translated and reflected absolute value function of $\ell$. Further, the  subscript in the first coefficient is found with the use of a Heaviside step function $u$. After some toil, it can be shown that
\begin{equation}
\left[S\right]^2(x) 
= 
\sum_{l=0}^{2m}x^l\,\sum_{n=0}^{m-\left|l-m\right|}    a_{ (l- n - (l-m )\,u(l - m))  }\,a_{   [ ( n + (l - m )\,u(l - m))] }   
.
\end{equation}
