Example 40 Real numbers $a, b, c$ and a positive number $\lambda$, such that $f(x)=x^{3}+a x^{2}+b x+c$ has three real roots $x_{1}, x_{2}, x_{3}$, and satisfies (1) $x_{2}-x_{1}=\lambda$, (2) $x_{3}>\frac{1}{2}\left(x_{1}+x_{2}\right)$, find the maximum value of $\frac{2 a^{3}+27 c-9 a b}{\lambda^{3}}$.
Solution 1: We first transform $f(x)$ into a form without the $x^{2}$ term, as is typically done for cubic functions. For this, we make the substitution $x=y-\frac{a}{3}$, yielding
$$
\begin{aligned}
F(y) \xlongequal{\text { let }} f\left(y-\frac{a}{3}\right) & =\left(y-\frac{a}{3}\right)^{3}+a\left(y-\frac{a}{3}\right)^{2}+b\left(y-\frac{a}{3}\right)+c \\
& =y^{3}-\left(\frac{a^{2}}{3}-b\right) y+\frac{1}{27}\left(2 a^{3}+27 c-9 a b\right) .
\end{aligned}
$$

The polynomial $F(y)$ in $y$ also has three real roots $y_{1}, y_{2}, y_{3}$, where $y_{i}=x_{i}+\frac{a}{3}(i=1,2,3)$, and by Vieta's formulas, we have $y_{1}+y_{2}+y_{3}=0, y_{1} y_{2} y_{3}=-\frac{1}{27}\left(2 a^{3}+27 c-9 a b\right)$.
From the given conditions (1), (2), we know
$$
\begin{array}{l}
y_{2}-y_{1}=\left(x_{2}+\frac{1}{3}\right)-\left(x_{1}+\frac{1}{3}\right)=x_{2}-x_{1}=\lambda>0, \\
y_{3}=x_{3}+\frac{a}{3}>\frac{1}{2}\left(x_{1}+x_{2}\right)+\frac{a}{3}=\frac{1}{2}\left[\left(x_{1}+\frac{a}{3}\right)+\left(x_{2}+\frac{a}{3}\right)\right]=\frac{1}{2}\left(y_{1}+y_{2}\right) \\
\quad=-\frac{y_{3}}{2} .
\end{array}
$$

It is clear that $y_{3}>0$, and from $\left\{\begin{array}{l}y_{1}+y_{2}+y_{3}=0, \\ y_{2}-y_{1}=\lambda,\end{array}\right.$
we get $\left\{\begin{array}{l}y_{1}=-\frac{1}{2}\left(y_{3}+\lambda\right), \\ y_{2}=-\frac{1}{2}\left(y_{3}-\lambda\right) .\end{array}\right.$
Thus, we have $\frac{2 a^{3}+27 c-9 a b}{\lambda^{3}}=-\frac{27 \cdot y_{1} y_{2} y_{3}}{\lambda^{3}}=-\frac{27}{4}\left(\frac{y^{3}}{\lambda}+1\right)\left(\frac{y^{3}}{\lambda}-1\right) \frac{y_{3}}{\lambda}$.
Let $z=\frac{y_{3}}{\lambda}$, then by $y_{3}>0, \lambda>0$, we know $z>0$, and the problem reduces to finding the minimum value of the cubic function
$$
g(z)=(z+1)(z-1) z=z^{3}-z(z>0)
$$

By $g^{\prime}(z)=3 z^{2}-1=0(z>0)$, we get $z=\frac{1}{\sqrt{3}}$. Moreover, when $0<z<\frac{1}{\sqrt{3}}$, $g(z)$ is strictly decreasing, and when $z>\frac{1}{\sqrt{3}}$, $g(z)$ is strictly increasing. Therefore, $g(z)$ attains its minimum value at $z=\frac{1}{\sqrt{3}}$, which is $g\left(\frac{1}{\sqrt{3}}\right)=\left(\frac{1}{\sqrt{3}}\right)^{3}-\frac{1}{\sqrt{3}}=-\frac{2 \sqrt{3}}{9}$. Thus, the maximum value of $\frac{2 a^{3}+27 c-9 a b}{\lambda^{3}}$ is $\left(-\frac{27}{4}\right)\left(-\frac{2 \sqrt{3}}{9}\right)=\frac{3 \sqrt{3}}{2}$.
Solution 2: By Vieta's formulas, we have
$a=-\left(x_{1}+x_{2}+x_{3}\right), b=x_{1} x_{2}+x_{1} x_{3}+x_{2} x_{3}, c=-x_{1} x_{2} x_{3}$.

Let $\alpha=x_{3}-x_{1}$, then $a=-\left(\alpha+\lambda+3 x_{1}\right), b=x_{1}\left(\alpha+\lambda+2 x_{1}\right)+\left(\alpha+x_{1}\right)\left(\lambda+x_{1}\right), c=$ $-x_{1} \cdot\left(\alpha+x_{1}\right)\left(\lambda+x_{1}\right)$. Let $S=\frac{2 a^{3}+27 c-9 a b}{\lambda^{3}}$, then
$$
\begin{aligned}
\lambda^{3} S & =-2\left(\alpha+\lambda+3 x_{1}\right)^{3}-27 x_{1}\left(\alpha+x_{1}\right)\left(\lambda+x_{1}\right)+9\left(\alpha+\lambda+3 x_{1}\right)\left[x_{1}(\alpha+\right. \\
& \left.\left.\lambda+2 x_{1}\right)+\left(\alpha+x_{1}\right)\left(x+x_{1}\right)\right] \\
& =-2\left[(\alpha+\lambda)^{3}+9(\alpha+\lambda)^{2} x_{1}+27(\alpha+\lambda) x_{1}^{2}+27 x_{1}^{3}\right]-27\left[\alpha \lambda x_{1}+(\alpha+\lambda) x_{1}^{2}+\right. \\
& \left.x_{1}^{3}\right] \quad+9\left[\alpha \lambda(\alpha+\lambda)+3 \alpha \lambda x_{1}+2(\alpha+\lambda)^{2} x_{1}+9(\alpha+\lambda) x_{1}^{2}+9 x_{1}^{3}\right] \\
& =-2(\alpha+\lambda)^{3}+9 \alpha \lambda(\alpha+\lambda)=-(\alpha+\lambda)\left[2(\alpha+\lambda)^{2}-9 \alpha \lambda\right] \\
& =-(\alpha+\lambda)(2 \alpha-\lambda)(\alpha-2 \lambda), \\
S & =-\left(\frac{\alpha}{\lambda}+1\right)\left(2 \frac{\alpha}{\lambda}-1\right)\left(\frac{\alpha}{\lambda}-2\right) .
\end{aligned}
$$

Let $z=\frac{\alpha}{\lambda}$, since $\lambda>0, \alpha=x_{3}-x_{1}>\frac{x_{1}+x_{2}}{2}-x_{1}=\frac{x_{2}-x_{1}}{2}=\frac{\lambda}{2}>0$, the problem reduces to finding the maximum value of the function
$S=-f(z)=-(z+1)(2 z-1)(z-2)=-2 z^{3}+3 z^{2}+3 z-2(z>0)$.
By $f^{\prime}(z)=-6 z^{2}+6 z+3=-6\left(z^{2}+z-\frac{1}{2}\right)=0(z>0)$, we get $z=\frac{1+\sqrt{3}}{2}$, and when $0<z<\frac{1+\sqrt{3}}{2}$, $f^{\prime}(z)>0$, and when $z>\frac{1+\sqrt{3}}{2}$, $f^{\prime}(z)<0$. Therefore, $f(z)$ attains its maximum value at $z=\frac{1+\sqrt{3}}{2}$, which is $f\left(\frac{1+\sqrt{3}}{2}\right)=-2\left(\frac{1+\sqrt{3}}{2}\right)^{3}+3\left(\frac{1+\sqrt{3}}{2}\right)^{2}+3\left(\frac{1+\sqrt{3}}{2}\right)-2=\frac{3 \sqrt{3}}{2}$.

Since $\lambda>0, \alpha=x_{3}-x_{1}>\frac{x_{1}+x_{2}}{2}-x_{1}=\frac{x_{2}-x_{1}}{2}=\frac{\lambda}{2}>0$, we have $z=\frac{\alpha}{\lambda}>\frac{1}{2}$. If $z \leqslant 2$, then $S \leqslant 0$ and cannot attain the maximum value. When $z>2$,
$$
\begin{aligned}
S & =\sqrt{(z+1)^{2}(2-z)^{2}+(2 z-1)^{2}} \\
& =\sqrt{\left(2+z-z^{2}\right)\left(2+z-z^{2}\right)\left(4 z^{2}-4 z+1\right)} \\
& =\frac{1}{2} \sqrt{\left(4+2 z-2 z^{2}\right)\left(4+2 z-2 z^{2}\right)\left(4 z^{2}-4 z+1\right)} \\
& \leqslant \frac{1}{2} \sqrt{\frac{\left(4+2 z-2 z^{2}\right)+\left(4+2 z-2 z^{2}\right)+\left(4 z^{2}-4 z+1\right)}{3}} . \\
& =\frac{3 \sqrt{3}}{2} .
\end{aligned}
$$

Equality holds if and only if $4+2 z-2 z^{2}=4 z^{2}-4 z+1(z>2)$, i.e., $z=\frac{1+\sqrt{3}}{2}$. Therefore, $S$ attains its maximum value $\frac{3 \sqrt{3}}{2}$ at $z=\frac{1+\sqrt{3}}{2}$.