Monochromatic-triangle counting formula
= Monochromatic-triangle counting formula
In a red-blue <edge colouring> of $K_n$, let $d_v$ be the red degree of vertex $v$ and let $M$ be the number of <monochromatic> triangles. Every nonmonochromatic triangle has exactly two vertices at which its two incident edges have different colors, so
$$
M=\binom n3-\frac12\sum_v d_v(n-1-d_v).
$$
Since $d_v(n-1-d_v)\leq\lfloor(n-1)^2/4\rfloor$, this identity gives a lower bound for $M$.