graph-theory problem about outdegree and indegree

(I prefer to use $\deg_o$ and $\deg_i$ for the out-degree and in-degree.)

HINT: Let the vertices be $v_1,\dots,v_n$; you want to prove that $$\sum_{k=1}^n\big(\deg_o(v_k)\big)^2=\sum_{k=1}^n\big(\deg_i(v_k)\big)^2\;,$$ or, equivalently, that $$\sum_{k=1}^n\left(\big(\deg_o(v_k)\big)^2-\big(\deg_i(v_k)\big)^2\right)=0\;.$$

Now $$\sum_{k=1}^n\left(\big(\deg_o(v_k)\big)^2-\big(\deg_i(v_k)\big)^2\right)=\sum_{k=1}^n\Big(\deg_o(v_k)-\deg_i(v_k)\Big)\Big(\deg_o(v_k)+\deg_i(v_k)\Big)\;,$$ and since the undirected graph is $K_n$, you know exactly what $\deg_o(v_k)+\deg_i(v_k)$ is. You should now be able to reduce the problem to evaluating the sum

$$\sum_{k=1}^n\Big(\deg_o(v_k)-\deg_i(v_k)\Big)=\sum_{k=1}^n\deg_o(v_k)-\sum_{k=1}^n\deg_i(v_k)\;,$$ which is very easy if you just think about what that last difference of sums really represents.