Derivative of $x\,\cos\left(x\right)$

Differentiated with respect to x. Edit the function · Differentiation rules

Step-by-step solution

Input function
$$x\,\cos\left(x\right)$$

Start of the differentiation
$$\frac{d}{dx}{\left[x\,\cos\left(x\right)\right]}$$

Yellow: the expression being replaced. Green: its replacement.

Step 1 — Product Rule Differentiation rule
📖 Rule
$$\frac{d}{dx}(u \cdot v)=u'v+uv'$$
With:
  • $u = x$
  • $v = \cos\left(x\right)$

Why: First, differentiate the first factor and multiply by the unchanged second factor. Add the unchanged first factor times the derivative of the second. Do not simply multiply the two derivatives.

🧮 Current expression
$$\bbox[#fff1b8, padding:0.15em]{{\color{black}{\vphantom{\dfrac{d}{dx}}\,\frac{d}{dx}{\left[x\,\cos\left(x\right)\right]}\,}}}$$
✨ After: Product Rule
$$\bbox[#d6f5df, padding:0.15em]{{\color{black}{\vphantom{\dfrac{d}{dx}}\,\frac{d}{dx}{\left[x\right]}\,\cos\left(x\right) + x\,\frac{d}{dx}{\left[\cos\left(x\right)\right]}\,}}}$$
Step 2 — Derivative of a Variable Differentiation rule
📖 Rule
$$\frac{d}{dx}(x)=1$$

Why: When x increases by one, the value of this term also increases by one. Its derivative is therefore one.

Changed part: $\frac{d}{dx}{\left[x\right]} \;\Longrightarrow\; 1$
🧮 Current expression
$$\bbox[#fff1b8, padding:0.15em]{{\color{black}{\vphantom{\dfrac{d}{dx}}\,\frac{d}{dx}{\left[x\right]}\,}}}\,\cos\left(x\right) + x\,\frac{d}{dx}{\left[\cos\left(x\right)\right]}$$
✨ After: Derivative of a Variable
$$\bbox[#d6f5df, padding:0.15em]{{\color{black}{\vphantom{\dfrac{d}{dx}}\,1\,}}}\,\cos\left(x\right) + x\,\frac{d}{dx}{\left[\cos\left(x\right)\right]}$$
Step 3 — Remove a factor of one Simplification
📖 Rule
$$1\cdot a=a,\quad \frac{a}{1}=a$$

Why: Multiplication or division by one leaves the value unchanged.

Changed part: $1\,\cos\left(x\right) \;\Longrightarrow\; \cos\left(x\right)$
🧮 Current expression
$$\bbox[#fff1b8, padding:0.15em]{{\color{black}{\vphantom{\dfrac{d}{dx}}\,1\,\cos\left(x\right)\,}}} + x\,\frac{d}{dx}{\left[\cos\left(x\right)\right]}$$
✨ After: Remove a factor of one
$$\bbox[#d6f5df, padding:0.15em]{{\color{black}{\vphantom{\dfrac{d}{dx}}\,\cos\left(x\right)\,}}} + x\,\frac{d}{dx}{\left[\cos\left(x\right)\right]}$$
Step 4 — Derivative of Cosine Differentiation rule
📖 Rule
$$\frac{d}{dx}\cos\left(x\right)=-\sin\left(x\right)$$

Why: The argument is exactly x. Apply the known elementary derivative.

Changed part: $\frac{d}{dx}{\left[\cos\left(x\right)\right]} \;\Longrightarrow\; -\sin\left(x\right)$
🧮 Current expression
$$\cos\left(x\right) + x\,\bbox[#fff1b8, padding:0.15em]{{\color{black}{\vphantom{\dfrac{d}{dx}}\,\frac{d}{dx}{\left[\cos\left(x\right)\right]}\,}}}$$
✨ After: Derivative of Cosine
$$\cos\left(x\right) + x\,\bbox[#d6f5df, padding:0.15em]{{\color{black}{\vphantom{\dfrac{d}{dx}}\,\left(-\sin\left(x\right)\right)\,}}}$$
Step 5 — Determine the sign of the product Simplification
📖 Rule
$$a\cdot(-b)=-(a\cdot b),\quad (-a)\cdot(-b)=a\cdot b$$

Why: Move the minus signs of the factors in front of the product. An even number of minus signs gives plus, an odd number gives minus.

Changed part: $x\,\left(-\sin\left(x\right)\right) \;\Longrightarrow\; -x\,\sin\left(x\right)$
🧮 Current expression
$$\cos\left(x\right) + \bbox[#fff1b8, padding:0.15em]{{\color{black}{\vphantom{\dfrac{d}{dx}}\,x\,\left(-\sin\left(x\right)\right)\,}}}$$
✨ After: Determine the sign of the product
$$\cos\left(x\right) + \bbox[#d6f5df, padding:0.15em]{{\color{black}{\vphantom{\dfrac{d}{dx}}\,\left(-x\,\sin\left(x\right)\right)\,}}}$$
Step 6 — Combine plus and minus Simplification
📖 Rule
$$a+(-b)=a-b$$

Why: Adding a negative expression is the same as subtracting the positive expression.

🧮 Current expression
$$\bbox[#fff1b8, padding:0.15em]{{\color{black}{\vphantom{\dfrac{d}{dx}}\,\cos\left(x\right) + \left(-x\,\sin\left(x\right)\right)\,}}}$$
✨ After: Combine plus and minus
$$\bbox[#d6f5df, padding:0.15em]{{\color{black}{\vphantom{\dfrac{d}{dx}}\,\cos\left(x\right) - x\,\sin\left(x\right)\,}}}$$
Final result
$$\cos\left(x\right) - x\,\sin\left(x\right)$$
Copy link to this solution
Cross-check with a computer algebra system

The derivative computed directly by the computer algebra system Maxima:

$$\cos\left(x\right) - x\,\sin\left(x\right)$$

Step-by-step result ↔ Maxima: identical ✓