
Problem 1. Find the values of the real parameter $a$, for which the function

$$
f(x)=x^{2}-2 x-|x-1-a|-|x-2|+4
$$

has nonnegative values for all real $x$.


Solution. Firstly let $1+a \leq 2$, i.e. $a \leq 1$. Then

$$
f(x)= \begin{cases}x^{2}+1-a, & x \leq 1+a \\ x^{2}-2 x+3+a, & 1+a \leq x \leq 2 \\ x^{2}-4 x+7+a, & x \geq 2\end{cases}
$$

If $1+a \geq 2$, i.e. $a \geq 1$, we find that

$$
f(x)= \begin{cases}x^{2}+1-a, & x \leq 2 \\ x^{2}-2 x+5-a, & 2 \leq x \leq 1+a \\ x^{2}-4 x+7+a, & x \geq 1+a\end{cases}
$$

Hence the smallest value of $f(x)$ is reached in one of the points $0,1,2,1+a$.

We have $f(0)=2-|a+1|, f(1)=2-|a|, f(2)=4-|1-a|, f(1+a)=a^{2}-|a-1|+3$. These four numbers must be nonnegative. We find that $a \in[-2,1]$. Then $|a-1|=1-a$ and $f(1+a)=a^{2}+a+2>0$ for all $a$.

Let now $a \notin[-2,1]$. If $a1$, then $x^{2}+1-a<0$ when $x=0$.

Finally, $a \in[-2,1]$.
