586 words — categories: calculus
If the graph of a function rises from the left to the right over an interval \(I\), the function is increasing on, or over, \(I\). If the graph drops from left to right, the function is decreasing on, or over, \(I\).
Mathematically speaking, a function is increasing over an interval if, for every input \(a\) and \(b\) in the interval, the input \(a\) is less than the input \(b\), and the output \(f(a) < f(b)\). For decreasing functions the ouput must then be \(f(a) > f(b)\). In terms of secant lines, the slope of the secant line joining any two outputs \(f(a)\) and \(f(b)\) is positive for increasing functions and negative for decreasing functions. This behavior extends to derivatives. We can then define that:
- if \(f^\prime(x) > 0\) for all \(x\) in an open interval \(I\), then \(f\) is increasing over \(I\)
- if \(f^\prime(x) < 0\) for all \(x\) in an open interval \(I\), then \(f\) is decreasing over \(I\)
A critical values of a function \(f\) is any number \(c\) in the domain of \(f\) for which the tangent line at \((c, f(c))\) is horizontal or for which the derivative does not exist. That is, \(c\) is a critical value if \(f(c)\) exists and \(f^\prime(c) = 0\) or \(f^\prime(c)\) does not exist. A continuous function can change from increasing to decreasing and vicerversa only at a critical value, which is why they’re important.
Let’s say that \(I\) is the domain of \(f\).
\(f(c)\) is a relative minimum if there exists within \(I\) an open interval \(I_1\) containing \(c\) such that \(f(c) \leq f(x)\), for all \(x\) in \(I_1\). That is, we have a number that is the smallest of a set of numbers over an interval in the domain of a function (its \(x\)-values range).
\(f(c)\) is a relative maximum if there exists within \(I\) an open interval \(I_1\) containing \(c\) such that \(f(c) \geq f(x)\), for all \(x\) in \(I_1\). That is, we have a number that is the largest of a set of numbers over an interval in the domain of a function (its \(x\)-values range).
Following our initial definitions, to find relative extrema (relative minimum and maximum points) we need only consider those inputs for which the derivative is 0 or for which it does not exist.
There are a handful of derivative tests which we can use to to locate the critical points of a function and determine whether each point is a local maximum, a local minimum, or a saddle (or inflection) point.
We can easily find the (local) extrema of functions with
Let’s take the function \(f(x) = 2x^3 - 3x^2 - 12x + 12\).
import matplotlib.pyplot as plt import numpy as np import pandas as pd from scipy.signal import argrelextrema def f(x): return 2 * x ** 3 - 3 * x - 12 * x + 12 values = np.array([f(x) for x in np.linspace(-6, 6)]) peaks = argrelextrema(values, np.greater) valleys = argrelextrema(values, np.less) plt.plot(values) plt.plot(peaks, values[peaks], "x") plt.plot(valleys, values[valleys], "x", color="red")
Here’s a textbook example.
Brody Electronics estimates that it will sell \(N\) units of a new toy after spending \(a\) thousands of dollars on advertising, where
\[N(a) = -a^2 + 300a + 6\]
and \(0 \leq a \leq 300\). Find the relative extrema and sketch a graph of the function.
def N(a): return -a**2 + 300*a + 6 values = np.array(([N(a) for a in range(0, 300)])) relative_maxima = argrelextrema(values, np.greater) relative_minima = argrelextrema(values, np.less) relative_maxima
## (array(, dtype=int64),)
plt.plot(values) plt.plot(relative_maxima, values[relative_maxima], "x")