Four, for what real number $x$ does $y=x^{2}-x+1+$ $\sqrt{2(x+3)^{2}+2\left(x^{2}-5\right)^{2}}$ have a minimum value? What is the minimum value?
As shown in Figure 5, let \( P\left(x, x^{2}\right) \) be a point on the parabola \( y=x^{2} \). The distance from \( P \) to the line \( y=x-1 \) is
\[
\begin{aligned}
|P Q| & =\frac{\left|x^{2}-x+1\right|}{\sqrt{(-1)^{2}+1^{2}}} \\
& =\frac{\sqrt{2}}{2} \left| x^{2}-x+1 \right| \\
& =\frac{\sqrt{2}}{2}\left(x^{2}-x+1\right).
\end{aligned}
\]
The distance from \( P \) to \( M(-3,5) \) is
\[
|P M|=\sqrt{(x+3)^{2}+\left(x^{2}-5\right)^{2}}.
\]

When \( |P Q|+|P M| \) is minimized, points \( M, P, Q \) are collinear,

and this line is the line through \( M \) and perpendicular to the line \( y=x-1 \), which is \( y=-x+2 \).
The minimum value of \( |P Q|+|P M| \) is the distance from point \( M \) to the line \( y=x-1 \): \(\frac{|-3-5-1|}{\sqrt{1^{2}+(-1)^{2}}}=\frac{9}{2} \sqrt{2}\).
Since
\[
\begin{aligned}
y & =x^{2}-x+1+\sqrt{2(x+3)^{2}+2\left(x^{2}-5\right)^{2}} \\
& =\sqrt{2}\left[\frac{\sqrt{2}}{2}\left(x^{2}-x+1\right)+\right. \\
& \left.\sqrt{(x+3)^{2}+\left(x^{2}-5\right)^{2}}\right] \\
& = \sqrt{2}(|P Q|+|P M|).
\end{aligned}
\]

And since the minimum value of \( |P Q|+|P M| \) is \(\frac{9}{2} \sqrt{2}\),
the minimum value of \( y \) is 9.
Since the line \( y=-x+2 \) intersects the parabola \( y=x^{2} \) at points \( P_{1}(-2,4) \) and \( P_{2}(1,1) \),
when \( x=-2 \) or 1, \( y \) has a minimum value of 9.