## Task A-1.2.

Determine the smallest value that the expression

$$
a^{2}+b^{2}+|a b-1|+|a b-4|
$$

can take for some real numbers $a$ and $b$.
## Solution.

Let $S:=a^{2}+b^{2}+|a b-1|+|a b-4|$. By considering the sign of the expressions $a b-1$ and $a b-4$, we distinguish three cases.

In the first case, let $a b \geqslant 4$. Then the expressions in both absolute value terms of the initial expression are non-negative, so the expression becomes

$$
S=a^{2}+b^{2}+a b-1+a b-4=(a-b)^{2}-5+4 a b
$$

The smallest value a square of a real number can achieve is 0 (which occurs when $a$ and $b$ are equal), and we necessarily have $a b \geqslant 4$. Therefore, the minimum value of the expression in this case is $0-5+4 \cdot 4=11$, and it is achieved when $a=b$ and $a b=4$, i.e., when $a=b=2$.

In the second case, we have $1 \leqslant a b \leqslant 4$. Then the initial expression similarly becomes

$$
S=a^{2}+b^{2}+a b-1-(a b-4)=a^{2}+b^{2}+3=(a-b)^{2}+3+2 a b \geqslant 0+3+2 \cdot 1=5
$$

The minimum is achieved when $a=b$ and $a b=1$, i.e., for $a=b=1$.

In the third case, we have $a b \leqslant 1$, and the initial expression becomes

$$
S=a^{2}+b^{2}-(a b-1)-(a b-4)=(a-b)^{2}+5 \geqslant 5
$$

The minimum is achieved for any two equal real numbers $a$ and $b$ whose product is less than or equal to 1.

Therefore, the smallest value that the expression $a^{2}+b^{2}+|a b-1|+|a b-4|$ can take is 5.