In this article A new modeling and solution approach for the number partitioning problem1, it transforms the number partition problem into a QUBO form like equation (2.1) on page 2. $$\text{diff}=\sum_{j=1}^ms_j-2\sum_{j=1}^ms_jx_j=c-2\sum_{j=1}^ms_jx_j\tag{2.1}$$ My question is how to turn (2.1) into (2.2) and (2.3)?
\begin{align} \text{diff}^2&=\left\{c-2\sum_{j=1}^ms_jx_j\right\}^2 \\ &=c^2+4xQx\tag{2.2} \end{align}
where $$q_{ii}=s_i(s_i-c),\quad q_{ij}=s_is_j\tag{2.3}$$
Reference
[1] Alidaee, B., Glover, F., Kochenberger, G. A., Rego, C. (2005). A new modeling and solution approach for the number partitioning problem. Journal of Applied Mathematics and Decision Sciences. 2005(2):113–21.