Question
Question: How do you differentiate the function \(f(x)=x\sin x+\cos x\)?...
How do you differentiate the function f(x)=xsinx+cosx?
Solution
In this question we have the addition of trigonometric terms. In the function the first term is xsinx which is a composite function therefore, we will first solve this term by using the formula of dxduv=udxdv+vdxdu and then substitute it in the original function and then derivate the remaining term cosx to get the final solution.
Complete step-by-step solution:
We have the expression as:
⇒f(x)=xsinx+cosx
We have to find the derivative of the expression therefore; it can be written as:
⇒f′(x)=dxd(xsinx+cosx)
Now since the terms are in addition, we can split the derivative as:
⇒f′(x)=dxdxsinx+dxdcosx→(1)
Now consider the term dxdxsinx. Since there is no direct way to differentiate this, we will use the formula of derivative of uv which is dxduv=udxdv+vdxdu. We will consider u=x and v=sinx.
On using the formula, we get:
⇒dxdxsinx=xdxdsinx+sinxdxdx
Now we know that dxdx=1 and dxdsinx=cosx, on substituting, we get:
⇒dxdxsinx=x×cosx+sinx×1
On simplifying, we get:
⇒dxdxsinx=xcosx+sinx
On substituting the value in equation (1), we get:
⇒f′(x)=xcosx+sinx+dxdcosx
Now we know that dxdcosx=−sinx therefore, on substituting, we get:
⇒f′(x)=xcosx+sinx−sinx
Since the same term with opposite sign cancel each other, we can write the expression as: ⇒f′(x)=xcosx, which is the required solution.
Note: In this question we have used the dxduv 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 dxdvu and the formula is written as dxdvu=v2vdxdu−udxdv. It is to be remembered that dxdxn=nxn−1, which is the derivation of the formula of dxdx=1.
Consider the term dxdx , now x can be written as x1 therefore on differentiating, we get 1×x1−1 which means x0. Now we know that anything raised to 0 is 1 therefore, dxdx=1.