# Chain Rule: How to Use the Chain Rule with Examples

Calculus > Chain Rule Examples

The chain rule in calculus is used to differentiate many functions that have an “inner function” and an “outer function.” The problem is recognizing those functions that you can differentiate using the rule. The solution? Take a look at the following examples of the chain rule, which illustrate the different ways inner functions and outer functions look.

## Chain Rule Examples

The formal definition of the chain rule isn’t really any help when it comes to differentiating. What’s needed is a simpler, more intuitive approach!

## General steps to using the chain rule.

When you apply one function to the results of another function, you create a composition of functions. For example, if you had the functions f (x)= x2-3 and g (x) = x2, the composition g (f (x)), which is also written as (g ° f) (x), would be (x2-3)2 since the function f(x), the inner function, must be calculated before the value of g(x), the outer function, can be found. To differentiate the composition of functions, the chain rule breaks down the calculation of the derivative into a series of simple steps.

## Chain Rule General Steps

Step 1: Identify the inner and outer functions.
For an example, let the composite function be y = √ (x4 – 37). The inner function is x4 -37 and the outer function is √, which is also the same as the rational exponent ½.

Step 2:Differentiate the outer function first.
√ (x4 – 37) equals (x4 – 37) 1/2, which when differentiated (outer function only!) equals ½(x4 – 37) (1 – ½) or ½(x4 – 37)(-½).

Step 3: Differentiate the inner function, and then multiply it to the outer function’s derivative.
The derivative of x4 – 37 is 4x(4-1) – 0, which is also 4x3. Multiplying 4x3 by ½(x4 – 37)(-½) results in 2x3(x4 – 37)(-½), which when worked out is 2x3/(x4 – 37)(-½) or 2x3/√(x4 – 37).

That’s it!

## Exponential Functions

Differentiating using the chain rule usually involves a little intuition. The more times you apply the chain rule to different problems, the easier it becomes to recognize how to apply the rule. This article explains how to differentiate the function y=3x+12 using the chain rule. However, the technique can be applied to a wide variety of functions with any outer exponential function (like x32 or x99.

Step 1 Differentiate the outer function. In this case, the outer function is x2. Note: keep 3x+1 in the equation. Just ignore it, for now.
D(3x+1)2 = 2(3x+1)2-1 = 2(3x+1)

Step 2 Differentiate the inner function,. In this example, the inner function is 3x+1.
D(3x+1) = 3.

Step 3. Combine your results from Step 1 2(3x+1) and Step 2 (3).
= 2(3x+1) (3)

Step 4 Simplify your work, if possible. In this example, 2(3x+1) (3) can be simplified to 6(3x+1).

That’s it!

Tip: This technique can also be applied to outer functions that are square roots. For example, to differentiate
X + 1
: (x+1)1/2 is the outer function and x+1 is the inner function.

## Sin, Cosine or Tangent Functions.

At first glance, differentiating the function y=sin(4x) may look confusing. Knowing where to start is half the battle. The chain rule in calculus is one way to simplify differentiation. This article explains how to differentiate the function y=sin(4x) using the chain rule. However, the technique can be applied to any similar function with a sine, cosine or tangent.

Step 1 Differentiate the outer function, using the table of derivatives. In this case, the outer function is the sine function. Note: keep 4x in the equation but ignore it, for now. The derivative of sin is cos, so:
D(sin(4x)) = cos(4x).

Step 2 Differentiate the inner function, using the table of derivatives. In this example, the inner function is 4x.
D(4x) = 4

Step 3. Combine your results from Step 1 (cos(4x)) and Step 2 (4).
= cos(4x)(4)

Step 4 Simplify your work, if possible. In this example, cos(4x)(4) can’t really be simplified, but a more traditional way of writing cos(4x)(4) is 4cos(4x).

That’s it!

## “e” Functions

The number e, equivalent to about 2.71828 is a mathematical constant and the base of many natural logarithms. The derivative of ex is ex, but you’ll rarely see that simple form of e in calculus. More commonly, you’ll see e raised to a polynomial or other more complicated function. Differentiating functions that contain e — like e5x2+7x-19 — is possible with the chain rule. In order to use the chain rule you have to identify an outer function and an inner function.

Step 1 Differentiate the outer function first. In this example, the outer function is ex. Note: keep 5x2+7x-19 in the equation. Just ignore it, for now. The derivative of ex is ex, so:
D(e5x2+7x-19) = e5x2+7x-19.

Step 2 Differentiate the inner function, which is
5x2+7x-19.
D(5x2+7x-19) = (10x+7)

Step 3. Combine the results from Step 1 (e5x2+7x-19) and Step 2 (10x+7).
= e5x2+7x-13(10x+7)

Step 4 Rewrite the equation and simplify, if possible. In this example, no simplification is necessary, but it’s more traditional to write the equation like this:
(10x+7) e5x2+7x-19

That’s it!

Tip You can also use this rule to differentiate natural and common base 10 logarithms (D(ln x) = (1/x) and D(log x) = (1/x) log e.

## Multiplied Constants

Multiplied constants add another layer of complexity to differentiating with the chain rule. Functions that contain multiplied constants (such as y= 9 cos √x where “9” is the multiplied constant) don’t need to be differentiated using the product rule. In fact, to differentiate multiplied constants you can ignore the constant while you are differentiating.

Sample problem: Differentiate y = 7 tan √x using the chain rule.

Step 1
Differentiate the outer function, ignoring the constant. The outer function in this example is “tan.” (Note: Leave the inner function in the equation (√x) but ignore that too for the moment) The derivative of tan x is sec2x, so:
D(tan √x) = sec2 √x

Step 2 Differentiate the inner function, which is
√x.
D(√x) = (1/2) X-1/2

Step 3. Combine the results from Step 1 (sec2 √x) and Step 2 ((1/2) X-1/2).
= (sec2√x) ((1/2) X-1/2).

Step 4
Add the constant you dropped back into the equation.
7 (sec2√x) ((1/2) X-1/2).

Step 5 Rewrite the equation and simplify, if possible.
7 (sec2√x) ((1/2) X-1/2) =
7 (sec2√x) ((1/2) 1/X1/2) =
7 (sec2√x) / 2√x

That’s it!

## Number Raised to a Power

The chain rule can be used to differentiate many functions that have a number raised to a power. The key is to look for an inner function and an outer function.

Sample problem: Differentiate y=2cot x using the chain rule.

Step 1 Differentiate the outer function. The outer function in this example is 2x. Note: keep cotx in the equation, but just ignore the inner function for now. The derivative of 2x is 2x ln 2, so:
D(2cot x) = 2cot x (ln 2)

Step 2 Differentiate the inner function, which is
cot x. The derivative of cot x is -csc2, so:
D(cot 2)= (-csc2)

Step 3. Combine the results from Step 1 (2cot x) (ln 2) and Step 2 ((-csc2)).
= (2cot x (ln 2) (-csc2)x).

Step 4 Rewrite the equation and simplify, if possible. In this example, the negative sign is inside the second set of parentheses. It’s more traditional to rewrite it as:
-2cot x(ln 2) (csc2 x)

That’s it!

## Square Root Functions

Another way of writing a square root is as an exponent of 1/2. This exponent behaves the same way as an integer exponent under differentiation – it is reduced by 1 to -1/2 and the term is multiplied by 1/2. Therefore sqrt(x) differentiates as follows:
d/dx sqrt(x) = d/dx x(1/2) = (1/2) x(-1/2)

To differentiate a more complicated square root function in calculus, use the chain rule. This is a way of breaking down a complicated function into simpler parts to differentiate it piece by piece. The results are then combined to give the final result as follows:
dF/dx = dF/dy * dy/dx
where y is just a label you use to represent part of the function, such as that inside the square root.

Sample problem: Differentiate the square root function sqrt(x2 + 1).

Step 1: Write the function as (x2+1)(1/2). Label the function inside the square root as y, i.e., y = x2+1.

Step 2: Differentiate y(1/2) with respect to y.
d/dy y(1/2) = (1/2) y(-1/2)

Step 3: Differentiate y with respect to x.
dy/dx = d/dx (x2+1) = 2x

Step 4: Multiply the results of Step 2 and Step 3 according to the chain rule, and substitute for y in terms of x.
2x*(1/2) y(-1/2) = x(x2+1)(-1/2)

Step 5: Simplify your answer by writing it in terms of square roots. Remember that a function raised to an exponent of -1 is equivalent to 1 over the function, and that an exponent of 1/2 is the same as a square root function.
x(x2+1)(-1/2) = x/sqrt(x2+1)

Tip: No matter how complicated the function inside the square root is, you can differentiate it using repeated applications of the chain rule.

## General Power Rule for Power Functions

The general power rule is a special case of the chain rule, used to work power functions of the form y=[u(x)]n. The general power rule states that if y=[u(x)]n], then dy/dx=n[u(x)]n-1u'(x). A simpler form of the rule states if y-un, then y=nun-1*u’. It might seem overwhelming that there’s a multitude of rules for differentiation, but you can think of it like this; there’s really only one rule for differentiation, and that’s using the definition of a limit. Technically, you can figure out a derivative for any function using that definition. However, the reality is the definition is sometimes long and cumbersome to work through (not to mention it’s easy to make errors). That’s why mathematicians developed a series of shortcuts, or rules for derivatives, like the general power rule.

Sample question: What is the derivative of y=√(x2-4x+2)?

Step 1: Rewrite the square root to the power of 1/2:
y=(x2-4x+2)1/2

Step 2: Figure out the derivative for the “inside” part of the function, which is (x2-4x+2). You can find the derivative of this function using the power rule:
f'(x2-4x+2)= 2x-4)

Step 3: Rewrite the equation to the form of the general power rule (in other words, write the general power rule out, substituting in your function in the right places). Include the derivative you figured out in Step 1:
f’ = 1/2 (x2-4x+2)1/2-1(2x-4)
= f’ = 1/2 (x2-4x+2)-1/2(2x-4)

Step 4: (Optional)Rewrite using algebra:
(2x-4)/2√(x2-4x+2)

That’s it!

Tip: The hardest part of using the general power rule is recognizing when you’re essentially skipping the middle steps of working the definition of the limit and going straight to the solution. Once you’ve performed a few of these differentiations, you’ll get to recognize those functions that use this particular rule.

------------------------------------------------------------------------------

If you prefer an online interactive environment to learn R and statistics, this free R Tutorial by Datacamp is a great way to get started. If you're are somewhat comfortable with R and are interested in going deeper into Statistics, try this Statistics with R track.