## Solution.

We have the following cases:

1) $x+y \geqslant 0, x-y \geqslant 0$, that is, $y \geqslant-x, y \leqslant x$. Then we have

$$
x+y+x-y=2 \quad \Rightarrow \quad x=1, y \geqslant-1, y \leqslant 1 \quad \Rightarrow \quad x=1,|y| \leqslant 1
$$

In this case, the maximum value of the expression $x^{2}-6 x+y^{2}$ is the maximum value of the expression $y^{2}-5$ for $|y| \leqslant 1$, that is, on the interval $[-1,1]$. Since the quadratic function has a minimum at its vertex, the maximum can only be achieved at the endpoints of the interval $[-1,1]$. The maximum value for $y=1$ or -1 is -4.
2) $x+y \geqslant 0, x-y \leqslant 0$, that is, $x \geqslant-y, x \leqslant y$. Then we have

$$
x+y-x+y=2 \quad \Rightarrow \quad y=1,|x| \leqslant 1
$$

In this case, the maximum value of the expression $x^{2}-6 x+y^{2}$ is the maximum value of the expression $x^{2}-6 x+1$ on the interval $[-1,1]$. The maximum is achieved for $x=-1$ and is 8.
3) $x+y \leqslant 0, x-y \geqslant 0$, that is, $x \leqslant-y, x \geqslant y$. Then we have

$$
-x-y+x-y=2 \quad \Rightarrow \quad y=-1,|x| \leqslant 1
$$

In this case, the maximum value of the expression $x^{2}-6 x+y^{2}$ is the maximum value of the expression $x^{2}-6 x+1$ on the interval $[-1,1]$, which is the same as in the previous case, 8.
4) $x+y \leqslant 0, x-y \leqslant 0$, that is, $y \leqslant-x, y \geqslant x$. Then we have

$$
-x-y-x+y=2 \quad \Rightarrow \quad x=-1,|y| \leqslant 1
$$

In this case, the maximum value of the expression $x^{2}-6 x+y^{2}$ is the maximum value of the expression $7+y^{2}$ on the interval $[-1,1]$. Since the quadratic function has a minimum at its vertex, the maximum can only be achieved at the endpoints of the interval $[-1,1]$, so we conclude that the maximum value is achieved for $y=1$ or -1 and is 8.

We conclude that the maximum value of the given expression is 8, and it is achieved for

$$
(x, y)=(-1,1) \quad \mathrm{and} \quad(-1,-1)
$$
## Task B-2.4.

For real numbers $x, y$ if the equality $|x+y|+|x-y|=2$ holds, determine the maximum value of the expression $x^{2}-6 x+y^{2}$.