Given a simple connected graph $G$ with $n$ vertices and $m$ edges, let $d_1, ..., d_n$ denote the degrees of the vertices of the graph. In [this very short paper][1], the author prove the inequality

$$\sum_{i\in G} d_i^2 \leq m\left(\frac{2m}{n-1}+n-2\right)$$

The main thrust is when the author introduce and prove the following magical inequality for any set of reals $\{x_{ij}\}$:

$$\frac{n-1}{2}\sum_{i}\left(\sum_{j\neq i}x_{ij} \right)^2 \leq \left(\sum_{ij}x_{ij} \right)^2  +{n-1 \choose 2} \sum_{ij}x_{ij}^2$$

By simply letting $x_{ij}=1$ if $\{i,j\}$ is an edge in $G$ and $0$ otherwise (i.e indicator for edges), the above inequality rearranges to the first desired inequality. 

Now, if I am given inequality $2$, I can *easily* 1) prove it and 2) conclude the inequality 1. However, I am left for words on *how* the author could've came up with inequality $2$ in the first place. Can someone shed a light on some intuition on where it might have originated from. 


  [1]: https://reader.elsevier.com/reader/sd/pii/S0012365X97002136