Sorry for the kind of vague title, I my self am not really sure where to go with this.
This is a graph problem. $\mathcal{E}$ is a set of edges such that $(x,y)$ is an edge between nodes $x$ and $y$.
$w_{(x,y)}$ is the weight of edge $(x,y)$.
We have
$\phi(\mathbf{z}):=\sum_{(x,y)}w_{(x,y)}(z_x-z_y)^2$
for any $\mathbf{z}=\mathbb{R}^N$
$d_y=\sum_{x\ \text{such that}\ (x,y)\ \in\ \mathcal{E}}w_{(x,y)}$
$D=\text{diag}\{d_y\}$
Which I assume means the diagonal matrix containing vector $\mathbf{d}$ on its leading diagonal which has elements which are the sums of rows of $w(x,y)$. But I am not really sure.
$W_{x,y}=\begin{cases}w_{(x,y)},& \text{for } (x,y)\ \in \ \mathcal{E}\\ 0, & \text{otherwise}\end{cases}$
$M=D-W$
Show that:
$\frac{1}{2}\phi(\mathbf{z})=\mathbf{z}^TM\mathbf{z}$
If anyone has any advice it would be much appreciated.
Assuming $w_{(x,y)}=w_{(y,x)}$ (the graph is undirected), you can write $$ \begin{split} \phi(z) &= \sum_{(x,y)} w_{(x,y)} z_x^2 -2 \sum_{(x,y)} w_{(x,y)} z_x z_y + \sum_{(x,y)} w_{(x,y)} z_y^2 \\ &= 2\sum_{(x,y)} w_{(x,y)} z_x^2 -2 \sum_{(x,y)} w_{(x,y)} z_x z_y \\ &= 2\sum_{x} z_x^2 \sum_{y} w_{(x,y)} -2 \sum_{(x,y)} z_x w_{(x,y)} z_y \\ &= 2\sum_{x} z_x d_x z_x -2 \sum_{(x,y)} z_x w_{(x,y)} z_y \\ &= 2(z^T D z - z^T W z) = 2 z^T (D-W) z = 2 z^T M z. \end{split} $$