2.5 Sketching a Function: Critical Points, Asymptotes, and Curvature
Many economic problems are concerned with optimizing something. This can mean maximizing something desirable like utility, or social welfare, or minimizing something undesirable like expense or risk. It can also mean balancing costs and benefits. To round out this lecture, let’s quickly review the mathematics of finding local maxima and minima of a function using calculus, and how we can use this information to sketch the graph of a function.
If $y$ is a function of $x$, we can plot the relationship between $x$ and $y$ as a curve in a two-dimensional plane. For example, if we plot the function \(y = f(x) = 24x-6x^{2}-8x^{3}+3x^{4}\) we get the following graph:
[ See interactive graph online at https://www.econgraphs.org/graphs/math/optimization/univariate_plot ]
As you can see, there are two local minima, at $x = -1$ and $x = 2$. Of these, the one at $x = -1$ is also a global minimum, because there is no value of $x$ for which $f(x) < f(-1)$. There is no global maximum, because the function increases as $x$ becomes very large or very small.
Finding critical points
In the case of a continuous, smooth function (one which is both continuous and continuously differentiable), a critical point — that is, a local maximum or minimum — occurs at a point where the function is “flat”. For a univariate function $y = f(x)$, this occurs where the derivative $dy/dx$ is equal to zero. If we plot the function above as well as its derivative, we can see that when the derivative is positive, the function is rising; when the derivative is negative, the functions is falling; and when the derivative is zero, the function is at a local maximum or minimum:
[ See interactive graph online at https://www.econgraphs.org/graphs/math/optimization/univariate_unconstrained_optimization ]
We can use this observation to sketch a function from its formula. In this case, the derivative of the function is \(f^\prime(x) = 12 - 12x - 24x^2 + 12x^3\) If we factor this Don’t panic. You won’t ever have to factor a cubic in this course! You might have to factor a quadratic, though…including on the homework for this week…, we get \(f^\prime(x) = 12(2 - x - 2x^2 + x^3) = 12(x+1)(x-1)(x-2)\) This is zero when $x = -1$, $x = 1$, or $x = 2$; so those are the $x$-values of its critical points. If we plug those back into the function, we see that this means there are critical points at $(-1, -19)$, $(1, 13)$, and $(2,8)$.
We can also find out whether the function is increasing or decreasing between those points, by evaluating the signs of the factors $(x+1)$, $(x-1)$, and $(x-2)$ between the critical points:
Range | $(x+1)$ | $(x-1)$ | $(x-2)$ | $f^\prime(x)$ |
---|---|---|---|---|
$x < -1$ | Negative | Negative | Negative | Negative |
$-1 < x < 1$ | Positive | Negative | Negative | Positive |
$1 < x < 2$ | Positive | Positive | Negative | Negative |
$2 < x $ | Positive | Positive | Positive | Positive |
Asymptotes and Restricted Domains
It’s important to note that not every function is defined for every possible value of $x$. Let’s think of two examples: square root functions, and functions with $x$ in the denominator.
First, (real) square roots are only defined for positive values. Therefore, the function $f(x) = \sqrt{x - c}$ is restricted to domain in which $x \ge c$. In the graph below, there are no values plotted for $x < c$:
[ See interactive graph online at https://www.econgraphs.org/graphs/math/univariate_calculus/restricted_domain ]
Second, rational functions are not defined for values when their denominator is equal to zero. Therefore, the function $f(x) = {1 \over x - c}$ is not defined when $x = b$. As $x$ approaches b from below, the function approaches $-\infty$, while as $x$ approachs 4 from above, the function approaches $\infty$. When a function approaches negative or positive infinity at a point on its domain, but is not defined at that point, it’s called a vertical asymptote. The best way to indicate this on a graph is to draw a vertical dashed line that the function approaches, but never reaches:
[ See interactive graph online at https://www.econgraphs.org/graphs/math/univariate_calculus/vertical_asymptote ]
Curvature of a Function: Convexity, Concavity, and Linearity
The last important feature of the graph of a function is its curvature. There are three possible ways in which a function can increase or decrease, which are determined by the sign of its second derivative:
- A univariate function is convex if its second derivative is positive: that is, if its slope is increasing (getting more positive or less negative) as $x$ increases.
- A univariate function is concave if its second derivative is negative: that is, if its slope is decreasing (getting less positive or more negative) as $x$ increases.
- A univariate function is linear if its second derivative is zero: that is, if its slope is not changing as $x$ increases.
Note that a function, like the one we analyzed above, may be concave for some values and convex for others. Others, like the function we analyzed at the beginning of this lecture, are either concave, convex, or linear over their entire domain.
One way to test if a function is always concave or convex is to take any two points and draw a line between them. If no matter which two points you choose, the segment connecting them lies above the function, then the function is convex. Conversely, if the segment always lies below the function, then the function is concave. (And obviously, if the segment always lies along the function, then the function must be linear.)