AP Calculus AB and BC

Derivative of x cos x: Answer, Product Rule, Mistakes

The derivative of x cos x with respect to x is cos x minus x sin x. This needs the product rule, because the expression is a product of two functions that each depend on x. The derivative of a product is never the product of the derivatives, so the answer is cos x - x sin x, not -sin x.

ddx[xcos⁡x]=cos⁡x−xsin⁡x\frac{d}{dx}\left[x\cos x\right] = \cos x - x\sin x

How to differentiate x cos x

The product rule differentiates one factor at a time, holding the other fixed, and adds the two results.

ddx[f(x)g(x)]=f′(x)g(x)+f(x)g′(x)\frac{d}{dx}\left[f(x)g(x)\right] = f'(x)g(x) + f(x)g'(x)

Take f(x)=xf(x) = x and g(x)=cos⁡xg(x) = \cos x, so f′(x)=1f'(x) = 1 and g′(x)=−sin⁡xg'(x) = -\sin x.

ddx(xcos⁡x)=1⋅cos⁡x+x⋅(−sin⁡x)=cos⁡x−xsin⁡x\frac{d}{dx}\left(x\cos x\right) = 1\cdot\cos x + x\cdot(-\sin x) = \cos x - x\sin x

Where the minus sign comes from

The subtraction is not part of the product rule itself, which only adds. It appears because g′(x)=−sin⁡xg'(x) = -\sin x carries its own minus sign from differentiating cosine.

Why the product rule is necessary

If the derivative of a product were the product of the derivatives, the answer would be 1⋅(−sin⁡x)=−sin⁡x1\cdot(-\sin x) = -\sin x. Test it at x=0x = 0: the real derivative is cos⁡0−0=1\cos 0 - 0 = 1, while −sin⁡0=0-\sin 0 = 0. They disagree, so the shortcut is false.

The same expression appears in Unit 6, where ∫xcos⁡x dx\int x\cos x\,dx needs integration by parts, the product rule run in reverse.

Where the derivative of x cos x shows up on the AP exam

The product rule is Topic 2.8, on both AB and BC. A polynomial times a trigonometric function is a standard example, because one factor differentiates to 11 and the structure of the rule stays visible.

Common mistakes with the derivative of x cos x

  • Answering −sin⁡x-\sin x, multiplying the two derivatives instead of using the product rule.
  • Answering cos⁡x+xsin⁡x\cos x + x\sin x, forgetting that cos⁡x\cos x differentiates to −sin⁡x-\sin x and losing the minus sign.
  • Answering cos⁡x−sin⁡x\cos x - \sin x, dropping the xx that multiplies sin⁡x\sin x in the second term.

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

What is the derivative of x cos x?

ddx(xcos⁡x)=cos⁡x−xsin⁡x\frac{d}{dx}(x\cos x) = \cos x - x\sin x. The product rule gives 1⋅cos⁡x+x⋅(−sin⁡x)1\cdot\cos x + x\cdot(-\sin x), and the second term inherits the minus sign from the derivative of cosine.

Why isn't the answer just -sin x?

Because the derivative of a product is not the product of the derivatives. You must keep each factor once undifferentiated: f′g+fg′=cos⁡x−xsin⁡xf'g + fg' = \cos x - x\sin x, which checks out at x=0x = 0, where it equals 11.

How do you integrate x cos x?

Use integration by parts, the reverse of the product rule: ∫xcos⁡x dx=xsin⁡x+cos⁡x+C\int x\cos x\,dx = x\sin x + \cos x + C. Differentiating that result returns xcos⁡xx\cos x.