Tutorials › Calculus I › Implicit Logarithmic Differentiation with y in the Exponent

Exponential and Logarithmic Derivatives · Tutorial 555 of 1495

Implicit Logarithmic Differentiation with y in the Exponent

Use logarithms and implicit differentiation to find the slope of curves such as y^x = x^y, while recognizing when the slope formula is defined.

Intermediate 9 min read

What You'll Learn

  • Rewrite equations with variable exponents using natural logarithms.
  • Differentiate expressions such as x ln y and y ln x when y depends on x.
  • Solve the resulting equation for dy/dx.
  • Check a proposed point against the original relation before finding its slope.
  • Identify when the formula for dy/dx has a zero denominator.

Why Take Logarithms Before Differentiating?

An equation can involve the variable \(y\) both as a base and as an exponent. For example, in \(y^x=x^y\), neither side is an ordinary power with a constant exponent. If \(y\) depends on \(x\), both the base and exponent vary as \(x\) changes.

Taking natural logarithms turns variable powers into products. The resulting equation is usually easier to differentiate, although it still requires the product rule and the chain rule. The main task is to keep track of every occurrence of \(y\) as a function of \(x\), then solve the differentiated equation for \(dy/dx\).

Key idea: For positive \(x\) and \(y\), the equation \(y^x=x^y\) is equivalent to \(x\ln y=y\ln x\). Differentiate this logarithmic relation implicitly, treating \(y\) as a function of \(x\).

Logarithms of Both Sides

For the real-valued logarithmic method used here, take \(x>0\) and \(y>0\). Then both sides of \(y^x=x^y\) are positive, and the natural logarithm is defined. Since \(\ln\) is one-to-one on the positive real numbers, taking logarithms preserves equivalence:

$$ y^x=x^y \quad\Longleftrightarrow\quad \ln(y^x)=\ln(x^y) \quad\Longleftrightarrow\quad x\ln y=y\ln x. $$

The last equivalence uses the logarithm rule \(\ln(a^b)=b\ln a\) for positive \(a\). Once the equation is written in this form, suppose \(y=y(x)\) is differentiable. Both \(x\) and \(y\) vary, so the product rule applies to each side.

$$ \frac{d}{dx}(x\ln y) = \ln y+x\frac{1}{y}\frac{dy}{dx}, \qquad \frac{d}{dx}(y\ln x) = \frac{dy}{dx}\ln x+\frac{y}{x}. $$

The factor \(1/y\) in the first derivative comes from differentiating \(\ln y\) by the chain rule. The term \(y/x\) in the second derivative comes from differentiating \(\ln x\), while \(y\) is the other factor.

Deriving the Slope Formula

Equating the derivatives gives an equation that is linear in \(dy/dx\). Collect the terms containing \(dy/dx\) on one side:

$$ \ln y+x\frac{1}{y}\frac{dy}{dx} = \frac{dy}{dx}\ln x+\frac{y}{x}, $$
$$ \left(\frac{x}{y}-\ln x\right)\frac{dy}{dx} = \frac{y}{x}-\ln y. $$

If the coefficient \(x/y-\ln x\) is nonzero, division by that coefficient gives the slope. The condition matters: division by zero is not valid, and at a point where the coefficient vanishes this calculation does not determine \(dy/dx\).

Formula: If \(x>0\), \(y>0\), \(y=y(x)\) is differentiable, \(y^x=x^y\), and \(x/y-\ln x\ne 0\), then $$ \frac{dy}{dx} = \frac{y/x-\ln y}{x/y-\ln x}. $$

This derivation also explains why the method works. On the positive domain, the logarithmic equation describes exactly the same relation as the original equation. Differentiating that equivalent relation gives a necessary equation for the slope of any differentiable solution \(y(x)\). Solving it yields the formula wherever its coefficient is nonzero.

Worked Examples

Worked Example: The Diagonal Solution at (2, 2)

Find the slope for a differentiable solution of \(y^x=x^y\) through \((2,2)\). First check the point in the original equation:

$$ 2^2=4 \qquad\text{and}\qquad 2^2=4. $$

Thus the point satisfies the relation. Write \(m=dy/dx\) at the point and use the logarithmically transformed equation. At \(x=2,\ y=2\), the differentiated equation is

$$ \ln 2+\frac{2}{2}m = m\ln 2+\frac{2}{2}. $$

Rearrange and solve:

$$ \ln 2+m=m\ln 2+1, \qquad m(1-\ln 2)=1-\ln 2. $$

Since \(\ln 2\ne1\), divide by \(1-\ln 2\) to obtain \(m=1\). Check by substitution into the differentiated equation: its left side is \(\ln 2+1\), and its right side is \(\ln 2+1\), as required. In fact, \(y=x\) is a solution for every positive \(x\), and its derivative is \(1\).

Worked Example: Finding the Slope at (2, 4)

Find \(dy/dx\) for a differentiable solution through \((2,4)\). Check the original relation first:

$$ 4^2=16 \qquad\text{and}\qquad 2^4=16. $$

The point lies on the curve. Let \(m=dy/dx\) there. Substituting \(x=2,\ y=4\) into the differentiated logarithmic relation gives

$$ \ln 4+\frac{2}{4}m = m\ln 2+\frac{4}{2}. $$

Use \(\ln 4=2\ln 2\), and write \(L=\ln 2\) temporarily to make the algebra easier to read:

$$ 2L+\frac{m}{2}=mL+2, \qquad m\left(\frac{1}{2}-L\right)=2-2L. $$

Because \(1/2-\ln 2\ne0\), solve for \(m\):

$$ m = \frac{2-2\ln 2}{\frac{1}{2}-\ln 2}. $$

To check, substitute this value into the equation for \(m\): multiplying the displayed expression for \(m\) by \(1/2-\ln 2\) gives \(2-2\ln 2\), exactly the right-hand side. The original differentiated equation is therefore satisfied. The slope is negative because \(2-2\ln 2>0\), while \(1/2-\ln 2<0\).

Worked Example: Finding the Slope at (4, 2)

Now find the slope at \((4,2)\). Verify that the point is on the relation:

$$ 2^4=16 \qquad\text{and}\qquad 4^2=16. $$

Set \(m=dy/dx\). Substitution into the differentiated equation gives

$$ \ln 2+\frac{4}{2}m = m\ln 4+\frac{2}{4}. $$

Using \(\ln 4=2\ln 2\), rearrange to isolate \(m\):

$$ \ln 2+2m=2m\ln 2+\frac{1}{2}, $$
$$ m(2-2\ln 2)=\frac{1}{2}-\ln 2, \qquad m=\frac{\frac{1}{2}-\ln 2}{2-2\ln 2}. $$

The denominator is nonzero because \(\ln 2\ne1\). For the check, multiplying this value of \(m\) by \(2-2\ln 2\) gives \(1/2-\ln 2\), so the rearranged differentiated equation holds. Substituting back into the previous line gives equal left and right sides. This slope differs from the one at \((2,4)\), even though the two points exchange their coordinates.

When the Formula Cannot Be Used

The formula has a denominator, so it is not valid when \(x/y-\ln x=0\). At such a point, the differentiated relation becomes

$$ 0\cdot\frac{dy}{dx}=\frac{y}{x}-\ln y. $$

This equation either creates a contradiction or gives no value for the slope; it cannot be solved by dividing by the zero coefficient. For example, at \((e,e)\), both sides of the slope equation are zero. The formula becomes \(0/0\), which is undefined. This calculation alone does not determine a slope there; a separate analysis of the local relation would be needed.

By contrast, at a diagonal point \((a,a)\) with \(a>0\) and \(a\ne e\), the numerator and denominator of the formula are both \(1-\ln a\), which is nonzero. The formula therefore gives \(dy/dx=1\), consistent with the solution \(y=x\). It is important to distinguish this case from \((e,e)\), where division by \(1-\ln a\) would mean division by zero.

A Common Mistake: Dropping a Product-Rule Term

A frequent error is to differentiate \(y\ln x\) as though \(y\) were constant. That misses the derivative of \(y\). The product rule gives

$$ \frac{d}{dx}(y\ln x) = \frac{dy}{dx}\ln x+\frac{y}{x}, $$

not just \(y/x\) or just \((dy/dx)\ln x\). For a concrete example, at \((2,4)\), omitting the term \(\ln 4\) on the left would incorrectly produce

$$ \frac{m}{2}=m\ln 2+2, \qquad m=\frac{2}{\frac{1}{2}-\ln 2}. $$

That is not the correct equation: differentiating \(x\ln y\) also contributes \(\ln y=\ln 4\). The correct equation is

$$ \ln 4+\frac{m}{2}=m\ln 2+2, $$

which gives \(m=(2-2\ln 2)/(1/2-\ln 2)\), not \(2/(1/2-\ln 2)\). The omitted term changes the answer, so writing each product-rule derivative before collecting terms is a useful safeguard.

A Reliable Calculation Order

1
Check the point and positivity.
Confirm that the proposed \(x,y\) satisfy the original equation and are positive so the logarithms are defined.
2
Take logarithms.
For \(y^x=x^y\), rewrite the equation as \(x\ln y=y\ln x\).
3
Differentiate implicitly.
Use the product rule on both sides, and use the chain rule when differentiating \(\ln y\).
4
Isolate and check the derivative.
Collect the terms involving \(dy/dx\), verify the coefficient is nonzero before dividing, and substitute the result into the differentiated equation.

The same approach applies to other positive variable-power relations: take logarithms to expose the exponent as a factor, differentiate while treating \(y\) as a function of \(x\), and solve the resulting linear equation for \(dy/dx\) when its coefficient is nonzero. The exact logarithmic equation depends on the relation, so it should be written before differentiating rather than inferred from the final formula.

Check Your Understanding

For each question, keep the logarithmic transformation and the condition for division in view.

  1. Starting from \(y^x=x^y\) with \(x,y>0\), write the equivalent equation obtained by taking natural logarithms.
  2. Differentiate \(x\ln y=y\ln x\), treating \(y\) as a differentiable function of \(x\).
  3. At \((2,4)\), why must the term \(\ln 4\) appear when differentiating \(x\ln y\)?
  4. What condition allows the equation for \(dy/dx\) to be solved by division?
  5. Why does the formula give no slope at \((e,e)\)?

Test yourself: Calculus I final exam practice

Ready to check what you know? Work a full-length practice final, then open the complete worked solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): 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