# Calculus: Derivatives III

## Extrema

An extremum (plural extrema) of a function is a point that is either a) greater than or equal to or b) less than or equal to the points immediately around it. The extrema are the "peaks" and "valleys" in the graph of a function. A point is called a local maximum if moving away from it in either the positive or negative direction leads to an equal or lower value, and a point is called a local minimum if the opposite is true.

In more mathematically precise language, a point $(x_0,f(x_0))$ is a **local maximum** (plural **maxima**) of a function $f(x)$ in an interval $I$ if for all $x \in I$, $f(x) \leq f(x_0)$. An interval is simply a region of a function's domain. For example, the maximum of $f(x) = -x^2 + 1$ on the interval $[-1,1]$ is $(0,1)$. A point $(x_0,f(x_0))$ is a **local minimum** (plural **minima**) of a function $f(x)$ in an interval $I$ if for all $x \in I$, $f(x) \geq f(_0)$. The local minima in the preceding example are $(-1,0)$ and $(1,0)$.

A local maximum is said to be a **global maximum** if it is greater than or equal to all other points in the range of the function. A local maximum is said to be a **global minimum** if it is lesser than or equal to all other points in the range of the function. Looking again at the function $f(x) = -x^2 + 1$, we see that it has a global maximum at $(0,1)$ and no global minimum, since the function tends towards negative infinity in both directions.

Calculating the extrema of a function is often very useful. For example, a businessperson may want to minimize the costs of his business, or perhaps if he is savvier, maximize his profits. A baseball coach will want to pick the players who will provide the greatest chance of making it to and winning the World Series. Mathematics students will want to finish homework problems about extrema. In all these situations, knowing how to find extrema is clearly very valuable. Which leads to the question...how does one find the extrema of a function?

Technically there is no efficient way to solve for the extrema of any arbitrary function, since a function need not be expressed via an algebraic equation; each value in the domain could simply be assigned some random value. However, functions like these are pathological and are not exactly interesting anyway. For continuous, analytic functions, aka "nice" functions, which include polynomials, trigonometric functions, exponential and logarithmic functions, rational functions, and many combinations thereof, there is a straightforward process for discovering the extrema of a function: The **first derivative test** and the **second derivative test**.

To carry out the first derivative test, take the first derivative and finds its zeros. The zeros of the first derivative are places where the function is neither increasing nor decreasing. These are the only points where the function might have an extremum. All other points are by definition places where the first derivative is not zero; a slightly greater value can be found by moving in one direction, and a slightly smaller value can be found by moving in the opposite direction, hence such a point cannot be an extremum.

A zero first derivative does not necessarily mean that a point is an extremum, and even if it did, there would be not way of knowing whether it was a maximum or a minimum. Enter the second derivative test. To carry it out, take the second derivative, and check its value at the places where the first derivative is zero. If the second derivative is positive, that means the function is concave up, and therefore the point is a local minimum. If the second derivative is negative, that means the function is concave down, and therefore the point is a local maximum. If the second derivative is zero, that means that the function is neither concave up nor concave down, and the point is neither a maximum a minimum.

## Problems

- Find the local and global extrema of the following function in the given interval: $$y = x^2 \quad\text{in}\quad (-\infty,\infty)$$Step 1: Take the derivative: $$\dfrac{dy}{dx} = \dfrac{d}{dx} x^2 \\ \dfrac{dy}{dx} = 2x \\ $$ Step 2: Find zeros of the derivative: $$2x = 0 \\ x = 0 \\ $$ Step 3: Take the second derivative: $$\dfrac{d^2y}{dx^2} = \dfrac{d}{dx} 2x \\ \dfrac{d^2y}{dx^2} = 2 $$ Step 4: Find concavity of extrema:

At $x=0$, $\dfrac{d^2y}{dx^2} = 2$

A positive second derivative means positive concavity. The point (0,0) is therefore a**local minimum**. Because it is the only minimum in this polynomial, it is therefore also the**global minimum**. - Find the local and global extrema of the following function in the given interval: $$y = x^2 + 100 \quad\text{in}\quad (-\infty,\infty)$$Step 1: Take the derivative: $$\dfrac{dy}{dx} = \dfrac{d}{dx} \left(x^2 + 100\right) \\ \dfrac{dy}{dx} = 2x \\ $$ Step 2: Find zeros of the derivative: $$2x = 0 \\ x = 0 \\ $$ Step 3: Take the second derivative: $$\dfrac{d^2y}{dx^2} = \dfrac{d}{dx} 2x \\ \dfrac{d^2y}{dx^2} = 2 $$ Step 4: Find concavity of extrema:

At $x=0$, $\dfrac{d^2y}{dx^2} = 2$

A positive second derivative means positive concavity. The point (0,100) is therefore a**local minimum**. Because it is the only minimum in this polynomial, it is therefore also the**global minimum**. - Find the local and global extrema of the following function in the given interval: $$y = \frac{1}{3}x^3 - 3x^2 + 8x + 4 \quad \text{in} \quad (-\infty,\infty)$$Step 1: Take the derivative: $$\dfrac{dy}{dx} = \dfrac{d}{dx} \frac{1}{3}x^3 - 3x^2 + 8x + 4\\ \dfrac{dy}{dx} = x^2 - 6x + 8 \\ $$ Step 2: Find zeros of the derivative: $$x^2 - 6x + 8 = 0 \\ (x-2)(x-4) = 0 \\ x = 2 \\ x = 4 $$ Step 3: Take the second derivative: $$\dfrac{d^2y}{dx^2} = \dfrac{d}{dx} x^2 - 6x + 8 \\ \dfrac{d^2y}{dx^2} = 2x - 6 $$ Step 4: Find concavity of extrema:

At $x=2$, $\dfrac{d^2y}{dx^2} = -2 $

At $x=4$, $\dfrac{d^2y}{dx^2} = 2$

The point $\left(2, \dfrac{32}{3}\right)$ is a**local maximum**and the point at $\left(4,\dfrac{28}{3}\right)$ is a**local minimum**. Since the range of cubic functions is all real numbers, neither point is a global maximum or minimum. - Find the local and global extrema of the following function in the given interval: $$y = 2x^3 - 3x^2 - 120x + 7 \quad \text{in} \quad (-\infty,\infty)$$Step 1: Take the derivative: $$\dfrac{dy}{dx} = \dfrac{d}{dx}\left( 2x^3 - 3x^2 - 120x + 7 \right)\\ \dfrac{dy}{dx} = 6x^2 - 6x - 120 \\ $$ Step 2: Find zeros of the derivative: $$6x^2 - 6x - 120 = 0 \\ 6\left(x^2 - x - 20 \right) = 0 \\ x^2 - x - 20 = 0 \\ (x-5)(x+4) = 0 \\ x = 5 \\ x = -4 $$ Step 3: Take the second derivative: $$\dfrac{d^2y}{dx^2} = \dfrac{d}{dx} \left(6x^2 - 6x - 120\right) \\ \dfrac{d^2y}{dx^2} = 12x - 6 $$ Step 4: Find concavity of extrema:

At $x=-5$, $\dfrac{d^2y}{dx^2} = 12(-5) - 6 = -66 $

At $x=4$, $\dfrac{d^2y}{dx^2} = 12(4) - 6 = 42$

The point $\left(-4, 311\right)$ is a**local maximum**and the point at $\left(5,-418\right)$ is a**local minimum**. Since the range of cubic functions is all real numbers, neither point is a global maximum or minimum. - Find the local and global extrema of the following function in the given interval: $$y = 9x^3 \quad \text{in} \quad (-\infty,\infty)$$Step 1: Take the derivative: $$\dfrac{dy}{dx} = \dfrac{d}{dx}9x^3 \\ \dfrac{dy}{dx} = 27x^2 \\ $$ Step 2: Find zeros of the derivative: $$27x^2 = 0 \\ x^2 = 0 \\ x = 0 \\ $$ Step 3: Take the second derivative: $$\dfrac{d^2y}{dx^2} = \dfrac{d}{dx} 27x^2 \\ \dfrac{d^2y}{dx^2} = 54x $$ Step 4: Find concavity of extrema:

At $x=0$, $\dfrac{d^2y}{dx^2} = 0$

A zero second derivative means an inflection point. The point (0,0) is**neither**a local minimum or a local maximum. - Find the local and global extrema of the following function in the given interval: $$y = 2x + 14 \quad \text{in} \quad (-\infty,\infty)$$Step 0: This is a linear function - just a line. Intuitively, we shouldn't expect this to have any maxima or minima. Furthermore, does concavity make sense for a straight line? No. Let's show that our intuition is correct.

Step 1: Take the derivative: $$\dfrac{dy}{dx} = \dfrac{d}{dx}\left(2x+14\right) \\ \dfrac{dy}{dx} = 2 \\ $$ Step 2: Find zeros of the derivative:

The derivative is*always*2, so there are no zeros. For this continuous function, this means that there are no extrema.

Step 3: Take the second derivative: $$\dfrac{d^2y}{dx^2} = \dfrac{d}{dx}2 \\ \dfrac{d^2y}{dx^2} = 0 \\ $$ Step 4: Find concavity of extrema:

The second derivative is zero everywhere, which means that every point is neither concave nor convex. This confirms our intuition about concavity for lines. - Find the local and global extrema of the following function in the given interval: $$y = e^{-x^2} \quad \text{in} \quad (-\infty,\infty)$$Step 1: Take the derivative: $$\dfrac{dy}{dx} = \dfrac{d}{dx}e^{-x^2} \\ \dfrac{dy}{dx} = e^{-x^2}\left(\dfrac{d}{dx}-x^2\right) \\ \dfrac{dy}{dx} = e^{-x^2}(-2x) \\ \dfrac{dy}{dx} = -2xe^{-x^2} \\ $$ Step 2: Find zeros of the derivative: $$-2xe^{-x^2} = 0 \\ x = 0 $$ There are two ways for the derivative to be 0. Namely, when either $2x=0$ or when $e^{-x^2}=0$. Since the latter exponent has no zeros, the zero of the former line at $x=0$ is the only zero.

Step 3: Take the second derivative: $$\dfrac{d^2y}{dx^2} = \dfrac{d}{dx} -2xe^{-x^2} \\ \dfrac{d^2y}{dx^2} = e^{-x^2}\dfrac{d}{dx} (-2x) - 2x\dfrac{d}{dx}e^{-x^2} \\ \dfrac{d^2y}{dx^2} = -2e^{-x^2} - 2x\left(-2xe^{-x^2}\right) \\ \dfrac{d^2y}{dx^2} = -2e^{-x^2} + 4x^2e^{-x^2}$$ Tip: Notice that we already found $\dfrac{d}{dx}e^{-x^2}$, which is the first derivative, so we can save ourselves some effort and plug it into the third step directly.

Step 4: Find concavity of extrema:

At $x=0$, $\dfrac{d^2y}{dx^2} = -2e^{-0} + 4(0)^2e^{-0} = -2$

A negative second derivative means a negative concavity. The point (0,1) is therefore a local maximum. Since $e^{-x^2}$ is increasing on $(-\infty,0)$ and decreasing on $(0,\infty)$, the point $(0,1)$ is therefore also a global maximum. - Find the local and global extrema of the following function in the given interval: $$y = e^x \quad \text{in} \quad (-\infty,\infty)$$Step 1: Take the derivative: $$\dfrac{dy}{dx} = \dfrac{d}{dx}e^x \\ \dfrac{dy}{dx} = e^x \\ $$ Step 2: Find the zeros of the derivative:

The derivative $\dfrac{dy}{dx}=e^x$ has no zeros on $(\infty,\infty)$. Therefore $y=e^x$ has no extrema on $(\infty,\infty)$. - Find the local and global extrema of the following function in the given interval: $$y = \cos(\theta) \quad \text{in} \quad \left[0, 2\pi\right]$$Step 1: Take the derivative: $$\dfrac{dy}{d\theta} = \dfrac{d}{d\theta} \cos(\theta) \\ \dfrac{dy}{d\theta} = -\sin(\theta) \\ $$ Step 2: Find zeros of the derivative: $$-\sin(\theta) = 0 \\ \theta = \sin^{-1}(0) \\ \theta = 0 \\ \theta = \pi \\ \theta = 2\pi \\ $$ Step 3: Take the second derviative: $$\dfrac{d^2y}{d\theta^2} = \dfrac{d}{d\theta}(-\sin(\theta)) \\ \dfrac{d^2y}{d\theta^2} = -\cos(\theta) \\ $$ Step 4: Find concavity of the extrema:
- $-\cos(0) = -1$, therefore the extremum at $(0,1)$ is a local maximum.
- $-\cos(\pi) = 1$, therefore the extremum at $(\pi,-1)$ is a local minimum.
- $-\cos(2\pi) = -1$, therefore the extremum at $(2\pi,1)$ is a local maximum.

- Find the local and global extrema of the following function in the given interval: $$y = \sin( \theta ) \quad \text{in} \quad \left(-\infty, \infty \right)$$Step 1: Take the derivative: $$\dfrac{dy}{d\theta} = \dfrac{d}{d\theta} \sin(\theta) \\ \dfrac{dy}{d\theta} = \cos(\theta) \\ $$ Step 2: Find zeros of the derivative: $$\cos(\theta) = 0 \\ \theta = \cos^{-1}(0) \\ \theta = k\pi + \dfrac{\pi}{2}, \quad k \text{ an integer} \\ $$ Step 3: Take the second derviative: $$\dfrac{d^2y}{d\theta^2} = \dfrac{d}{d\theta}\cos(\theta) \\ \dfrac{d^2y}{d\theta^2} = -\sin(\theta) \\ $$ Step 4: Find concavity of the extrema: $$-\sin\left(k\pi + \dfrac{\pi}{2} \right) = \left\{ \begin{array}{ll} -1 & \text{for even } k \\ 1 & \text{for odd } k\end{array}\right. \\ $$ The extrema at $\left\{ \ldots, -\dfrac{7\pi}{2}, -\dfrac{3\pi}{2}, \dfrac{\pi}{2}, \dfrac{5\pi}{2}, \ldots \right\}$ are global and local maxima.

The extrema at $\left\{ \ldots, -\dfrac{5\pi}{2}, -\dfrac{\pi}{2}, \dfrac{3\pi}{2}, \dfrac{7\pi}{2}, \ldots \right\}$ are global and local minima.