Example 2. The graph of the function $\mathrm{y}=\mathrm{f}(\mathrm{x})$ passes through points $\mathrm{A}(-1$, $-5)$ and $B(-2,3)$, and when $x=1$, $y$ has an extremum, which is 3. Find the expression for $\mathrm{f}(\mathrm{x})$.
Solve $\because \mathrm{x}=1$ when, $\mathrm{y}$ has an extremum, the extremum is 3, so we can set $y=f(x)=a(x-1)^{2}(x-m)+3$. $\because y=f(x)$'s graph passes through A $(-1,-5)$, B $(-2,3)$,
$$
\therefore\left\{\begin{array}{l}
4 a(-1-m)+3=-5, \\
9 a(-2-m)+3=3 .
\end{array}\right.
$$

From (1) and (2), we get $a=-2, m=-2$. Therefore,
$$
\begin{aligned}
f(x) & =-2(x-1)^{2}(x+2)+3 \\
& =-2 x^{3}+6 x-1 .
\end{aligned}
$$