Show that the sum of the numbers of ordered $3$-cliques and $3$-anticliques is not less than $\binom{V}{3}+\frac{2E^2}{V}-E(V-1)$. 
Show that the sum of the number of ordered $3$-cliques and the number $3$-anticliques in a graph is not less than $$\binom{V}{3}+\frac{2E^2}{V}-E(V-1)\,.$$

I have a trouble with this task, because I don't know where to start. Can you give me a hint(what theorem will help me or what should I count(cliques or anticliques) at first) Thank you so much for help!
 A: Let $G(V,E)$ be a (simple) graph on the set $V$ of $n$ vertices with the edge set $E$ consisting of $m$ edges.   Let $s$ and $t$ denote, respectively, the number of $3$-cliques and the number of $3$-anticliques of $G$.  
A leg is a vertex together with two (distinct) neighboring vertices, namely, a pair $\big(u,\{v,w\}\big)$ with $u,v,w\in V$ and $v\neq w$ such that $\{u,v\}$ and $\{u,w\}$ are edges of $G$.  An anti-leg is a vertex together with two (distinct) non-neighboring vertices, namely, a pair $\big(u,\{v,w\}\big)$ with $u,v,w\in V$ and $v\neq w$ such that neither $\{u,v\}$ nor $\{u,w\}$ is an edge of $G$. Write $L$ and $A$ for the set of legs and the set of anti-legs in $G$, respectively.
If $d_v$ denote the degree of $v\in V$, then show that
$$|L|=\sum_{v\in V}\,\binom{d_v}{2}\geq n\,\binom{\frac{1}{n}\,\sum_{v\in V}\,d_v}{2}=n\,\binom{\frac{2m}{n}}{2}=m\left(\frac{2m-n}{n}\right)\,.$$
There are $\displaystyle \binom{n}{3}-s$ triples of vertices in $G$ that do not form $3$-cliques.  Each of such triples is responsible for at most one leg, whilst a $3$-clique creates three legs.  That is,
$$|L|\leq 1\cdot\Biggl(\binom{n}{3}-s\Biggr)+3\cdot s=\binom{n}{3}+2s\,.$$
Consequently,
$$s\geq \frac{m}{2}\,\left(\frac{2m-n}{n}\right)-\frac{1}{2}\,\binom{n}{3}=\frac{m^2}{n}-\frac{m}{2}-\frac{1}{2}\,\binom{n}{3}\,.\tag{*}$$
Similarly, we have
$$|A|=\sum_{v\in V}\,\binom{(n-1)-d_v}{2}\geq n\,\binom{(n-1)-\frac{1}{n}\,\sum_{v\in V}\,d_v}{2}\,,$$
or
$$|A|\geq n\,\binom{n-1-\frac{2m}{n}}{2}=3\,\binom{n}{3}+\frac{2m^2}{n}-2mn+3m\,.$$
We also have
$$|A|\leq 1\cdot\Biggl(\binom{n}{3}-t\Biggr)+3\cdot t=\binom{n}{3}+2t\,.$$
Therefore,
$$t\geq \frac{3}{2}\,\binom{n}{3}+\frac{m^2}{n}-mn+\frac{3}{2}m\,.\tag{#}$$
Combining (*) and (#), we get
$$s+t\geq \binom{n}{3}+\frac{2m^2}{n}-mn+m=\binom{n}{3}+\frac{2m^2}{n}-m(n-1)\,.$$
In particular, for $n=6$, we have
$$s+t\geq 20+\frac{m^2}{3}-5m=\frac{1}{3}\,\left(m-\frac{15}{2}\right)^2+\frac{5}{4}\geq \frac{5}{4}\,.$$
Therefore, in any simple graph on $6$ vertices, there are two $3$-cliques, or two $3$-anticliques, or one $3$-clique and one $3$-anticlique.  This result implies a special case of Ramsey's Theorem.
