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[xcosx]=cosxxsinx\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)=cosxg(x) = \cos x, so f(x)=1f'(x) = 1 and g(x)=sinxg'(x) = -\sin x.

ddx(xcosx)=1cosx+x(sinx)=cosxxsinx\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)=sinxg'(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(sinx)=sinx1\cdot(-\sin x) = -\sin x. Test it at x=0x = 0: the real derivative is cos00=1\cos 0 - 0 = 1, while sin0=0-\sin 0 = 0. They disagree, so the shortcut is false.

The same expression appears in Unit 6, where xcosxdx\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 sinx-\sin x, multiplying the two derivatives instead of using the product rule.
  • Answering cosx+xsinx\cos x + x\sin x, forgetting that cosx\cos x differentiates to sinx-\sin x and losing the minus sign.
  • Answering cosxsinx\cos x - \sin x, dropping the xx that multiplies sinx\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(xcosx)=cosxxsinx\frac{d}{dx}(x\cos x) = \cos x - x\sin x. The product rule gives 1cosx+x(sinx)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: fg+fg=cosxxsinxf'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: xcosxdx=xsinx+cosx+C\int x\cos x\,dx = x\sin x + \cos x + C. Differentiating that result returns xcosxx\cos x.