24.6 Implicit Differentiation

AHL 5.14

In this section you will learn
  • the difference between explicit and implicit equations
  • how to find \(\dfrac{\mathrm{d}y}{\mathrm{d}x}\) by implicit differentiation
  • how to differentiate functions like \(x^{3x}\) by taking logarithms first

Explicit and implicit equations

An equation is explicit when \(y\) is given directly in terms of \(x\), for example

\[ y = 3x^2 - x, \qquad y = \frac{x + 1}{x - 4}, \qquad y = \ln(2x + 5) . \]

An equation is implicit when \(x\) and \(y\) are mixed together and \(y\) is not the subject. Often it is difficult, or impossible, to make \(y\) the subject:

\[ x^2 + xy + y^2 = 7, \qquad y^3 + 2y = x^4, \qquad \sin(xy) = x - y . \]

We can still find \(\dfrac{\mathrm{d}y}{\mathrm{d}x}\). We think of \(y\) as a function of \(x\) and differentiate every term with respect to \(x\).

Implicit differentiation

The key idea is the chain rule. To differentiate a term in \(y\) with respect to \(x\), differentiate with respect to \(y\), then multiply by \(\dfrac{\mathrm{d}y}{\mathrm{d}x}\):

Differentiating terms in \(y\) with respect to \(x\) Not in the formula booklet

\[ \frac{\mathrm{d}}{\mathrm{d}x}\big(g(y)\big) = g'(y)\,\frac{\mathrm{d}y}{\mathrm{d}x} \] for example \[ \frac{\mathrm{d}}{\mathrm{d}x}\left(y^3\right) = 3y^2\frac{\mathrm{d}y}{\mathrm{d}x}, \qquad \frac{\mathrm{d}}{\mathrm{d}x}(\sin y) = \cos y\,\frac{\mathrm{d}y}{\mathrm{d}x} \]

A term with both \(x\) and \(y\), such as \(xy\), needs the product rule: \(\;\dfrac{\mathrm{d}}{\mathrm{d}x}(xy) = x\dfrac{\mathrm{d}y}{\mathrm{d}x} + y\).

  • \(y\): a function of \(x\) (we do not know it explicitly)
  • \(g\): a function of \(y\)
  • \(g'(y)\): the derivative of \(g\) with respect to \(y\)

The method:

  1. Differentiate both sides of the equation with respect to \(x\).
  2. Collect all the terms with \(\dfrac{\mathrm{d}y}{\mathrm{d}x}\) on one side.
  3. Factorise out \(\dfrac{\mathrm{d}y}{\mathrm{d}x}\) and divide.

The answer usually contains both \(x\) and \(y\).

Example 1 Find \(\dfrac{\mathrm{d}y}{\mathrm{d}x}\) for the curve \(2x^3 + y^2 - 5y = 4\).

Differentiate each term with respect to \(x\):

\[ 6x^2 + 2y\frac{\mathrm{d}y}{\mathrm{d}x} - 5\frac{\mathrm{d}y}{\mathrm{d}x} = 0 . \]

\[ (2y - 5)\frac{\mathrm{d}y}{\mathrm{d}x} = -6x^2 \qquad\Rightarrow\qquad \frac{\mathrm{d}y}{\mathrm{d}x} = \frac{6x^2}{5 - 2y} . \]

Example 2 Find an expression for \(\dfrac{\mathrm{d}y}{\mathrm{d}x}\) in terms of \(x\) and \(y\).

(a) \(x^3 + 2y^3 = 5xy\) \(\qquad\) (b) \(y\sin x = x^2 + y^2\)

(a) The right side needs the product rule:

\[ 3x^2 + 6y^2\frac{\mathrm{d}y}{\mathrm{d}x} = 5x\frac{\mathrm{d}y}{\mathrm{d}x} + 5y \qquad\Rightarrow\qquad (6y^2 - 5x)\frac{\mathrm{d}y}{\mathrm{d}x} = 5y - 3x^2 \qquad\Rightarrow\qquad \frac{\mathrm{d}y}{\mathrm{d}x} = \frac{5y - 3x^2}{6y^2 - 5x} . \]

(b) The left side is a product of \(y\) and \(\sin x\):

\[ \sin x\,\frac{\mathrm{d}y}{\mathrm{d}x} + y\cos x = 2x + 2y\frac{\mathrm{d}y}{\mathrm{d}x} \qquad\Rightarrow\qquad (\sin x - 2y)\frac{\mathrm{d}y}{\mathrm{d}x} = 2x - y\cos x \]

\[ \frac{\mathrm{d}y}{\mathrm{d}x} = \frac{2x - y\cos x}{\sin x - 2y} . \]

To find the gradient at a point, substitute both coordinates.

Example 3 The curve \(x^2 + xy + y^2 = 7\) is shown in Figure 1.

(a) Show that the point \((1,\,2)\) lies on the curve.

(b) Find the gradient of the curve at \((1,\,2)\).

Figure 1: The curve \(x^2 + xy + y^2 = 7\) and its tangent at \((1,\,2)\).

(a) \(1^2 + 1 \times 2 + 2^2 = 1 + 2 + 4 = 7\) ✓.

(b) \(\;2x + \left(x\dfrac{\mathrm{d}y}{\mathrm{d}x} + y\right) + 2y\dfrac{\mathrm{d}y}{\mathrm{d}x} = 0\), so

\[ \frac{\mathrm{d}y}{\mathrm{d}x} = -\frac{2x + y}{x + 2y} . \]

At \((1,\,2)\): \(\;\dfrac{\mathrm{d}y}{\mathrm{d}x} = -\dfrac{2 + 2}{1 + 4} = -\dfrac{4}{5}\).

Tangents and normals to implicit curves are in Unit 25.

Logarithmic differentiation

How do we differentiate \(y = x^{3x}\)? It is not \(x^n\) (the power is not constant) and not \(a^x\) (the base is not constant). Take the natural logarithm of both sides first, then use implicit differentiation.

Example 4 Differentiate with respect to \(x\):

(a) \(y = x^{3x}\), \(\;x > 0\)

(b) \(y = (\sin x)^x\), \(\;0 < x < \pi\)

(a) \(\ln y = \ln x^{3x} = 3x\ln x\). Differentiate both sides with respect to \(x\):

\[ \frac{1}{y}\frac{\mathrm{d}y}{\mathrm{d}x} = 3\ln x + 3x \cdot \frac{1}{x} = 3\ln x + 3 \qquad\Rightarrow\qquad \frac{\mathrm{d}y}{\mathrm{d}x} = 3x^{3x}(\ln x + 1) . \]

(b) \(\ln y = x\ln(\sin x)\). Differentiate:

\[ \frac{1}{y}\frac{\mathrm{d}y}{\mathrm{d}x} = \ln(\sin x) + x \cdot \frac{\cos x}{\sin x} = \ln(\sin x) + x\cot x \]

\[ \frac{\mathrm{d}y}{\mathrm{d}x} = (\sin x)^x\big(\ln(\sin x) + x\cot x\big) . \]

Common errors

✗ Wrong ✓ Right Why
\(\dfrac{\mathrm{d}}{\mathrm{d}x}\left(y^2\right) = 2y\) \(2y\dfrac{\mathrm{d}y}{\mathrm{d}x}\) \(y\) is a function of \(x\): use the chain rule.
\(\dfrac{\mathrm{d}}{\mathrm{d}x}(xy) = \dfrac{\mathrm{d}y}{\mathrm{d}x}\) \(x\dfrac{\mathrm{d}y}{\mathrm{d}x} + y\) \(xy\) is a product.
\(x^2 + y^2 = 25 \Rightarrow 2x + 2y\dfrac{\mathrm{d}y}{\mathrm{d}x} = 25\) \(\ldots = 0\) The constant \(25\) differentiates to \(0\).
\(\dfrac{\mathrm{d}}{\mathrm{d}x}\left(x^{3x}\right) = 3x \cdot x^{3x - 1}\) \(3x^{3x}(\ln x + 1)\) The power is not constant: take logs first.

Exercises

1 For the circle \(x^2 + y^2 = 25\), find \(\dfrac{\mathrm{d}y}{\mathrm{d}x}\) in terms of \(x\) and \(y\), and the gradient at \((3,\,-4)\).

\(2x + 2y\dfrac{\mathrm{d}y}{\mathrm{d}x} = 0\), so \(\dfrac{\mathrm{d}y}{\mathrm{d}x} = -\dfrac{x}{y}\). At \((3,\,-4)\): \(\;-\dfrac{3}{-4} = \dfrac{3}{4}\).

2 Find \(\dfrac{\mathrm{d}y}{\mathrm{d}x}\) for \(x^2y + y^3 = 10\).

\(2xy + x^2\dfrac{\mathrm{d}y}{\mathrm{d}x} + 3y^2\dfrac{\mathrm{d}y}{\mathrm{d}x} = 0\), so \(\dfrac{\mathrm{d}y}{\mathrm{d}x} = -\dfrac{2xy}{x^2 + 3y^2}\).

3 Find \(\dfrac{\mathrm{d}y}{\mathrm{d}x}\) for \(\mathrm{e}^y = x^2 + y\).

\(\mathrm{e}^y\dfrac{\mathrm{d}y}{\mathrm{d}x} = 2x + \dfrac{\mathrm{d}y}{\mathrm{d}x}\), so \((\mathrm{e}^y - 1)\dfrac{\mathrm{d}y}{\mathrm{d}x} = 2x\) and \(\dfrac{\mathrm{d}y}{\mathrm{d}x} = \dfrac{2x}{\mathrm{e}^y - 1}\).

4 The curve \(x^3 + y^3 - 3xy = 3\) passes through a point with \(x = 1\) and \(y > 0\). Find the \(y\)-coordinate of this point and the gradient of the curve there.

\(x = 1\): \(\;1 + y^3 - 3y = 3 \Rightarrow y^3 - 3y - 2 = 0 \Rightarrow (y - 2)(y + 1)^2 = 0\). Since \(y > 0\), \(y = 2\).

\(3x^2 + 3y^2\dfrac{\mathrm{d}y}{\mathrm{d}x} - 3y - 3x\dfrac{\mathrm{d}y}{\mathrm{d}x} = 0 \Rightarrow \dfrac{\mathrm{d}y}{\mathrm{d}x} = \dfrac{y - x^2}{y^2 - x}\).

At \((1,\,2)\): \(\;\dfrac{2 - 1}{4 - 1} = \dfrac{1}{3}\).

5 Given \(\tan y = x^2 + y\), show that \(\dfrac{\mathrm{d}y}{\mathrm{d}x} = 2x\cot^2 y\).

\(\sec^2 y\,\dfrac{\mathrm{d}y}{\mathrm{d}x} = 2x + \dfrac{\mathrm{d}y}{\mathrm{d}x} \Rightarrow (\sec^2 y - 1)\dfrac{\mathrm{d}y}{\mathrm{d}x} = 2x\).

Since \(\sec^2 y - 1 = \tan^2 y\): \(\;\dfrac{\mathrm{d}y}{\mathrm{d}x} = \dfrac{2x}{\tan^2 y} = 2x\cot^2 y\).

6 Use logarithmic differentiation to find \(\dfrac{\mathrm{d}y}{\mathrm{d}x}\) for \(y = x^{\ln x}\), \(\;x > 0\).

\(\ln y = \ln x \cdot \ln x = (\ln x)^2\). Then \(\dfrac{1}{y}\dfrac{\mathrm{d}y}{\mathrm{d}x} = \dfrac{2\ln x}{x}\), so

\[ \frac{\mathrm{d}y}{\mathrm{d}x} = \frac{2\ln x}{x}\,x^{\ln x} . \]