2. For the quadratic trinomial $p(x)=(a-1) x^{2}-(a-1) x+2022$, it is known that $-2022 \leq p(x) \leq 2022$ for $x \in[0 ; 1]$. Find the greatest possible value of $a$.
Answer: 16177.

Solution. Since $p(0)=p(1)=2022$, the graph of the quadratic trinomial is a parabola symmetric about the line $x=\frac{1}{2}$. From the conditions that $-2022 \leq$ $p(x) \leq 2022$ for $x \in[0 ; 1]$ and $p(0)=p(1)=2022$, it follows that the branches of the parabola are directed upwards. Then the minimum value of $p(x)$ is $p\left(\frac{1}{2}\right)=2022-\frac{(a-1)}{4}$. The maximum possible value of $a$ will be achieved when $p\left(\frac{1}{2}\right)=-2022$. Therefore,

$$
2022-\frac{(a-1)}{4}=-2022 \Rightarrow \frac{(a-1)}{4}=4044 \Rightarrow a-1=16176 \Rightarrow a=16177
$$