(2) Let $x, y \in \mathbf{R}$, find the minimum value of the function $z=\sqrt{x^{2}+y^{2}-2 x-2 y+2}$ $+\sqrt{x^{2}+y^{2}-4 y+4}$. Also, specify the real values that $x, y$ should take at this time.
(Answer: When $x, y$ satisfy $y=2-x(1 \leqslant x \leqslant 2)$, $z$ has the minimum value $\sqrt{2}$)