II. (25 points) Let the quadratic function
$$
y=x^{2}+p x+q
$$

pass through the point $(2,-1)$, and intersect the $x$-axis at two distinct points $A\left(x_{1}, 0\right), B\left(x_{2}, 0\right)$. Let $M$ be the vertex of the quadratic function. Find the analytical expression of the quadratic function that minimizes the area of $\triangle A M B$.
II. Since $-1=2^{2}+2 p+q$, we have
$$
2 p+q=-5 \text {. }
$$

Given that $x_{1}$ and $x_{2}$ are the roots of $x^{2}+p x+q=0$, we get
$$
x_{1}+x_{2}=-p, x_{1} x_{2}=q \text {. }
$$

Then $|A B|=\left|x_{1}-x_{2}\right|$
$$
\begin{array}{l}
=\sqrt{\left(x_{1}+x_{2}\right)^{2}-4 x_{1} x_{2}} \\
=\sqrt{p^{2}-4 q} .
\end{array}
$$

Also, $M\left(-\frac{p}{2}, \frac{4 q-p^{2}}{4}\right)$, so
$$
\begin{array}{l}
S_{\triangle \triangle M B}=\frac{1}{2}|A B|\left|\frac{4 q-p^{2}}{4}\right| \\
=\frac{1}{8}\left(p^{2}-4 q\right)^{\frac{3}{2}} .
\end{array}
$$

To minimize $S_{\triangle \triangle M B}$, we only need to minimize $p^{2}-4 q$.
$$
\begin{array}{l}
\text { and } p^{2}-4 q=p^{2}+8 p+20 \\
=(p+4)^{2}+4,
\end{array}
$$

Thus, when $p=-4$, $p^{2}-4 q$ reaches its minimum value of 4, at which point,
$$
q=3 \text {. }
$$

Therefore, the quadratic function we are looking for is
$$
y=x^{2}-4 x+3 \text {. }
$$