Step 1: Understanding the Concept:
Use integration by parts, \(\int u\,dv=uv-\int v\,du\), with \(u=x\) (algebraic, differentiate) and \(dv=\cos x\,dx\) (trigonometric, integrate) — ILATE order.
Step 2: Applying integration by parts:
\(du=dx\), \(v=\sin x\). So \(\int x\cos x\,dx=x\sin x-\int \sin x\,dx\).
Step 3: Finishing the remaining integral:
\(\int \sin x\,dx=-\cos x\). So the result is \(x\sin x-(-\cos x)+c=x\sin x+\cos x+c\).
Final Answer:
\(\displaystyle\int x\cos x\,dx=\boxed{\cos x+x\sin x+c}\).