AP Calculus AB and BC

Derivative of x^(sin x) by Log Differentiation

Logarithmic differentiation is the route that works, and it gives x^(sin x) times (cos x ln x + sin x / x), valid for x > 0. Base and exponent both contain x, so the power rule and the exponential rule are both off the table. Rewriting as e^(sin x ln x) reaches the same answer.

ddx[xsinx]=xsinx(cosxlnx+sinxx)\frac{d}{dx}\left[x^{\sin x}\right] = x^{\sin x}\left(\cos x\ln x + \frac{\sin x}{x}\right)

Neither standard rule applies

The power rule ddxxn=nxn1\frac{d}{dx}x^{n} = nx^{n-1} requires a constant exponent. The exponential rule ddxax=axlna\frac{d}{dx}a^{x} = a^{x}\ln a requires a constant base. In xsinxx^{\sin x} the base is xx and the exponent is sinx\sin x, so both requirements fail at once.

Applying either rule anyway gives a definite wrong answer, not an approximation. The power rule would give sinxxsinx1\sin x\cdot x^{\sin x-1} and the exponential rule would give xsinxlnxcosxx^{\sin x}\ln x\cdot\cos x. Neither is the derivative on its own, but together they are: xsinxlnxcosxx^{\sin x}\ln x\cos x is the first term of the correct answer, and sinxxsinx1\sin x\cdot x^{\sin x-1} rewrites as xsinxsinxxx^{\sin x}\cdot\frac{\sin x}{x}, which is the second.

So the correct derivative is exactly the sum of the two wrong answers, and that is no accident: for any function of the form xg(x)x^{g(x)} the true derivative is g(x)xg(x)1+xg(x)lnxg(x)g(x)\,x^{g(x)-1} + x^{g(x)}\ln x\cdot g'(x), one term from each rule. Knowing this is useful as a check. It is not a licence to use either rule alone, since either one on its own is missing half the answer.

Logarithmic differentiation step by step

Name the function y=xsinxy = x^{\sin x} and take the natural log of both sides. The log rule ln(ab)=blna\ln\left(a^{b}\right) = b\ln a pulls the exponent down into a product, which the product rule can handle.

lny=sinxlnx\ln y = \sin x\cdot\ln x

Differentiate both sides with respect to xx. The left side needs implicit differentiation, giving yy\frac{y'}{y}, and the right side is a product of sinx\sin x and lnx\ln x.

yy=cosxlnx+sinx1x\frac{y'}{y} = \cos x\ln x + \sin x\cdot\frac{1}{x}
y=xsinx(cosxlnx+sinxx)y' = x^{\sin x}\left(\cos x\ln x + \frac{\sin x}{x}\right)

The mistakes students make

Each of these produces a specific wrong expression that an exam reader will spot immediately.

  • Answering sinxxsinx1\sin x\cdot x^{\sin x-1} by treating sinx\sin x as a constant exponent. That expression is one of the two terms of the correct derivative, the xsinxsinxxx^{\sin x}\cdot\frac{\sin x}{x} piece in disguise, but half an answer is still wrong: at x=2x=2 it is about 0.850.85, while the true derivative is about 0.310.31.
  • Answering xsinxlnxcosxx^{\sin x}\ln x\cos x by treating xx as a constant base. That is the first term of the correct answer with the entire sinxx\frac{\sin x}{x} term missing.
  • Stopping at cosxlnx+sinxx\cos x\ln x + \frac{\sin x}{x}. That expression is yy\frac{y'}{y}, so it still has to be multiplied by y=xsinxy = x^{\sin x}.

Check yourself, not just the answer

Type derivatives and get graded on mathematical equivalence, with rule-level hints when you miss, in the Derivative Practice Checker.

Frequently asked questions

How do you differentiate x^sin x?

Take logs first. From y=xsinxy = x^{\sin x} you get lny=sinxlnx\ln y = \sin x\ln x, then yy=cosxlnx+sinxx\frac{y'}{y} = \cos x\ln x+\frac{\sin x}{x}, and multiplying by yy gives xsinx(cosxlnx+sinxx)x^{\sin x}\left(\cos x\ln x+\frac{\sin x}{x}\right).

Can you use the power rule on x^sin x?

No. The power rule only applies when the exponent is a constant. Here the exponent sinx\sin x varies with xx, so sinxxsinx1\sin x\cdot x^{\sin x-1} is not the derivative, although it does turn out to be one of its two terms.

What is the domain of x^sin x?

Take x>0x>0. The log step needs lnx\ln x to exist, and for negative bases a varying real exponent does not give real outputs in general. Nothing at or below zero qualifies, which is why 0.50.5, 1.21.2 and 22 are safe values to test.