Example 3 On a plane, there is a convex $3 n$-sided polygon, with a robot on each of its vertices. Each robot emits a laser beam pointing to another robot. Define an operation as: select a robot, and rotate it clockwise until its laser points to a new robot. For three robots $A$, $B$, and $C$, when robot $A$'s laser points to robot $B$, robot $B$'s laser points to robot $C$, and robot $C$'s laser points to robot $A$, these three robots are said to form a "triangle". Question: What is the minimum number of operations required to ensure that there are $n$ triangles on the plane?
(2016, Taiwan Mathematical Olympiad Training Camp)
Solution: $\frac{9 n^{2}-7 n}{2}$.
First, for any two points $A$ and $B$, let the random variable $N_{A B}$ represent the number of times point $A$'s laser needs to be directed at point $B$. Assuming that points $A$ and $B$ are uniformly randomly selected from all points, then $N_{A B}$ is uniformly distributed over $\{0,1, \cdots, 3 n-2\}$.
Thus, $\mathrm{E}\left(N_{A B}\right)=\frac{3 n-2}{2}$.
For any three points $A$, $B$, and $C$, let the random variable $N_{A B C}$ represent the number of times the lasers need to be rotated to form $\triangle A B C$ (where the vertices $A$, $B$, and $C$ of $\triangle A B C$ are arranged clockwise).

Assuming that points $A$, $B$, and $C$ are uniformly randomly selected from all points, by the additivity of expectations, we have
$\mathrm{E}\left(N_{A B C}\right)=\mathrm{E}\left(N_{A B}\right)+\mathrm{E}\left(N_{B C}\right)+\mathrm{E}\left(N_{C A}\right)$
$=\frac{3(3 n-2)}{2}$.
Let the $3 n$ points be denoted as $A_{1}, A_{2}, \cdots, A_{3 n}$, and let $T\left(T_{1}, T_{2}, \cdots, T_{n}\right)$ represent a method of dividing all points into $n$ triangles, where $T_{i}=\left(A_{i_{1}}, A_{i_{2}}, A_{i_{3}}\right)$ is an ordered pair, and the vertices $A_{i_{1}}$, $A_{i_{2}}$, and $A_{i_{3}}$ of $\triangle A_{i_{1}} A_{i_{2}} A_{i_{3}}$ are arranged clockwise. Let $N_{T}$ represent the number of times required to transform the given figure into $T$.

Assuming that $T$ is uniformly selected from all possible divisions, then by additivity, we have
$$
\mathrm{E}\left(N_{T}\right)=\frac{3 n(3 n-2)}{2} \text {. }
$$

Let $S=\left\{S_{1}, S_{2}, \cdots, S_{n}\right\}$ represent a method of dividing all points into $n$ unordered sets, each containing three points. For each $T$, let $S(T)$ be the corresponding unordered set of $T$.

Since $\mathrm{E}\left(N_{T}\right)=\frac{3 n(3 n-2)}{2}$, there must exist an unordered set $S^{\prime}$ such that
$$
\mathrm{E}\left(N_{T} \mid S(T)=S^{\prime}\right) \leqslant \frac{3 n(3 n-2)}{2} .
$$

Notice that all $T$ satisfying $S(T)=S^{\prime}$ have the same grouping of three points, but the clockwise or counterclockwise direction of some triangles may differ.
First, we prove a lemma.
Lemma: For a triangle, regardless of the initial state, the number of steps to turn it into a clockwise or counterclockwise orientation is always different.

Proof: Assume that the number of steps to turn it into the two triangles shown in Figure 1 (a) and Figure 1 (b) is the same. Without loss of generality, assume that the laser from $B$ to $\overrightarrow{B C}$ requires $n_{1}$ fewer operations than to $\overrightarrow{B A}$, and the laser from $C$ to $\overrightarrow{C A}$ requires $n_{2}$ fewer operations than to $\overrightarrow{C B}$. That is, the arc $\overparen{A C}$ not containing point $B$ has $n_{1}-1$ vertices, and the arc $\overparen{A B}$ not containing point $C$ has $n_{2}-1$ vertices. However, for the laser from $A$ to $\overrightarrow{A B}$ to $\overrightarrow{A C}$, if more operations are needed, it must be $n_{1}+n_{2}+1$ times, i.e., traversing all vertices on the arc $\overparen{B C}$ not containing point $A$ except point $A$. Thus, the number of operations to turn it into Figure 1 (a) and Figure 1 (b) differs by one, which is a contradiction.
The lemma is proved.
Thus, $\left\{N_{T} \mid S(T)=S^{\prime}\right\}$ contains at least $n+1$ distinct values, and since each clockwise can be changed to counterclockwise, they are distributed in a dual form, with half being less than the average. Therefore, among all $T$ satisfying $S(T)=S^{\prime}$, there must exist a $T^{\prime}$ such that
$$
\begin{array}{l}
N_{T^{\prime}} \leqslant \mathrm{E}\left(N_{T} \mid S(T)=S^{\prime}\right)-\frac{n}{2} \\
\leqslant \frac{3 n(3 n-2)}{2}-\frac{n}{2}=\frac{9 n^{2}-7 n}{2} .
\end{array}
$$

This indicates that there exists a way to form $n$ triangles on the plane with $\frac{9 n^{2}-7 n}{2}$ operations.

Example: At least $\frac{9 n^{2}-7 n}{2}$ operations are required to form $n$ triangles on the plane.
Construct a regular $3 n$-gon with vertices $A_{1}, A_{2}, \cdots, A_{3 n}$

arranged clockwise. In the initial state, the laser from $A_{1}$ points to $A_{2}$, and the lasers from the other vertices all point to $A_{1}$. Simple calculations show that $\frac{3 n(3 n-1)}{2}-2 n+a$ operations are needed to form $n$ triangles on the plane, where $a$ is the number of triangles with vertices' lasers in a counterclockwise direction. When $a=0$, the minimum value $\frac{9 n^{2}-7 n}{2}$ is obtained.