Logarithmic Differentiation

The power rule handles x5x^5 (variable base, constant power) and the exponential rule handles 5x5^x (constant base, variable power). But what about xsin⁡xx^{\sin x} — variable to a variable power? Neither rule applies. The escape is to take logarithms first.

For y=[u(x)]v(x)y = [u(x)]^{v(x)}:

  1. Take logs: log⁡y=v(x)log⁡u(x)\log y = v(x)\log u(x) — the awkward power becomes an ordinary product.
  2. Differentiate both sides (chain rule on the left, product rule on the right): 1ydydx=v(x)⋅u′(x)u(x)+v′(x)log⁡u(x)\frac{1}{y}\frac{dy}{dx} = v(x)\cdot\frac{u'(x)}{u(x)} + v'(x)\log u(x)
  3. Multiply back by yy:   dydx=y[v(x)u(x)u′(x)+v′(x)log⁡u(x)]  \boxed{\;\frac{dy}{dx} = y\left[\frac{v(x)}{u(x)}u'(x) + v'(x)\log u(x)\right]\;}

The fine print: f(x)f(x) and u(x)u(x) must be positive — otherwise their logarithms are undefined and the whole method has no meaning. Exam problems supply the interval (e.g. x>0x > 0 for xsin⁡xx^{\sin x}) precisely for this reason.

Two instant corollaries

Constant base: y=axy = a^x (a>0a > 0): log⁡y=xlog⁡a\log y = x\log a, so ddx(ax)=axlog⁡a\frac{d}{dx}\left(a^x\right) = a^x \log a

The classic xxx^x: log⁡y=xlog⁡x\log y = x \log x, so 1yy′=log⁡x+1\frac{1}{y}y' = \log x + 1 and ddx(xx)=xx(1+log⁡x)\frac{d}{dx}\left(x^x\right) = x^x(1 + \log x)

Products and quotients love logarithms too

Even with no variable powers in sight, logs turn heavy products into light sums. For y=(x−3)(x2+4)3x2+4x+5y = \frac{(x-3)(x^2+4)}{3x^2+4x+5} under a square root, taking logs gives log⁡y=12[log⁡(x−3)+log⁡(x2+4)−log⁡(3x2+4x+5)]\log y = \frac{1}{2}\left[\log(x-3) + \log(x^2+4) - \log(3x^2+4x+5)\right] and differentiating term by term beats any quotient-rule slog. The keep-it-straight table:

Shape Tool
xax^a (constant power) power rule: axa−1ax^{a-1}
axa^x (constant base) axlog⁡aa^x\log a
u(x)v(x)u(x)^{v(x)} (both vary) logarithmic differentiation
big products/quotients logs first, then term-by-term

Solved Examples

Example 1 — The constant-base corollary

Differentiate axa^x w.r.t. xx, where aa is a positive constant.

Step 1 — take logs: log⁡y=xlog⁡a\log y = x\log a.

Step 2 — differentiate: 1ydydx=log⁡a\frac{1}{y}\frac{dy}{dx} = \log a.

Answer: dydx=axlog⁡a\frac{dy}{dx} = a^x\log a. (Alternatively, ax=exlog⁡aa^x = e^{x\log a} and one chain-rule link gives the same.) In particular ddx2x=2xlog⁡2\frac{d}{dx}2^x = 2^x\log 2 — and for a=ea = e, log⁡e=1\log e = 1 recovers ddxex=ex\frac{d}{dx}e^x = e^x.

Example 2 — The flagship xsin⁡xx^{\sin x}

Differentiate xsin⁡xx^{\sin x}, x>0x > 0, w.r.t. xx.

Step 1 — take logs: log⁡y=sin⁡xlog⁡x\log y = \sin x \log x.

Step 2 — product rule on the right: 1ydydx=cos⁡xlog⁡x+sin⁡xx\frac{1}{y}\frac{dy}{dx} = \cos x \log x + \frac{\sin x}{x}.

Step 3 — multiply back: dydx=xsin⁡x(cos⁡xlog⁡x+sin⁡xx)\frac{dy}{dx} = x^{\sin x}\left(\cos x \log x + \frac{\sin x}{x}\right)

Answer: as displayed — the answer always carries the original y=xsin⁡xy = x^{\sin x} out front.

Example 3 — A square root of a rational product

Differentiate (x−3)(x2+4)3x2+4x+5\sqrt{\dfrac{(x-3)(x^2+4)}{3x^2+4x+5}} w.r.t. xx.

Step 1 — take logs (the root becomes 12\frac{1}{2}, the product a sum): log⁡y=12[log⁡(x−3)+log⁡(x2+4)−log⁡(3x2+4x+5)]\log y = \frac{1}{2}\left[\log(x-3) + \log(x^2+4) - \log(3x^2+4x+5)\right]

Step 2 — differentiate term by term: 1ydydx=12[1x−3+2xx2+4−6x+43x2+4x+5]\frac{1}{y}\frac{dy}{dx} = \frac{1}{2}\left[\frac{1}{x-3} + \frac{2x}{x^2+4} - \frac{6x+4}{3x^2+4x+5}\right]

Step 3 — multiply back by yy: dydx=12(x−3)(x2+4)3x2+4x+5[1x−3+2xx2+4−6x+43x2+4x+5]\frac{dy}{dx} = \frac{1}{2}\sqrt{\frac{(x-3)(x^2+4)}{3x^2+4x+5}}\left[\frac{1}{x-3} + \frac{2x}{x^2+4} - \frac{6x+4}{3x^2+4x+5}\right]

Answer: as displayed — three logarithm laws (root, product, quotient) converted a quotient-rule nightmare into three easy fractions.

Example 4 — Powers of a logarithm

Differentiate (log⁡x)cos⁡x(\log x)^{\cos x}, x>1x > 1, w.r.t. xx.

Step 1 — take logs: log⁡y=cos⁡xlog⁡(log⁡x)\log y = \cos x \log(\log x).

Step 2 — differentiate (product rule + chain rule): 1ydydx=−sin⁡xlog⁡(log⁡x)+cos⁡x⋅1log⁡x⋅1x\frac{1}{y}\frac{dy}{dx} = -\sin x \log(\log x) + \cos x \cdot \frac{1}{\log x}\cdot\frac{1}{x}

Answer: dydx=(log⁡x)cos⁡x[cos⁡xxlog⁡x−sin⁡xlog⁡(log⁡x)]\dfrac{dy}{dx} = (\log x)^{\cos x}\left[\dfrac{\cos x}{x\log x} - \sin x\log(\log x)\right] — same template, exotic-looking base.

Example 5 — A three-factor product, no variable powers

Differentiate y=(x+3)2(x+4)3(x+5)4y = (x+3)^2(x+4)^3(x+5)^4 w.r.t. xx.

Step 1 — take logs: log⁡y=2log⁡(x+3)+3log⁡(x+4)+4log⁡(x+5)\log y = 2\log(x+3) + 3\log(x+4) + 4\log(x+5).

Step 2 — differentiate: 1ydydx=2x+3+3x+4+4x+5\frac{1}{y}\frac{dy}{dx} = \frac{2}{x+3} + \frac{3}{x+4} + \frac{4}{x+5}.

Answer: dydx=(x+3)2(x+4)3(x+5)4[2x+3+3x+4+4x+5]\dfrac{dy}{dx} = (x+3)^2(x+4)^3(x+5)^4\left[\dfrac{2}{x+3} + \dfrac{3}{x+4} + \dfrac{4}{x+5}\right] — a triple product rule condensed into one line of fractions.

Example 6 — Mixed implicit and logarithmic

Find dydx\dfrac{dy}{dx} if yx+xy+xx=aby^x + x^y + x^x = a^b, for x,y>0x, y > 0.

Step 1 — differentiate each term with its own log-trick: writing u=yxu = y^x, v=xyv = x^y, w=xxw = x^x: dudx=yx(log⁡y+xydydx),dvdx=xy(yx+log⁡xdydx),dwdx=xx(1+log⁡x)\frac{du}{dx} = y^x\left(\log y + \frac{x}{y}\frac{dy}{dx}\right), \quad \frac{dv}{dx} = x^y\left(\frac{y}{x} + \log x \frac{dy}{dx}\right), \quad \frac{dw}{dx} = x^x(1 + \log x)

Step 2 — the right side is constant: the three derivatives sum to 00.

Step 3 — collect the dydx\frac{dy}{dx} terms: dydx=−yxlog⁡y+y xy−1+xx(1+log⁡x)x yx−1+xylog⁡x\frac{dy}{dx} = -\frac{y^x\log y + y\,x^{y-1} + x^x(1 + \log x)}{x\,y^{x-1} + x^y\log x}

Answer: as displayed — each exotic power gets logged separately, then ordinary implicit collection finishes the job.