Skip to content
ihateDesmos

Derivative of x sin x

Updated 6 November 2026 · Checked numerically by the ihateDesmos engine
The derivative of x sin x
ddx(xsin(x))=sin(x)+xcos(x)

The derivative of x sin x is sin x + x cos x. The first term comes from differentiating x, and the second from differentiating sin x.

−55−10100
Open in calculator
y=xsin(x)
in blue and its derivative
y=sin(x)+xcos(x)
in red.

How to find the derivative of x sin x

Method: product rule.

  1. 1
    Use the product rule, with f = x and g = sin x.
  2. 2
    f′ = 1 and g′ = cos x.
  3. 3
    So the derivative is 1 · sin x + x · cos x.
  4. 4
    That is sin x + x cos x.

What it means on the graph

x sin x oscillates between the lines y = x and y = −x, growing as it goes. The x cos x term dominates for large x, making the slopes steeper and steeper.

In the window shown, the derivative is zero at x = −7.97867, x = −4.91318, x = −2.02876, x = 0, x = 2.02876, x = 4.91318, x = 7.97867. Those are the points where the graph of x sin x has a horizontal tangent.

Table of values

The derivative column uses the formula. The last column estimates the slope directly from the original function, as an independent check.

Values of x sin x and its derivative
xx sin xsin x + x cos xSlope, measured
−π0ππ
−π/2π/2−1−1
0000
π/2π/211
π0−π−π

Second derivative

Differentiating once more gives:

d2dx2(xsin(x))=2cos(x)−xsin(x)

The second derivative tells you which way the graph bends: positive means it curves upward, and negative means it curves downward.

Common mistakes

  • Writing cos x alone, which forgets the product rule.

Frequently asked questions

What is the derivative of x sin x?
The derivative of x sin x is sin x + x cos x.
What is the second derivative of x sin x?
Differentiate sin x + x cos x again to get the second derivative. The result is shown on this page under “Second derivative”.

Keep going

Differentiate any function

Type your own function into the derivative calculator and see every rule applied, step by step.

Open the derivative calculator