Courses
Courses for Kids
Free study material
Offline Centres
More
Store Icon
Store
seo-qna
SearchIcon
banner

How do you differentiate the function $f(x)=x\sin x+\cos x$?

Answer
VerifiedVerified
547.5k+ views
Hint: In this question we have the addition of trigonometric terms. In the function the first term is $x\sin x$ which is a composite function therefore, we will first solve this term by using the formula of $\dfrac{d}{dx}uv=u\dfrac{dv}{dx}+v\dfrac{du}{dx}$ and then substitute it in the original function and then derivate the remaining term $\cos x$ to get the final solution.

Complete step-by-step solution:
We have the expression as:
$\Rightarrow f(x)=x\sin x+\cos x$
We have to find the derivative of the expression therefore; it can be written as:
$\Rightarrow f'(x)=\dfrac{d}{dx}\left( x\sin x+\cos x \right)$
Now since the terms are in addition, we can split the derivative as:
$\Rightarrow f'(x)=\dfrac{d}{dx}x\sin x+\dfrac{d}{dx}\cos x\to (1)$
Now consider the term $\dfrac{d}{dx}x\sin x$. Since there is no direct way to differentiate this, we will use the formula of derivative of $uv$ which is $\dfrac{d}{dx}uv=u\dfrac{dv}{dx}+v\dfrac{du}{dx}$. We will consider $u=x$ and $v=\sin x$.
On using the formula, we get:
$\Rightarrow \dfrac{d}{dx}x\sin x=x\dfrac{d}{dx}\sin x+\sin x\dfrac{dx}{dx}$
Now we know that $\dfrac{dx}{dx}=1$ and $\dfrac{d}{dx}\sin x=\cos x$, on substituting, we get:
$\Rightarrow \dfrac{d}{dx}x\sin x=x\times \cos x+\sin x\times 1$
On simplifying, we get:
$\Rightarrow \dfrac{d}{dx}x\sin x=x\cos x+\sin x$
On substituting the value in equation $(1)$, we get:
$\Rightarrow f'(x)=x\cos x+\sin x+\dfrac{d}{dx}\cos x$
Now we know that $\dfrac{d}{dx}\cos x=-\sin x$ therefore, on substituting, we get:
$\Rightarrow f'(x)=x\cos x+\sin x-\sin x$
Since the same term with opposite sign cancel each other, we can write the expression as: $\Rightarrow f'(x)=x\cos x$, which is the required solution.

Note: In this question we have used the $\dfrac{d}{dx}uv$ formula which is for two terms which are in multiplication. There also exists the formula for two terms in division which can be denoted as $\dfrac{d}{dx}\dfrac{u}{v}$ and the formula is written as $\dfrac{d}{dx}\dfrac{u}{v}=\dfrac{v\dfrac{du}{dx}-u\dfrac{dv}{dx}}{{{v}^{2}}}$. It is to be remembered that $\dfrac{d}{dx}{{x}^{n}}=n{{x}^{n-1}}$, which is the derivation of the formula of $\dfrac{dx}{dx}=1$.
Consider the term $\dfrac{dx}{dx}$ , now $x$ can be written as ${{x}^{1}}$ therefore on differentiating, we get $1\times {{x}^{1-1}}$ which means ${{x}^{0}}$. Now we know that anything raised to $0$ is $1$ therefore, $\dfrac{dx}{dx}=1$.