Tutorials › AP Calculus › The Chain Rule when y Depends on x

Implicit Differentiation · Tutorial 182 of 999

The Chain Rule when y Depends on x

See how the chain rule accounts for \(y\)'s dependence on \(x\), and use it to differentiate powers and sine of \(y\).

Intermediate 9 min read

What You'll Learn

  • Explain why differentiating \(y^2\) with respect to \(x\) produces a factor of \(dy/dx\).
  • Distinguish differentiating with respect to \(x\) from differentiating with respect to \(y\).
  • Apply the chain rule to positive integer powers of a differentiable function \(y(x)\).
  • Differentiate \(\sin(y(x))\) and interpret each factor in the result.
  • Recognize and correct the mistake of omitting the derivative of the inner function.

Why Does \(y^2\) Produce a \(dy/dx\) Factor?

When \(y\) depends on \(x\), an expression such as \(y^2\) changes as \(x\) changes. Differentiating \(y^2\) with respect to \(x\) must therefore account for two things: how the squaring operation changes its input, and how \(y\) changes with \(x\).

The chain rule combines these two rates of change. In this setting, it gives

$$ \frac{d}{dx}(y^2)=2y\frac{dy}{dx}. $$

The factor \(2y\) is the derivative of the outer function, the square. The factor \(dy/dx\) records the rate at which the inner quantity \(y\) changes as \(x\) changes. Omitting that second factor would treat \(y\) as though it were simply the independent variable.

Key idea: If \(y=y(x)\) is differentiable, then differentiating an expression in \(y\) with respect to \(x\) requires the chain rule. The derivative of the outer expression is multiplied by \(dy/dx\).

What the Derivative Notation Means

Suppose \(y\) is a differentiable function of \(x\), so \(y=y(x)\). The notation \(dy/dx\) means the derivative of that function with respect to \(x\). Thus, \(\frac{d}{dx}(y^2)\) is the derivative with respect to \(x\) of the composite function \(y(x)^2\).

It is useful to temporarily give the outer function its own input name. Let \(g(u)=u^2\). Then \(y(x)^2=g(y(x))\), a composition of \(g\) with \(y\). The chain rule says that the derivative of this composition is the derivative of \(g\) evaluated at \(y(x)\), multiplied by \(y'(x)\).

$$ \frac{d}{dx}g(y(x))=g'(y(x))y'(x). $$

Since \(g'(u)=2u\), substituting \(u=y(x)\) gives \(g'(y(x))=2y(x)\). Therefore,

$$ \frac{d}{dx}(y^2)=2y\frac{dy}{dx}. $$

The notation \(2y\frac{dy}{dx}\) does not mean that \(y\) is an independent variable. It is a compact way to show that the derivative of the square, \(2y\), is multiplied by the derivative of \(y\) with respect to \(x\).

A Derivation Using the Difference Quotient

The formula for \(y^2\) can also be justified directly from the definition of a derivative. This makes clear why the factor \(dy/dx\) is necessary.

1
Start with the difference quotient.
For \(y=y(x)\), the derivative of \(y(x)^2\) at \(x\) is the limit of \(\big(y(x+h)^2-y(x)^2\big)/h\), if that limit exists.
2
Factor the difference of squares.
Write the numerator as \(\big(y(x+h)-y(x)\big)\big(y(x+h)+y(x)\big)\).
3
Separate the two changing factors.
For \(h\ne 0\), the quotient is \(\big(y(x+h)-y(x)\big)/h\) multiplied by \(y(x+h)+y(x)\).
4
Take the limit.
Differentiability of \(y\) implies continuity of \(y\), so the first factor tends to \(y'(x)\), while the second tends to \(2y(x)\).
$$ \begin{aligned} \frac{d}{dx}\big(y(x)^2\big) &=\lim_{h\to 0}\frac{y(x+h)^2-y(x)^2}{h}\\ &=\lim_{h\to 0} \left(\frac{y(x+h)-y(x)}{h}\right) \big(y(x+h)+y(x)\big)\\ &=y'(x)\big(2y(x)\big)\\ &=2y\frac{dy}{dx}. \end{aligned} $$

Both limits used in the final step exist: the first because \(y\) is differentiable at \(x\), the second because differentiability implies continuity. This argument proves the formula at every point where \(y\) is differentiable.

Positive Integer Powers of \(y\)

The same reasoning applies to any positive integer power. Treat the power as the outer function \(g(u)=u^n\), where \(n\) is a positive integer. Its derivative is \(g'(u)=nu^{n-1}\). Applying the chain rule to \(g(y(x))\) gives the following result.

Theorem: If \(y=y(x)\) is differentiable and \(n\) is a positive integer, then $$ \frac{d}{dx}(y^n)=ny^{n-1}\frac{dy}{dx}. $$ The derivative of the outer power gives \(ny^{n-1}\); the derivative of the inner function gives \(dy/dx\).

For \(n=2\), the result is \(2y\,dy/dx\). For \(n=3\), it is \(3y^2\,dy/dx\). In each case, the derivative is with respect to \(x\), even though the power is written using \(y\).

Worked Example: Differentiate a Square When the Rate of Change Is Given

Suppose \(y\) is differentiable, \(y(2)=3\), and \(y'(2)=-4\). Find \(\frac{d}{dx}(y^2)\) at \(x=2\).

First apply the square rule:

$$ \frac{d}{dx}(y^2)=2y\frac{dy}{dx}. $$

Now use the given values \(y(2)=3\) and \(y'(2)=-4\):

$$ \left.\frac{d}{dx}(y^2)\right|_{x=2} =2y(2)y'(2) =2(3)(-4) =-24. $$

Check: the square contributes the factor \(2y(2)=6\), and the changing value of \(y\) contributes \(y'(2)=-4\). Their product is \(6(-4)=-24\), matching the chain-rule result. The negative sign indicates that \(y^2\) is decreasing at \(x=2\) at that instant.

Worked Example: Differentiate a Combination of Powers of \(y\)

Suppose \(y=y(x)\) is differentiable. Differentiate \(y^5-2y^2\) with respect to \(x\).

Differentiate each power using the chain rule. For the first term, the outer derivative is \(5y^4\), and the inner derivative is \(dy/dx\):

$$ \frac{d}{dx}(y^5)=5y^4\frac{dy}{dx}. $$

For the second term, keep the constant multiplier \(-2\) and apply the square rule:

$$ \frac{d}{dx}(-2y^2) =-2\left(2y\frac{dy}{dx}\right) =-4y\frac{dy}{dx}. $$

Combining the derivatives gives

$$ \frac{d}{dx}(y^5-2y^2) =5y^4\frac{dy}{dx}-4y\frac{dy}{dx}. $$

A common factor may be taken out, but is not required:

$$ \frac{d}{dx}(y^5-2y^2) =(5y^4-4y)\frac{dy}{dx}. $$

Check: distributing the factored expression gives \(5y^4\,dy/dx-4y\,dy/dx\), exactly the two term-by-term derivatives above.

Sine of a Function

The same chain rule applies when the outer function is trigonometric. Let \(g(u)=\sin u\), using radians. Then \(g'(u)=\cos u\). For differentiable \(y=y(x)\), the composition is \(\sin(y(x))\), so

Chain-rule formula: If \(y=y(x)\) is differentiable, then $$ \frac{d}{dx}(\sin y)=\cos y\frac{dy}{dx}. $$ The cosine factor comes from differentiating sine with respect to its input; the \(dy/dx\) factor comes from differentiating that input with respect to \(x\).

The formula is not \(\cos y\) alone unless \(dy/dx=1\). Sine changes in response to changes in its input, and the input \(y\) may itself change faster or slower than \(x\).

Worked Example: Differentiate Sine of a Linear Function

Let \(y(x)=\frac{\pi}{3}+2x\). Find \(\frac{d}{dx}(\sin y)\) at \(x=0\).

First find the inner value and its derivative:

$$ y(0)=\frac{\pi}{3}+2(0)=\frac{\pi}{3}, \qquad \frac{dy}{dx}=2. $$

Apply the sine chain rule and substitute these values:

$$ \left.\frac{d}{dx}(\sin y)\right|_{x=0} =\cos(y(0))\,y'(0) =\cos\left(\frac{\pi}{3}\right)(2) =\frac{1}{2}(2) =1. $$

Check by writing the composite function explicitly: \(\sin y=\sin\left(\frac{\pi}{3}+2x\right)\). The chain rule for this composition gives \(2\cos\left(\frac{\pi}{3}+2x\right)\), which at \(x=0\) is \(2\cdot\frac12=1\), the same result.

A Common Mistake: Forgetting the Inner Derivative

A frequent error is to differentiate the outer expression correctly but stop before multiplying by \(dy/dx\). For instance, the incorrect calculation

$$ \frac{d}{dx}(y^2)=2y $$

treats \(y\) as though it were the independent variable. But the requested derivative is with respect to \(x\), and \(y\) depends on \(x\). The corrected calculation is

$$ \frac{d}{dx}(y^2)=2y\frac{dy}{dx}. $$

For a concrete check, take \(y(x)=3x\). Then \(y^2=9x^2\), whose derivative is \(18x\). The chain-rule expression gives \(2y\,dy/dx=2(3x)(3)=18x\). The incorrect expression \(2y=6x\) does not match the derivative of \(9x^2\).

Check before finishing: When differentiating with respect to \(x\), ask whether the quantity inside the outer function depends on \(x\). If it does, include its derivative as the inner factor.

Why This Rule Matters

The notation \(y\) can make it easy to overlook that it represents a changing function rather than a fixed value. The chain rule makes that dependence explicit. It lets us differentiate powers, trigonometric expressions, and other functions of \(y\) while keeping track of how \(y\) changes with \(x\).

The pattern is consistent: identify the outer function, differentiate it with respect to its input, evaluate the result at \(y\), and multiply by \(dy/dx\). For example, a power uses the derivative of \(u^n\), while sine uses the derivative of \(\sin u\). In both cases the inner derivative is essential.

Check Your Understanding

For each question, remember that \(y\) is a differentiable function of \(x\).

  1. Write the derivative of \(y^2\) with respect to \(x\), including the inner derivative factor.
  2. Write the general chain-rule formula for the derivative of \(y^n\), where \(n\) is a positive integer.
  3. If \(y(1)=2\) and \(y'(1)=5\), what is the value of \(\frac{d}{dx}(y^2)\) at \(x=1\)?
  4. Differentiate \(\sin y\) with respect to \(x\).
  5. For \(y(x)=\frac{\pi}{6}+3x\), find \(\frac{d}{dx}(\sin y)\) at \(x=0\).

Test yourself: AP Calculus practice exams

Ready to check what you know? Work an AP-style practice exam, then open the full solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers all of AP Calculus AB & BC: full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon
Clinical Biostats