Source: TSTST-2023-P4
Category: Graph Theory

Problem:
Let $n \ge 3$ be an integer and let $K_n$ be the complete graph on $n$ vertices. Each edge of $K_n$ is colored either red, green, or blue. Let $A$ denote the number of triangles in $K_n$ with all edges of the same color, and let $B$ denote the number of triangles in $K_n$ with all edges of different colors. Prove that 
\[
B \le 2A + \frac{n(n-1)}3.
\]

Solution:
Consider all unordered pairs of different edges which share exactly one vertex (call these *vees* for convenience). Assign each vee a *charge* of $+2$ if its two edges have the same color, and a charge of $-1$ if its two edges have different colors.

We compute the total charge of all vees in the graph $K_n$ in two ways.

**Total charge by summing over triangles.**  
Note that each monochromatic triangle contains three vees with edges of the same color, so it has a charge of $3 \times (+2) = +6$. Each bichromatic triangle contains one vee with edges of the same color and two vees with edges of different colors, so it has a charge of $1 \times (+2) + 2 \times (-1) = 0$. Each trichromatic triangle contains three vees with edges of different colors, so it has a charge of $3 \times (-1) = -3$. Since each vee is contained in exactly one triangle, we obtain that the total charge over all vees is $6A - 3B$.

**Total charge by summing over vertices.**  
We can also calculate the total charge by examining the centers of the vees. If a vertex has $a$ red edges, $b$ green edges, and $c$ blue edges incident to it, the vees centered at that vertex contribute a total charge of 
\[
\begin{aligned}
& \phantom{=}\;\; 2\left[ \binom a2 + \binom b2 + \binom c2\right] - (ab + ac + bc)\\
& = (a^2 - a + b^2 - b + c^2 - c) - (ab + ac + bc)\\
& = (a^2 + b^2 + c^2 - ab - ac - bc) - (a + b + c).
\end{aligned}
\] 
Since the total number of edges incident to any vertex in $K_n$ is $a + b + c = n - 1$, this expression simplifies to
\[
(a^2 + b^2 + c^2 - ab - ac - bc) - (n-1).
\]
Because $a^2 + b^2 + c^2 - ab - ac - bc = \frac{1}{2}\left((a-b)^2 + (b-c)^2 + (c-a)^2\right) \ge 0$, the total charge contributed by the vees centered at this vertex is at least $-(n-1)$.

Summing this minimum contribution over all $n$ vertices of $K_n$, we find that the total charge is at least $-n(n-1)$.

**Conclusion.**  
Comparing the two methods of computing the total charge, we obtain 
\[
6A - 3B \ge -n(n-1).
\] 
Rearranging this inequality yields
\[
3B \le 6A + n(n-1) \iff B \le 2A + \frac{n(n-1)}3,
\] 
which is the desired result.


Grading guidelines:
(Partial) 1. Introduced the double-counting on unordered pairs of adjacent edges (“vees”), assigning weights (e.g. +2 for same color and −1 for different colors), and correctly computed the contribution of a monochromatic triangle as +6 and a trichromatic triangle as −3 (bichromatic triangles contributing 0). 2. Correctly computed the total charge at a vertex with incident color-degrees (a,b,c) as 2[ C(a,2)+C(b,2)+C(c,2) ] − (ab+ac+bc), and simplified it to (a^2+b^2+c^2−ab−ac−bc) − (n−1). 3. Proved the key inequality a^2+b^2+c^2−ab−ac−bc = 1/2((a−b)^2+(b−c)^2+(c−a)^2) ≥ 0, hence each vertex contributes at least −(n−1) to the charge sum. (Almost) 1. Carried out the vee-charge double count to obtain 6A−3B as the total charge, and derived the lower bound ≥ −n(n−1), but made a minor arithmetic slip when rearranging to the final form B ≤ 2A + n(n−1)/3. 2. Proved the triangle contributions correctly and bounded the vertex-sum correctly, but left a small gap in justifying the correspondence between vees and their counting in triangles (e.g. did not clearly argue that each vee is counted exactly once via its third vertex). 3. Solution is almost complete, but made minor mistakes which are not negligible.