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[xsin⁡x]=xsin⁡x(cos⁡xln⁡x+sin⁡xx)\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=nxn−1\frac{d}{dx}x^{n} = nx^{n-1} requires a constant exponent. The exponential rule ddxax=axln⁡a\frac{d}{dx}a^{x} = a^{x}\ln a requires a constant base. In xsin⁡xx^{\sin x} the base is xx and the exponent is sin⁡x\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 sin⁡x⋅xsin⁡x−1\sin x\cdot x^{\sin x-1} and the exponential rule would give xsin⁡xln⁡x⋅cos⁡xx^{\sin x}\ln x\cdot\cos x. Neither is the derivative on its own, but together they are: xsin⁡xln⁡xcos⁡xx^{\sin x}\ln x\cos x is the first term of the correct answer, and sin⁡x⋅xsin⁡x−1\sin x\cdot x^{\sin x-1} rewrites as xsin⁡x⋅sin⁡xxx^{\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)ln⁡x⋅g′(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=xsin⁡xy = x^{\sin x} and take the natural log of both sides. The log rule ln⁡(ab)=bln⁡a\ln\left(a^{b}\right) = b\ln a pulls the exponent down into a product, which the product rule can handle.

ln⁡y=sin⁡x⋅ln⁡x\ln y = \sin x\cdot\ln x

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

y′y=cos⁡xln⁡x+sin⁡x⋅1x\frac{y'}{y} = \cos x\ln x + \sin x\cdot\frac{1}{x}
y′=xsin⁡x(cos⁡xln⁡x+sin⁡xx)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 sin⁡x⋅xsin⁡x−1\sin x\cdot x^{\sin x-1} by treating sin⁡x\sin x as a constant exponent. That expression is one of the two terms of the correct derivative, the xsin⁡x⋅sin⁡xxx^{\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 xsin⁡xln⁡xcos⁡xx^{\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 sin⁡xx\frac{\sin x}{x} term missing.
  • Stopping at cos⁡xln⁡x+sin⁡xx\cos x\ln x + \frac{\sin x}{x}. That expression is y′y\frac{y'}{y}, so it still has to be multiplied by y=xsin⁡xy = 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=xsin⁡xy = x^{\sin x} you get ln⁡y=sin⁡xln⁡x\ln y = \sin x\ln x, then y′y=cos⁡xln⁡x+sin⁡xx\frac{y'}{y} = \cos x\ln x+\frac{\sin x}{x}, and multiplying by yy gives xsin⁡x(cos⁡xln⁡x+sin⁡xx)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 sin⁡x\sin x varies with xx, so sin⁡x⋅xsin⁡x−1\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 ln⁡x\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.