Example 4. The cubic function $\mathrm{f}(\mathrm{x})$ passes through points $\mathrm{A}(1,4), \mathrm{B}(3,8)$, and has an extremum of 0 at $x=2$, find $f(x)$.
Let $f(x)=a x^{3}+b x^{2}+c x+d$, then $f^{\prime}(x)=3 a x^{2}+2 b x+c$.
Since the function passes through $A(1,4)$ and $B(3,8)$, and $f(2)=0$, $f^{\prime}(2)=0$,
we can obtain the system of equations:
$$
\begin{array}{l}
\left\{\begin{array}{l}
a+b+c+d=4, \\
27 a+9 b+3 c+d=8, \\
12 a+4 b+c=0, \\
8 a+4 b+2 c-d=0, \text{ adding this equation, we get }
\end{array}\right. \\
a=2, b=-6, c=0, d=8. \\
\text{ Therefore, } f(x)=2 x^{3}-6 x^{2}+8. \\
\end{array}
$$