582. $y=4x-x^{2}$.
Solution. $1^{0}$. Find the first derivative: $y^{\prime}=4-2 x$. $2^{0}$. Solving the equation $4-2 x=0$, we get the critical point $x=2$. $3^{0}$. Calculate the second derivative: $y^{\prime \prime}=-2$.

$4^{0}$. Since $y^{\prime \prime}$ is negative at any point, then $y^{\prime \prime}(2)=-2<0$. This means that the function has a maximum at the point $x=2$. Let's find its value: $y(2)=4 \cdot 2-2^{2}=4$, i.e., $y_{\max }=4$.