Is my general formula for polynomial multiplication right?

Using your notation, we know that the product $p(x)q(x)$ is a polynomial of degree $n+m$.

Hence one has $$p(x)q(x) = \sum_{k=0}^{n+m} c_k x^k,$$ with coefficients $c_k$ to be determined.

Let $k \in \{ 0, \cdots, n+m \}$. Now the question is: how do you obtain terms in $x^k$ in the multiplication? Here are the ways to get some $x^k$, and we'll just have to add them altogether.

  • multiply the constant term of $p$ by the term of degree $k$ of $q$ ;
  • multiply the term of degree $1$ of $p$ by the term of degree $k-1$ of $q$ ;
  • ...
  • multiply the term of degree $j$ of $p$ by the term of degree $k-j$ of $q$ ;
  • ...
  • multiply the term of degree $k$ of $p$ by the constant term of $q$.

Therefore, one has

$$c_k = \sum_{i=0}^k p_i q_{k-i}$$ where $p_i$ (resp. $q_i$) denotes the $i$-th coefficient of $p$ (resp. $q$).

That gives us the general formula you're looking for:

$$ \bbox[lightgreen,5px,border:2px solid green]{\left( \sum_{i=0}^{\deg p} p_i x^i\right) \cdot \left( \sum_{j=0}^{\deg q} q_j x^j\right) = \sum_{k=0}^{\deg p + \deg q} \sum_{l=0}^k p_l q_{k-l} x^k}.$$


It is close.

$p(x)q(x)=\sum_\limits{i=0}^{m+n}\sum_\limits{j=0}^i p_{j} q_{i-j} x^i$