# What are the global and local extrema of f(x)=4x-x^2  ?

Feb 12, 2016

$x = 2$ is both a global and local maximum.

#### Explanation:

Assume that the domain of $f$ is all real numbers.

Complete the square

$f \left(x\right) = - {\left(x - 2\right)}^{2} - 4$

As anything squared cannot be less than zero, $f \left(2\right) = - 4$ is the local maximum as well as the global maximum.

To show using calculus, take the first derivative of $f$.

$f ' \left(x\right) = 4 - 2 x$

Solve for $f ' \left(x\right) = 0$.

$4 - 2 x = 0$

$x = 2$

Perform the second derivative test.

$f ' ' \left(x\right) = - 2$

$f ' ' \left(2\right) = - 2 < 0$

This means that the gradient is decreasing at $x = 2$.

This means that the gradient changes from positive to zero to negative in a small neighborhood around $x = 2$.

This means that $x = 2$ is a local maximum.

There are no other local extrenum and $f$ is continuous everywhere.

$x = 2$ is also a global maximum.