# Rules of calculus - functions of one variable

## Derivatives: definitions, notation, and rules

A derivative is a function which measures the slope.  It depends upon x in some way, and is found by differentiating a function of the form y = f (x).   When x is substituted into the derivative, the result is the slope of the original function y = f (x).

There are many different ways to indicate the operation of differentiation, also known as finding or taking the derivative.  The choice of notation depends on the type of function being evaluated and upon personal preference.

Suppose you have a general function: y = f(x).  All of the following notations can be read as "the derivative of y with respect to x" or less formally, "the derivative of the function."

f'(x)          f'          y'          df/dx          dy/dx          d/dx [f(x)].

[HINT: don't read the last three terms as fractions, read them as an operation.

For example, read:   "               dx/dy                                       =              3x"

As:                          "the function that gives the slope           is equal to      3x"

Let's try some examples.  Suppose we have the function :  y = 4x3 + x2  + 3.

After applying the rules of differentiation, we end up with the following result:

dy/dx = 12x2 + 2x.

How do we interpret this?  First, decide what part of the original function (y = 4x3 + x2  + 3) you are interested in.  For example, suppose you would like to know the slope of y when the variable x takes on a value of 2.  Substitute x = 2 into the function of the slope and solve:

dy/dx = 12 ( 2 )2 + 2 ( 2 ) = 48 + 4 = 52.

Therefore, we have found that when x = 2, the function y has a slope of  + 52.

Now for the practical part.  How do we actually determine the function of the slope?  Almost all functions you will see in economics can be differentiated using a fairly short list of rules or formulas, which will be presented in the next several sections.

## How to apply the rules of differentiation

Once you understand that differentiation is the process of finding the function of the slope, the actual application of the rules is straightforward.

First, some overall strategy. The rules are applied to each term within a function separately.  Then the results from the differentiation of each term are added together, being careful to preserve signs. [For example, the sum of 3x and negative 2x2 is 3x minus 2x2.].

Don't forget that a term such as "x" has a coefficient of positive one.  Coefficients and signs must be correctly carried through all operations, especially in differentiation.

The rules of differentiation are cumulative, in the sense that the more parts a function has, the more rules that have to be applied.  Let's start here with some specific examples, and then the general rules will be presented in table form.

Take the simple function:  y = C, and let C be a constant, such as 15.  The derivative of any constant term is 0, according to our first rule.  This makes sense since slope is defined as the change in the y variable for a given change in the x variable.  Suppose x goes from 10 to 11; y is still equal to 15 in this function, and does not change, therefore the slope is 0.  Note that this function graphs as a horizontal line.

Now, add another term to form the linear function y = 2x + 15.  The next rule states that when the x is to the power of one, the slope is the coefficient on that x.  This continues to make sense, since a change in x is multiplied by 2 to determine the resulting change in y.  We add this to the derivative of the constant, which is 0 by our previous rule, and the slope of the total function is 2.

Now, suppose that the variable is carried to some higher power.  We can then form a typical nonlinear function such as y = 5x3 + 10.   The power rule combined with the coefficient rule is used as follows: pull out the coefficient, multiply it by the power of x, then multiply that term by x, carried to the power of n - 1.  Therefore, the derivative of 5x3 is equal to (5)(3)(x)(3 - 1); simplify to get 15x2.  Add to the derivative of the constant which is 0, and the total derivative is 15x2

Note that we don't yet know the slope, but rather the formula for the slope.  For a given x, such as x = 1, we can calculate the slope as 15.  In plainer terms, when x  is equal to 1, the function ( y = 5x3 + 10) has a slope of 15.

These rules cover all polynomials, and now we add a few rules to deal with other types of nonlinear functions.   It is not as obvious why the application of the rest of the rules still results in finding a function for the slope, and in a regular calculus class you would prove this to yourself repeatedly.  Here, we want to focus on the economic application of calculus, so we'll take Newton's word for it that the rules work, memorize a few, and get on with the economics!  The most important step for the remainder of the rules is to properly identify the form, or how the terms are combined, and then the application of the rule is straightforward.

For functions that are sums or differences of terms, we can formalize the strategy above as follows:

If y = f(x) + g(x), then dy/dx = f'(x) + g'(x).  Here's a chance to practice reading the symbols.  Read this rule as: if y is equal to the sum of two terms or functions, both of which depend upon x, then the function of the slope is equal to the sum of the derivatives of the two terms.  If the total function is f minus g, then the derivative is the derivative of the f term minus the derivative of the g term.

The product rule is applied to functions that are the product of two terms, which both depend on x, for example, y = (x - 3)(2x2 - 1).  The most straightforward approach would be to multiply out the two terms, then take the derivative of the resulting polynomial according to the above rules.  Or you have the option of applying the following rule.

Given y = f(x) g(x); dy/dx = f'g + g'f.  Read this as follows: the derivative of y with respect to x is the derivative of the f term multiplied by the g term, plus the derivative of the g term multiplied by the f term.  To apply it to the above problem, note that f(x) = (x - 3) and g(x) = (2x2 - 1); f'(x) = 1 and g'(x) = 4x.  Then dy/dx = (1)(2x2 - 1) + (4x)(x - 3).  Simplify, and dy/dx = 2x2 - 1 + 4x2  - 12x, or 6x2 - 12x - 1.

The quotient rule is similarly applied to functions where the f and g terms are a quotient.  Suppose you have the function y = (x + 3)/ (- x2).  Then follow this rule:

Given y = f(x)/g(x),  dy/dx = (f'g - g'f) / g2.   Again, identify f= (x + 3) and g = -x2 ; f'(x) = 1 and g'(x) = - 2; and g2 = x4.  Then substitute in: dy/dx = [(1)(- x2) - (- 2)(x + 3)] / x4 . Simplify to dy/dx  = (-x2 + 2x + 6)/ x4 .

Now, let's combine rules by type of function and their corresponding graphs.

 Type of function Form of function Graph Rule Interpretation y = constant y = C Horizontal line dy/dx  = 0 Slope = 0; y = linear function y = ax + b Straight line dy/dx = a Slope = coefficient on x y = polynomial of order 2 or higher y = axn + b Nonlinear, one or more turning points dy/dx = anxn-1 Derivative is a function, actual slope depends upon location (ie value of x) y = sums or differences of 2 functions y = f(x) + g(x) Nonlinear dy/dx = f'(x) + g'(x). Take derivative of each term separately, then combine. y = product of two functions, y = [ f(x) g(x) ] Typically nonlinear dy/dx = f'g + g'f. Start by identifying f, g, f', g' y = quotient or ratio of two functions y = f ( x) / g ( x) Typically nonlinear dy/dx = (f'g - g'f) / g2. Start by identifying f, g, f', g', and g2

## Not-so-basic rules of differentiation

There are two more rules that you are likely to encounter in your economics studies.  The hardest part of these rules is identifying to which parts of the functions the rules apply.  Actually applying the rule is a simple matter of substituting in and multiplying through.  Notice that the two rules of this section build upon the rules from the previous section, and provide you with ways to deal with increasingly complicated functions, while still using the same techniques.

### The power function rule:

In the previous rules, we dealt with powers attached to a single variable, such as  x2 , or x5.  Suppose, however, that  your equation carries more than just the single variable x to a power.  For example,

y = (2x + 3)4

In this case, the entire term (2x + 3) is being raised to the fourth power.  To deal with cases like this, first  identify and rename the inner term in the parenthesis:  2x + 3 = g(x).  Then the problem becomes Now, note that your goal is still to take the derivative of y with respect to x.  However, x is being operated on by two functions; first by g (multiplies x by 2 and adds to 3), and then that  result is carried to the power of four.  Therefore, when we take the derivatives, we have to account for both operations on x.  First, use the power rule from the table above to get: .

Note that the rule was applied to g(x) as a whole.  Then take the derivative of g(x) = 2x + 3, using the appropriate rule from the table: .

Note the change in notation.  "g" is used because we were finding the change in g, with respect to a change in x.  Now, both parts are multiplied to get the final result: Recall that derivatives are defined as being a function of x.  Replace the g(x) in the above term with (2x + 3) in order to satisfy that requirement.  Then simplify by combining the coefficients 4 and 2, and changing the power (4-1) to 3: Now, we can set up the general rule.  When a function takes the following form:  Then the rule for taking the derivative is: ### The chain rule:

The second rule in this section is actually just a generalization of the above power rule.  It is used when x is operated on more than once, but it isn't limited only to cases involving powers.  Since you already understand the above problem, let's redo it using the chain rule, so you can focus on the technique.

Given the same problem: rename the parts of the problem as follows: and Then the entire problem can be expressed as: This type of function is also known as a composite function.  The derivative of a composite function is equal to the derivative of y with respect to u, times the derivative of u with respect to x: specifically in our problem:  Recall that a derivative is defined as a function of x, not u.  Substitute in 2x + 3 for u: and the problem is complete.  The formal chain rule is as follows.  When a function takes the following form: Then the derivative of y with respect to x is defined as: ### Updated table of derivatives

Let's add these two rules to our table of derivatives from the previous section:

 Type of function Form of function Graph Rule Interpretation y = constant y = C Horizontal line dy/dx  = 0 Slope = 0; y = linear function y = ax + b Straight line dy/dx = a Slope = coefficient on x y = polynomial of order 2 or higher y = axn + b Nonlinear, one or more turning points dy/dx = anxn-1 Derivative is a function, actual slope depends upon location (i.e. value of x) y = sums or differences of 2 functions y = f(x) + g(x) Nonlinear dy/dx = f'(x) + g'(x). Take derivative of each term separately, then combine. y = product of two functions y = [ f(x) g(x) ] Typically nonlinear dy/dx = f'g + g'f. Start by identifying f, g, f', g' y = quotient or ratio of two functions y = f ( x) / g ( x) Typically nonlinear dy/dx = (f'g - g'f) / g2. Start by identifying f, g, f', g', and g2 y=generalized power function Nonlinear Identify g(x) y=composite function/chain rule Nonlinear y is a function of u, and u is a function of x.

## Special cases

There are two special cases of derivative rules that apply to functions that are used frequently in economic analysis.  You may want to review the sections on natural logarithmic functions and graphs and exponential functions and graphs before starting this section.

### Natural logarithmic functions

When a function takes the logarithmic form: Then the derivative of the function follows the rule: If the function y is a natural log of a function of y, then you use the log rule and the chain rule.  For example, If the function is: Then we apply the chain rule, first by identifying the parts: Now, take the derivative of each part: And finally, multiply  according to the rule. Now, replace the u with 5x2, and simplify Note that the generalized natural log rule is a special case of the chain rule: Then the derivative of y with respect to x is defined as: ### Exponential functions

Taking the derivative of an exponential function is also a special case of the chain rule.  First, let's start with a simple exponent and its derivative.  When a function takes the logarithmic form: Then the derivative of the function follows the rule: .

No, it's not a misprint!  The derivative of ex is ex .

If the power of e is a function of x, not just the variable x, then use the chain rule: Then the derivative of y with respect to x is defined as: For example, suppose you are taking the derivative of the following function: Define the parts y and u, and take their respective derivatives:  Then the derivative of y with respect to x is: ### Updated table of derivatives

Now we can add these two special cases to our table:

 Type of function Form of function Graph Rule Interpretation y = constant y = C Horizontal line dy/dx  = 0 Slope = 0; y = linear function y = ax + b Straight line dy/dx = a Slope = coefficient on x y = polynomial of order 2 or higher y = axn + b Nonlinear, one or more turning points dy/dx = anxn-1 Derivative is a function, actual slope depends upon location (i.e. value of x) y = sums or differences of 2 functions y = f(x) + g(x) Nonlinear dy/dx = f'(x) + g'(x). Take derivative of each term separately, then combine. y = product of two functions, y = [ f(x) g(x) ] Typically nonlinear dy/dx = f'g + g'f. Start by identifying f, g, f', g' y = quotient or ratio of two functions y = f ( x) / g ( x) Typically nonlinear dy/dx = (f'g - g'f) / g2. Start by identifying f, g, f', g', and g2 y=generalized power function Nonlinear identify g(x) y=composite function/ chain rule Nonlinear y is a function of u, and u is a function of x. y=natural log function Natural log Special case of chain rule y=exponential function Exponential Special case of chain rule

## Higher order derivatives

Just as a first derivative gives the slope or rate of change of a function, a higher order derivative gives the rate of change of the previous derivative.  We'll tak more about how this fits into economic analysis in a future section, [link: economic interpretation of higher order derivatives] but for now, we'll just define the technique and then describe the behavior with a few simple examples.

To find a higher order derivative, simply reapply the rules of differentiation to the previous derivative.  For example, suppose you have the following function: According to our rules, we can find the formula for the slope by taking the first derivative: Take the second derivative by applying the rules again, this time to y', NOT y: If we need a third derivative, we differentiate the second derivative, and so on for each successive derivative.

Note that the notation for second derivative is created by adding a second prime.  Other notations are also based on the corresponding first derivative form.  Here are some examples of the most common notations for derivatives and higher order derivatives.

 Function First derivative Second derivative Third derivative             Now for some examples of what a higher order derivative actually is.  Let's start with a nonlinear function and take a first and second derivative.  Recall from previous sections that this equation will graph as a parabola that opens downward [link: graphing binomial functions].

 Function First derivative Second derivative   In order to understand the meaning of derivatives, let's pick a couple of values of x, and calculate the value of the derivatives at those points. Value of x Value of function at x first derivative at x second derivative at x x=0   x=1   x=2   So, how do we interpret this information?  When x equals 0, we know that the slope of the function, or rate of change in y for a given change in x (from the first derivative) is 6.  Similarly, the second derivative tells us that the rate of change of the first derivative for a given change in x is -2.  In other words, when x changes, we expect the slope to change by -2, or to decrease by 2.  We can check this by changing x from 0 to 1, and noting that the slope did change from 6 to 4, therefore decreasing by 2.

To sum up, the first derivative gives us the slope, and the second derivative gives the change in the slope.  In economics, the first two derivatives will be the most useful, so we'll stop there for now.

[Index]