Solveeit Logo

Question

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

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

Explanation

Solution

In this question we have the addition of trigonometric terms. In the function the first term is xsinxx\sin x which is a composite function therefore, we will first solve this term by using the formula of ddxuv=udvdx+vdudx\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 cosx\cos x to get the final solution.

Complete step-by-step solution:
We have the expression as:
f(x)=xsinx+cosx\Rightarrow f(x)=x\sin x+\cos x
We have to find the derivative of the expression therefore; it can be written as:
f(x)=ddx(xsinx+cosx)\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:
f(x)=ddxxsinx+ddxcosx(1)\Rightarrow f'(x)=\dfrac{d}{dx}x\sin x+\dfrac{d}{dx}\cos x\to (1)
Now consider the term ddxxsinx\dfrac{d}{dx}x\sin x. Since there is no direct way to differentiate this, we will use the formula of derivative of uvuv which is ddxuv=udvdx+vdudx\dfrac{d}{dx}uv=u\dfrac{dv}{dx}+v\dfrac{du}{dx}. We will consider u=xu=x and v=sinxv=\sin x.
On using the formula, we get:
ddxxsinx=xddxsinx+sinxdxdx\Rightarrow \dfrac{d}{dx}x\sin x=x\dfrac{d}{dx}\sin x+\sin x\dfrac{dx}{dx}
Now we know that dxdx=1\dfrac{dx}{dx}=1 and ddxsinx=cosx\dfrac{d}{dx}\sin x=\cos x, on substituting, we get:
ddxxsinx=x×cosx+sinx×1\Rightarrow \dfrac{d}{dx}x\sin x=x\times \cos x+\sin x\times 1
On simplifying, we get:
ddxxsinx=xcosx+sinx\Rightarrow \dfrac{d}{dx}x\sin x=x\cos x+\sin x
On substituting the value in equation (1)(1), we get:
f(x)=xcosx+sinx+ddxcosx\Rightarrow f'(x)=x\cos x+\sin x+\dfrac{d}{dx}\cos x
Now we know that ddxcosx=sinx\dfrac{d}{dx}\cos x=-\sin x therefore, on substituting, we get:
f(x)=xcosx+sinxsinx\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: f(x)=xcosx\Rightarrow f'(x)=x\cos x, which is the required solution.

Note: In this question we have used the ddxuv\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 ddxuv\dfrac{d}{dx}\dfrac{u}{v} and the formula is written as ddxuv=vdudxudvdxv2\dfrac{d}{dx}\dfrac{u}{v}=\dfrac{v\dfrac{du}{dx}-u\dfrac{dv}{dx}}{{{v}^{2}}}. It is to be remembered that ddxxn=nxn1\dfrac{d}{dx}{{x}^{n}}=n{{x}^{n-1}}, which is the derivation of the formula of dxdx=1\dfrac{dx}{dx}=1.
Consider the term dxdx\dfrac{dx}{dx} , now xx can be written as x1{{x}^{1}} therefore on differentiating, we get 1×x111\times {{x}^{1-1}} which means x0{{x}^{0}}. Now we know that anything raised to 00 is 11 therefore, dxdx=1\dfrac{dx}{dx}=1.