10.1 Introduction

Many optimal solutions of models having continuous non-linear objective functions are based on the slopes of those functions rather than the functions themselves. Slopes are the change in the function value per change in the value of the function’s argument. If the function is f(x), its slope is \(\Delta\)(f(x))/\(\Delta\)x. The maximum or minimum value of a function is when its slope is 0. The hill climbing approach used in Chap. 4 to solve a discrete version of the resource allocation problem involved finding the steepest slope of multiple user benefit functions and making an allocation to the user having the steepest remaining slope. The benefit–cost example introduced in Chap. 6 involved finding the allocation where the slopes of the benefit and cost functions were equal. In fact, the optimal solutions to both problems occurred when the slopes of the objective functions were equal. Slopes play a significant role in economic decision-making. Economists call these slopes marginal values, such as marginal benefits or marginal costs or marginal yields. This chapter introduces ways of finding slopes of continuous functions and how they can help us address various policy issues. To do this, we can use some procedures included in what is termed differential calculus.

This chapter assumes that many using this book may not have had much if any calculus and hence this basic introduction may be helpful. If you already know this subject, you can probably skip this chapter and go on to others (Fig. 10.1).

Fig. 10.1
figure 1

Founders of the ‘mathematics of change,’ Gottfried Wilhelm Leibniz and Isaac Newton. (Image: Christoph Bernhard Francke/Public domain, Image:Dr Project/Shutterstock, Image: After Godfrey Kneller/Public domain) https://www.thegreatcoursesdaily.com/invented-calculus-newton-leibniz/

10.2 Finding Slopes

Differentiation is a method of calculus that lets us find the slope of any point on a function. If we are interested in finding the maximum value of the non-linear function f(x) shown in Fig. 10.2, we know that happens when the slope is 0, so we can use differentiation to find the function that is the slope of the original function, f(x), and then set that slope function equal to 0 and solve for x. The value of x where the slope of f(x) = 0 is where the black dot is in Fig. 10.2.

Fig. 10.2
figure 2

A concave function f(x) whose maximum value is indicated by the dot. At this point, the slope is 0

Slopes define the rate of change of a function f(x) at any point on the function, i.e., at any value of x. As the function’s variable value, i.e., x, changes, the function’s slope may also change, such as is the case in Fig. 10.2.

An easy way to find slopes for any continuous function is by differentiation. Differentiating a function results in another function whose value for any value x is the slope of the original function f(x) at x. This function is known as the derivative of the original function and is denoted by either a prime sign, as in f’(x), or by the differential operator notation, df/dx. The operator ‘d’ replaces the change notation ‘Δ’ as in Δf(x)/Δx and signifies what the change in f(x) is as Δx goes to 0.

The slope of any continuous function f(x) at any value of x is a line tangent to it at that value of x such as shown in Fig. 10.2. The slope of the tangent line is the slope of the function at that value of x.

If the function is concave, as shown in Fig. 10.2, its slope decreases as x increases. The slope of a convex function increases as x increases. The slope, also called the gradient, of a function, tells us how steep the function f(x) is at a particular value of x. A linear function, i.e., a horizontal line has slope 0; a line with a positive slope increases in value as x increases. A line with a negative slope decreases in value as x increases in value.

10.3 Maxima and Minima

Finding the value of x of a function f(x) that results in a 0 slope does not always guarantee a maximum or minimum of the function. The function may have multiple values of x that result in slopes of 0. For now, this is just a warning that finding the value(s) of x where the slope of f(x) is 0 does not always tell us what we want to know without some additional tests to be sure the solutions are indeed global, rather than a local maxima or minima, or whether it represents a maximum or minimum (Fig 10.3).

Fig. 10.3
figure 3

A graph of a function having local maximum and minimum values. At those points, the slopes of the function are 0. The global maximum (y = 10) and minimum (y = −10) points are at the end points of the function where the slopes are not zero

One way to know if a point on a function where the slope is 0 is a true maximum or minimum is to just graph the function and see if it looks like a global maximum or minimum. You can also find the slope of the function for a slightly smaller value of x to determine if the function was at a maximum or a minimum value. If the newly computed slope is positive, the zero-slope value of the function was a maximum. Otherwise, the function was at a minimum value.

10.4 Finding Slopes Using Differentiation

A derivative of a function defines its slope. The derivative of a function is another function that is the slope of the original function. For example, consider the function 5x2. Its slope at any value of x is found by differentiating it, i.e., by finding d(5x2)/dx. Most of the functions we will be working within this book are power functions having terms of the form axb where ‘a’ and ‘b’ are known constants.

Consider the function f(x)  = axb. The slope of this power function is found in two steps:

  1. (1)

    Multiply the term by its exponent b, so axb becomes baxb

  2. (2)

    Subtract 1 from the exponent, resulting in baxb−1.

This is the slope of axb for any value of x. Differentiation is as simple as that for continuous power functions. Even constants can be expressed as a power function. Any constant C is also Cx0 since any term raised to the 0th power is 1. Hence, the slope of any constant C is 0. The linear function 2x can also be expressed as 2x1 and hence its slope is 1(2)x1−1 or 2.

The slope of this ‘slope function’ is the derivative of a derivative, called the second derivative, which is designated as d2f(x)/dx2.

d2f/dx2 = d [(df/dx)/dx]/dx = d[bax(b−1)]/dx = a(b)(b − 1) xb − 2. And so on for the nth derivative.

The slope of a function that is the sum of multiple terms is found by replacing each term with its derivative. For example, the slope of 7 + 4x1.5 is 0 + 6x0.5. This example illustrates the fact that the slopes of functions containing constants are not affected by the constants. Marginal costs are not impacted by fixed costs. Derivatives of constants, including fixed costs, are always 0.

There are other shortcuts to differentiating more complicated combinations of functions that one can learn from textbooks in calculus. Probably the biggest shortcut one can take to find a derivative is to access one of many programs available on the internet for differentiating user-provided functions.

Before leaving this subject, we need to cover what is termed partial differentiation of multivariable functions.

10.5 Partial Differentiation

For multivariate functions having more than one unknown variable in them, one can find the slopes associated with each variable independently of the others. For example, consider the function f(x, y) = 5 + 3(xy). The partial derivative of f(x, y) with respect to x (assuming y is a constant) is ∂f/∂x = 3y. The partial derivative of f(x, y) with respect to y (assuming x is constant) is ∂f/∂y = 3x.

For partial derivatives, we replace the differential operator d as in dx with ∂ as in ∂x to indicate that it is a partial differentiation.

To illustrate, consider the two-variable function f(x,y) = 5 + 3(xy)2, which is the same as 5 + 3(x2y2).

$$\begin{gathered} \partial f{/}\partial x = 3\left( {2xy^{2} } \right) = 6xy^{2} .\,\,\,\,\,\,\,\,\,{\text{Partial}}\,{\text{derivative}}\,{\text{with}}\,{\text{respect}}\,{\text{to}}\,{\text{the}}\,{\text{variable}}\,x{\text{.}} \hfill \\ \partial f{/}\partial y = 3\left( {2x^{2} y} \right) = 6x^{2} y.\,\,\,\,\,\,\,\,\,{\text{Partial}}\,{\text{derivative}}\,{\text{with}}\,{\text{respect}}\,{\text{to}}\,{\text{the}}\,{\text{variable}}\,y{\text{.}} \hfill \\ \end{gathered}$$

10.6 A Review

For a review, assume f(x) = 9 + 3x−2 + 5x4.

$$\begin{gathered} d{\text{f}}/dx = \, - {6}x^{{ - {3}}} + { 2}0x^{{3}} \,\,\,\,\,\,\,\,\,\,\,\,\,\,\,{\text{First}}\,{\text{derivative}}{.} \hfill \\ d{\text{f}}^{{2}}{/}dx^{{2}} = { 18}x^{{ - {4}}} + { 6}0x^{{2}} \,\,\,\,\,\,\,\,\,\,\,\,\,{\text{Second}}\,{\text{derivative}}{.} \hfill \\ d{\text{f}}^{{3}}{/}dx^{{3}} = \, - {72}x^{{ - {5}}} + { 12}0x\,\,\,\,\,\,\,\,{\text{Third }}\,{\text{derivative}}{.} \hfill \\ \hfill \\ \end{gathered}$$

Finally consider f(x , y) = 5 + 3(x + y)2, which is the same as 5 + 3(x2 + 2xy + y2).

$$\begin{gathered} \partial f{/}\partial x = 3\left( 2 \right)\left( {x + y} \right)^{1} 1 = 6\left( {x + y} \right)\,\,\,{\text{Partial}}\,{\text{derivative}}\,{\text{with}}\,{\text{respect}}\,{\text{to}}\,{\text{the}}\,{\text{variable}}\,x{\text{.}} \hfill \\ \partial f{/}\partial y = 3\left( 2 \right)\left( {x + y} \right)^{1} 1 = 6\left( {x + y} \right)\,\,\,{\text{Partial}}\,{\text{derivative}}\,{\text{with}}\,{\text{respect}}\,{\text{to}}\,{\text{the}}\,{\text{variable}}\,y{\text{.}} \hfill \\ \end{gathered}$$

10.7 Derivative Notation

See Table 10.1

Table 10.1 Differential calculus notation. The variable y = f(x)′

10.8 Integration

Integration is just the reverse of differentiation. Differentiating a function gives us the equation for the slope of that function. For example, the slope of the function x2 is d(x2)/dx = 2x. Integrating a function finds the original function for which the existing function, e.g., 2x, is its slope. The process of integration is simply the reverse of what it is for differentiation, with an addition of a constant.

To differentiate x2, we first multiply the function by its exponent, 2x2, and then subtract 1 from the exponent, to get 2x. To integrate 2x, which is 2x1, we first add one to the exponent, 2x1+1 = 2x2. Then we divide the function by the new exponent, getting 2x2/2 = x2. But we also need to add a constant, say C, which is the value of the function x2 when x = 0. In this case, C is obviously 0. So we end up with x2 + C, and when this is differentiated it becomes 2x. Differentiating C + 5x3 results in 0 + 15x2. Integrating 15x2 results in 15 x2+1/(2 + 1) = 5x3 plus a constant C.

10.8.1 An Exception

Consider integrating ax–1 or equivalently a/x. In this case, the result would be ax0/0 = a/0 since the exponent b = –1. Hence, in this case, the rules for integration do not work. The function’s correct solution is the constant ‘a’ times the natural logarithm of x plus a constant C (a ln x + C). The term ln x is the exponent of the base of natural logarithms, e, (=2.718281828.) that results in x. Note eln x = x When x = 1, ln 1 = 0. e0 = 1. When x is e, ln e = 1. e1 = e.

If we were working with logarithms of base 10, then 10log x = x. The log of 1 is 0 since 100 is 1. The log of 10 is 1 since 101 is 10 and the log of 100 is 2 since 102 is 100. Again, the logarithm of some number x is the exponent of, in this case, 10, which results in the value x. The natural logarithm is the exponent of e that results in some value of x. The base of logarithms can be either 10 (when the term ‘log’ is used) or e (when the term ‘ln’ is used).

10.8.2 What is Integration?

The upper case sigma, Ʃ, signifies a sum. If we were adding a series of discrete values of some function g(xj) we would write it as Ʃj g(xj). Whatever those values are they can be expressed as g(xj)/\(\Delta\)xj, where the function g(xj) is constant over the interval \(\Delta\)xj. These discrete values can be considered rectangles having heights equal to the g(xj) and widths equal to the \(\Delta\)xj such as shown in Fig. 10.4.

Fig. 10.4
figure 4

A series of discrete rectangles having heights g(x) and widths of \(\Delta\)x for discrete values of x

The sum of the areas in the rectangles shown in Fig. 10.4 is an approximation of the area under the continuous function 2x. Since the function 2x is a continuous function of x, the smaller the widths \(\Delta\)x are the more accurate will be the estimation of the area under the function. This is evident when computing the area under the function shown in Fig. 10.5.

Fig. 10.5
figure 5

Computing the area under a function becomes more accurate the smaller the width of each rectangle becomes

Assuming all \(\Delta\)x are 1, the area of each rectangle in Fig. 10.4 is 2x. The sum of the areas over each value of x from 1 to 5 is expressed as

$$\sum\limits_{1}^{5} {2x\,\Delta {\text{x}}} \, = \,2 + 4 + 6 + 8 + 10 = 30.$$

As \(\Delta\)x gets smaller, the area between 0 and 5 converges to its true value of 0.5(5)(10)) = 25. As \(\Delta\)x approaches 0, it becomes dx, and the integral sign, ʃ, replaces the Ʃ sign. Hence, the area under the function g(x) = 2x from x = 0 to x = 5 is

$$\int\limits_{0}^{5} {2x\,{\text{dx = 2x}}^{2} /2 = {\text{x}}^{2} = 5^{2} = 25.}$$

If g(x) is the function that defines the slope of another function f(x), then the equation defining the area under the slope function is the function f(x). Hence, if f(x) = x2, then its slope is d(x2)/dx is 2x. The triangular area from x = 0 to some value of x = x* under the function 2x is obviously 0.5(x*)2x* = x*2. The area under a slope function is the value of the original function. ʃ (d(f(x)/dx) dx = f(x).

10.8.3 Integrating Over Ranges of a Variable or Function

ʃ (15 x2) dx = 5x3 + C is an example of indefinite integration. The value of x has no limits.

If x ranges between a and b, then the area under any continuous function g(x) between x = a and x = b is determined by the definite integral

$$\int\limits_{a}^{b} {g(x){\text{dx}} = \int {g(x){\text{dx}}\,} } {\text{evaluated}}\,{\text{at}}\,x = {\text{b}} - \int {g(x){\text{dx}}\,{\text{evaluated}}\,{\text{at}}\,x{\text{ = a}}}$$

Thus

$$[x^{2} + {\text{C}}]|_{{x = {\text{b}}}} - [x^{2} + {\text{C}}]|_{x = a} = {\text{b}}^{{2}} - {\text{a}}^{2}.$$

10.8.4 Other Examples of Integration

Some functions may have multiple terms of the form axb. In this case, integrating each one separately will result in the integral of the entire function. For example, assume f(x) is (5 + 3x – 2x2)2. When expanded it becomes 25 + 30x – 11x2 – 12x3 + 4x4. Differentiating each term of f(x) results in 2(5 + 3X – 2X2)(3 – 4X) or 30 – 22x – 36x2 + 16x3.

Integrating the function (30 – 22x – 36x2 + 16x3) involves integrating each term.

$$\int { \left( {{3}0 \, {-}{ 22}x{-}{ 36}x^{{2}} + { 16}x^{{3}} } \right)dx = { 3}0x{-}{ 11}x^{{2}} {-}{ 12}x^{{3}} + { 4}x^{{4}} + {\text{ C}}. }$$

The constant C can be determined by referring to the original function f(x) = (5 + 3x – 2x2)2 and setting all the variables x to 0. This identifies C to be 52 or 25. Thus, the integral of a differentiated function d(f(x)/dx is the function f(x) itself.

There are many functions that do not easily convert to a series of terms that are easily integrated. The internet not only provides many examples of differentiation and integration, but also contains programs that will do the differentiation or integration of user-provided functions. So, if you are stuck, go to the internet but you should be able to perform those operations on the types of functions illustrated in this chapter.

The tables below are for your reference if needed (Tables 10.2, 10.3 and 10.4).

Table 10.2 Notation used for integration
Table 10.3 Some common indefinite integrals. The ‘ln’ in this table refers to natural logarithms having e as its base
Table 10.4 Some rules are satisfied by definite integrals

Exercises

0 Warmup.

The following examples show that if you want to compute the average value of a function over a range of values, you want to compute the average of different functional values rather than computing the function’s value of the average input value.

Consider each of these functions:

figure a

Note that:

  • For concave functions:

    $$\begin{gathered} {\text{Mean}}\,{\text{ of }}\,{\text{function}}\,{\text{ values }}\, \le \, \,{\text{function }}\,{\text{value}}\,{\text{ for }}\,{\text{mean}}\,{\text{ x}} \hfill \\ \,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,{15}\,5{/6}\,\,\,\,\,\,\,\,\,\, \le \,\,\,\,\,\,\,\,\,10({2}{\text{.5)}} - 2.5^{2} = 18.75 \hfill \\ \end{gathered}$$
  • For convex functions:

    $$\begin{gathered} {\text{Mean}}\,{\text{ of }}\,{\text{function}}\,{\text{ values }}\, \ge \, \,{\text{function }}\,{\text{value}}\,{\text{ for }}\,{\text{mean}}\,{\text{ x}} \hfill \\ \,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,{9}\,{1/6}\,\,\,\,\,\,\,\,\,\, \ge \,\,\,\,\,\,\,\,\,{2}{\text{.5}}^{2} = 6.25 \hfill \\ \end{gathered}$$
  • For linear functions:

    $$\begin{gathered} {\text{Mean}}\,{\text{ of }}\,{\text{function}}\,{\text{ values }}\, = \, \,{\text{function }}\,{\text{value}}\,{\text{ for }}\,{\text{mean}}\,{\text{ x}} \hfill \\ \,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,{12}{\text{.5}}\,\,\,\,\,\,\,\,\,\,{ = }\,\,\,\,\,\,\,\,\,{(5)2}{\text{.5 = 12}}{.5} \hfill \\ \end{gathered}$$
  • Show that the true mean is between these two values for each function.

  1. 1.

    Benefit–Cost analysis.

    Assume a benefit function B = 60*x^0.8 and a cost function C = 4 + 7*x^1.5. The difference between B and C is the net benefits.

    1. (a)

      Find the value of x that results in the maximum net benefits.

    2. (b)

      Would an increase in the fixed cost of 4 affect the value of x?

  2. 2.

    Water supply utility.

    You are a mayor of a town that is considering privatizing the public water supply system. Currently, the public water supply system is operating in such a way that maximizes the benefits to its consumers (willingness to pay) while still paying for the service. No profit is made. If it is privatized, the private company will want to maximize its profits (revenue less costs).

    For example, consider the functions shown below:

    The horizontal axis is the amount of water delivered, and the vertical axis is money representing the unit price of water charged, the total and marginal costs, and the total and marginal revenue.

    Willingness to pay is the area under the demand curve.

    Assume the public utility objective is to maximize willingness to pay less the cost of supplying water.

    Assume the private utility objective is to maximize total revenue less the cost of supplying water.

    The total revenue is the unit price times the quantity Q sold.

    figure b

    For an amount of water, Q assume the total cost = 5Q and the demand function = unit price = 12 – 1.5Q.

    figure c

    Given these data, find the best amounts of water to deliver and the associated unit prices to charge for both public and private utility. The public utility should maximize consumer surplus less its costs, and the private utility will maximize its producer surplus or profit subject to any regulations it must meet. In this example, there are none.

    Find the solutions and graph the solutions like the figures above. Identify on the graph the consumer’s surplus, producer’s surplus, and total cost.

    For a public utility, what should the unit price be for the water supplied, and how does it compare to the marginal cost?

    For a private utility, what should the unit price be for the water supplied, and how does it compare to the marginal cost? Hence, what is the unit and total profit?