# Derivatives of Trigonometric Functions

## Solved Problems

### Example 7.

$y = x\sin x + \cos x$

Solution.

Using the product rule, we can write:

$y^\prime = \left( {x\sin x + \cos x} \right)^\prime = \left( {x\sin x} \right)^\prime + \left( {\cos x} \right)^\prime = x^\prime\sin x + x\left( {\sin x} \right)^\prime + \left( {\cos x} \right)^\prime = 1 \cdot \sin x + x \cdot \cos x + \left( { - \sin x} \right) = \cancel{\sin x} + x\cos x - \cancel{\sin x} = x\cos x.$

### Example 8.

$y = {\sin ^2}\sqrt x$

Solution.

We apply the chain rule several times.

$y'\left( x \right) = \left( {{{\sin }^2}\sqrt x } \right)^\prime = 2\sin \sqrt x \cdot {\left( {\sin \sqrt x } \right)^\prime } = 2\sin \sqrt x \cdot \cos \sqrt x \cdot {\left( {\sqrt x } \right)^\prime } = 2\sin \sqrt x \cos \sqrt x \cdot \frac{1}{{2\sqrt x }}.$

By the double angle formula,

$\sin \left( {2\sqrt x } \right) = 2\sin \sqrt x \cos \sqrt x .$

Hence, the derivative is

$y'\left( x \right) = \sin \left( {2\sqrt x } \right) \cdot \frac{1}{{2\sqrt x }} = \frac{{\sin \left( {2\sqrt x } \right)}}{{2\sqrt x }}.$

### Example 9.

$y = \cos {\frac{1}{x}}$

Solution.

By the chain rule,

$y^\prime = \left( {\cos \frac{1}{x}} \right)^\prime = - \sin \frac{1}{x} \cdot \left( {\frac{1}{x}} \right)^\prime = - \sin \frac{1}{x} \cdot \left( { - \frac{1}{{{x^2}}}} \right) = \frac{1}{{{x^2}}}\sin \frac{1}{x}.$

### Example 10.

$y = {\sin ^3}x + {\cos ^3}x$

Solution.

We use the formulas for the derivative of a sum of functions and the derivative of a power function.

$y'\left( x \right) = \left( {{{\sin }^3}x + {{\cos }^3}x} \right)^\prime = \left( {{{\sin }^3}x} \right)^\prime + \left( {{{\cos }^3}x} \right)^\prime = 3\,{\sin ^2}x \cdot {\left( {\sin x} \right)^\prime } + 3\,{\cos ^2}x \cdot {\left( {\cos x} \right)^\prime }.$

Substituting the derivatives and simplifying yields

$y'\left( x \right) = 3\,{\sin ^2}x \cdot \cos x + 3\,{\cos ^2}x \cdot \left( { - \sin x} \right) = 3\,{\sin ^2}x\cos x - 3\,{\cos ^2}x\sin x = 3\sin x\cos x \left( {\sin x - \cos x} \right).$

As $$\sin 2x = 2\sin x\cos x,$$ the final expression for the derivative has the form

$y'\left( x \right) = 3 \cdot \frac{{\sin 2x}}{2}\left( {\sin x - \cos x} \right) = \frac{3}{2}\sin 2x \left( {\sin x - \cos x} \right).$

### Example 11.

$y = \tan \frac{x}{2} - \cot \frac{x}{2}$

Solution.

The first step is obvious:

$y'\left( x \right) = \left( {\tan \frac{x}{2} - \cot \frac{x}{2}} \right)^\prime = \left( {\tan \frac{x}{2}} \right)^\prime - \left( {\cot \frac{x}{2}} \right)^\prime .$

Since

$\left( {\tan x} \right)^\prime = \frac{1}{{{{\cos }^2}x}},\;\;\;{\left( {\cot x} \right)^\prime } = - \frac{1}{{{{\sin }^2}x}},$

then using the chain rule, we find:

$y'\left( x \right) = \frac{1}{{{{\cos }^2}\frac{x}{2}}} \cdot {\left( {\frac{x}{2}} \right)^\prime } - \left( { - \frac{1}{{{{\sin }^2}\frac{x}{2}}}} \right) \cdot {\left( {\frac{x}{2}} \right)^\prime } = \frac{1}{{{{\cos }^2}\frac{x}{2}}} \cdot \frac{1}{2} + \frac{1}{{{\sin^2}\frac{x}{2}}} \cdot \frac{1}{2} = \frac{{{\sin^2}\frac{x}{2} + {{\cos }^2}\frac{x}{2}}}{{2\,{{\cos }^2}\frac{x}{2}{\sin^2}\frac{x}{2}}}.$

To simplify this expression we use the trigonometric identities $${\sin^2}x + {\cos ^2}x = 1$$ and $$\sin x = 2\sin {\frac{x}{2}} \cos {\frac{x}{2}}.$$ This yields:

$y'\left( x \right) = \frac{1}{{2{{\cos }^2}\frac{x}{2}{\sin^2}\frac{x}{2}}} = \frac{{2 \cdot 1}}{{4{{\cos }^2}\frac{x}{2}{\sin^2}\frac{x}{2}}} = \frac{2}{{{{\left( {2\cos \frac{x}{2}\sin \frac{x}{2}} \right)}^2}}} = \frac{2}{{{{\sin }^2}x}}.$

### Example 12.

$y = {x^2}\sin x + 2x\cos x - 2\sin x$

Solution.

Using the product rule, we obtain:

$\require{cancel} y^\prime = \left( {{x^2}\sin x} \right)^\prime + \left( {2x\cos x} \right)^\prime - \left( {2\sin x} \right)^\prime = \left( {{x^2}} \right)^\prime\sin x + {x^2}\left( {\sin x} \right)^\prime + \left( {2x} \right)^\prime\cos x + 2x\left( {\cos x} \right)^\prime - 2\left( {\sin x} \right)^\prime = \cancel{2x\sin x} + {x^2}\cos x + \cancel{2\cos x} - \cancel{2x\sin x} - \cancel{2\cos x} = {x^2}\cos x.$

### Example 13.

$y = {\tan ^2}x + \ln {\cos ^2}x$

Solution.

Using the chain rule, we get

$y^\prime = \left( {{{\tan }^2}x + \ln {{\cos }^2}x} \right)^\prime = \left( {{{\tan }^2}x} \right)^\prime + \left( {\ln {{\cos }^2}x} \right)^\prime = 2\tan x \cdot \left( {\tan x} \right)^\prime + \frac{1}{{{{\cos }^2}x}} \cdot \left( {{{\cos }^2}x} \right)^\prime = \frac{{2\sin x}}{{\cos x}} \cdot \frac{1}{{{{\cos }^2}x}} + \frac{1}{{{{\cos }^2}x}} \cdot 2\cos x \cdot \left( { - \sin x} \right) = \frac{{2\sin x}}{{{{\cos }^2}x}}\left( {\frac{1}{{\cos x}} - \cos x} \right) = \frac{{2\sin x}}{{{{\cos }^2}x}} \cdot \frac{{1 - {{\cos }^2}x}}{{\cos x}} = \frac{{2\sin x}}{{{{\cos }^2}x}} \cdot \frac{{{{\sin }^2}x}}{{\cos x}} = \frac{{2{{\sin }^3}x}}{{{{\cos }^3}x}} = 2{\tan ^3}x.$

### Example 14.

$y = {\sin ^n}x\cos nx$

Solution.

First we differentiate as the product of two functions:

$y'\left( x \right) = \left( {{{\sin }^n}x\cos nx} \right)^\prime = {\left( {{{\sin }^n}x} \right)^\prime }\cos nx + {\sin ^n}x{\left( {\cos nx} \right)^\prime }.$

Next, using the power rule and the chain rule, we have

$y'\left( x \right) = n{\sin ^{n - 1}}x \cdot {\left( {\sin x} \right)^\prime } \cdot \cos {nx} + {\sin ^n}x\left( { - \sin {nx}} \right) \cdot {\left( {nx} \right)^\prime } = n{\sin ^{n - 1}}x\cos x\cos nx - n{\sin ^n}x\sin nx = n{\sin ^{n - 1}}x \cdot \left( {\cos x\cos nx - \sin x\sin nx} \right).$

Apply now the trigonometric identity

$\cos \left( {\alpha + \beta } \right) = \cos \alpha \cos \beta - \sin \alpha \sin \beta .$

Then the derivative takes the following form:

$y'\left( x \right) = n{\sin ^{n - 1}}x\cos \left( {x + nx} \right) = n{\sin ^{n - 1}}x\cos \left[ {\left( {n + 1} \right)x} \right].$

### Example 15.

$y = \ln \sqrt {{\frac{{1 - \sin x}}{{1 + \sin x}}}}$

Solution.

The given function is the composition of three functions. Using the chain and quotient rules, we have

$y^\prime = \left( {\ln \sqrt {\frac{{1 - \sin x}}{{1 + \sin x}}} } \right)^\prime = \frac{1}{{\sqrt {\frac{{1 - \sin x}}{{1 + \sin x}}} }} \cdot \left( {\sqrt {\frac{{1 - \sin x}}{{1 + \sin x}}} } \right)^\prime = \frac{1}{{\sqrt {\frac{{1 - \sin x}}{{1 + \sin x}}} }} \cdot \frac{1}{{2\sqrt {\frac{{1 - \sin x}}{{1 + \sin x}}} }} \cdot \left( {\frac{{1 - \sin x}}{{1 + \sin x}}} \right)^\prime = \frac{{1 + \sin x}}{{2\left( {1 - \sin x} \right)}} \cdot \frac{{\left( { - 2\cos x} \right)}}{{{{\left( {1 + \sin x} \right)}^2}}} = - \frac{{2\cancel{\left( {1 + \sin x} \right)}\cos x}}{{2\left( {1 - \sin x} \right){{\left( {1 + \sin x} \right)}^\cancel{2}}}} = - \frac{{\cos x}}{{\left( {1 - \sin x} \right)\left( {1 + \sin x} \right)}} = - \frac{{\cos x}}{{1 - {{\sin }^2}x}} = - \frac{\cancel{\cos x}}{{{{\cos }^\cancel{2}}x}} = - \frac{1}{{\cos x}} = - \sec x.$

### Example 16.

Calculate the derivative of the function $y = \left( {2 - {x^2}} \right)\cos x + 2x\sin x$ at $$x = \pi.$$

Solution.

Take the derivative using the product rule.

$y^\prime = \left( {\left( {2 - {x^2}} \right)\cos x} \right)^\prime + \left( {2x\sin x} \right)^\prime = \left( {2 - {x^2}} \right)^\prime\cos x + \left( {2 - {x^2}} \right)\left( {\cos x} \right)^\prime + \left( {2x} \right)^\prime\sin x + 2x\left( {\sin x} \right)^\prime = - 2x\cos x - \left( {2 - {x^2}} \right)\sin x + 2\sin x + 2x\cos x = \cancel{- 2x\cos x} - \cancel{2\sin x} + {x^2}\sin x + \cancel{2\sin x} + \cancel{2x\cos x} = {x^2}\sin x.$

Substituting $$x = \pi,$$ we get

$y^\prime\left( \pi \right) = {\pi ^2}\sin \pi = {\pi ^2} \cdot 0 = 0.$

### Example 17.

Calculate the derivative of the function $y = \left( {x + 1} \right)\cos x + \left( {x + 2} \right)\sin x$ at $$x = 0.$$

Solution.

By the product rule,

$y^\prime = \left( {\left( {x + 1} \right)\cos x} \right)^\prime + \left( {\left( {x + 2} \right)\sin x} \right)^\prime = \left( {x + 1} \right)^\prime\cos x + \left( {x + 1} \right)\left( {\cos x} \right)^\prime + \left( {x + 2} \right)^\prime\sin x + \left( {x + 2} \right)\left( {\sin x} \right)^\prime = \cos x - \left( {x + 1} \right)\sin x + \sin x + \left( {x + 2} \right)\cos x = \cos x - x\sin x - \cancel{\sin x} + \cancel{\sin x} + x\cos x + 2\cos x = 3\cos x + x\left( {\cos x - \sin x} \right).$

Substitute $$x =0:$$

$y^\prime\left( 0 \right) = 3\cos 0 + 0 \cdot \left( {\cos 0 - \sin 0} \right) = 3 \cdot 1 + 0 = 3.$

### Example 18.

$y = {\sec ^2}{\frac{x}{2}} + {\csc ^2}{\frac{x}{2}}$

Solution.

Using the chain rule, we get

$y^\prime = \left( {{{\sec }^2}\frac{x}{2} + {{\csc }^2}\frac{x}{2}} \right)^\prime = \left( {{{\sec }^2}\frac{x}{2}} \right)^\prime + \left( {{{\csc }^2}\frac{x}{2}} \right)^\prime = 2\sec \frac{x}{2} \cdot \left( {\sec \frac{x}{2}} \right)^\prime + 2\csc \frac{x}{2} \cdot \left( {\csc \frac{x}{2}} \right)^\prime = 2\sec \frac{x}{2} \cdot \tan \frac{x}{2}\sec \frac{x}{2} \cdot \frac{1}{2} + 2\csc \frac{x}{2} \cdot \left( { - \cot \frac{x}{2}\csc \frac{x}{2}} \right) \cdot \frac{1}{2} = {\sec ^2}\frac{x}{2}\tan \frac{x}{2} - {\csc ^2}\frac{x}{2}\cot \frac{x}{2} = \frac{{\sin \frac{x}{2}}}{{{{\cos }^3}\frac{x}{2}}} - \frac{{\cos \frac{x}{2}}}{{{{\sin }^3}\frac{x}{2}}} = \frac{{{{\sin }^4}\frac{x}{2} - {{\cos }^4}\frac{x}{2}}}{{{{\sin }^3}\frac{x}{2}{{\cos }^3}\frac{x}{2}}} = \frac{{\left( {{{\sin }^2}\frac{x}{2} - {{\cos }^2}\frac{x}{2}} \right)\left( {{{\sin }^2}\frac{x}{2} + {{\cos }^2}\frac{x}{2}} \right)}}{{\frac{1}{8} \cdot 8{{\sin }^3}\frac{x}{2}{{\cos }^3}\frac{x}{2}}} = - \frac{{8\left( {{{\cos }^2}\frac{x}{2} - {{\sin }^2}\frac{x}{2}} \right)}}{{{{\left( {2\sin \frac{x}{2}\cos \frac{x}{2}} \right)}^3}}} = - \frac{{8\cos x}}{{{{\sin }^3}x}} = - 8\cot x\,{\csc ^2}x.$

### Example 19.

$$y = \left( {\tan x} \right)^{\cos x},$$ where $$0 \lt x \lt \frac{\pi }{2}.$$

Solution.

We represent this function as follows:

$y\left( x \right) = \left( {\tan x} \right)^{\cos x} = \left( {{e^{\ln \tan x}}} \right)^{\cos x} = e^{\ln \tan x \cdot \cos x}.$

Note that here we always have $$\tan x \gt 0$$ when $$0 \lt x \lt {\frac{\pi }{2}}.$$ Using the chain and product rules, we obtain:

$y'\left( x \right) = {\left( {{e^{\ln \tan x \cdot \cos x}}} \right)^\prime } = {e^{\ln \tan x \cdot \cos x}} \cdot {\left( {\ln \tan x \cdot \cos x} \right)^\prime } = {\left( {\tan x} \right)^{\cos x}} \cdot \left[ {\frac{1}{{\sin x}} - \sin x\ln \tan x} \right] = {\left( {\tan x} \right)^{\cos x}} \cdot \left[ {\frac{1}{{\sin x}} - \sin x\ln \tan x} \right] = {\left( {\tan x} \right)^{\cos x}} \left( {\csc x - \sin x\ln \tan x} \right).$

### Example 20.

$y = \frac{{{{\sin }^2}x}}{{1 + \cot x}} + \frac{{{{\cos }^2}x}}{{1 + \tan x}}$

Solution.

We rewrite the function in terms of sine and cosine and simplify:

$y = \frac{{{{\sin }^2}x}}{{1 + \cot x}} + \frac{{{{\cos }^2}x}}{{1 + \tan x}} = \frac{{{{\sin }^2}x}}{{1 + \frac{{\cos x}}{{\sin x}}}} + \frac{{{{\cos }^2}x}}{{1 + \frac{{\sin x}}{{\cos x}}}} = \frac{{{{\sin }^2}x}}{{\frac{{\sin x + \cos x}}{{\sin x}}}} + \frac{{{{\cos }^2}x}}{{\frac{{\cos x + \sin x}}{{\cos x}}}} = \frac{{{{\sin }^3}x}}{{\sin x + \cos x}} + \frac{{{{\cos }^3}x}}{{\sin x + \cos x}} = \frac{{{{\sin }^3}x + {{\cos }^3}x}}{{\sin x + \cos x}}.$

Factor the sum of cubes in the numerator by the formula

${a^3} + {b^3} = \left( {a + b} \right)\left( {{a^2} - ab + {b^2}} \right).$

This yields:

$y = {\sin ^2}x - \sin x\cos x + {\cos ^2}x.$

Now it is easy to take the derivative using the chain and product rules:

$y^\prime = \left( {{{\sin }^2}x} \right)^\prime - \left( {\sin x\cos x} \right)^\prime + \left( {{{\cos }^2}x} \right)^\prime = 2\sin \cos x - \left( {\sin x} \right)^\prime\cos x - \sin x\left( {\cos x} \right)^\prime + 2\cos x\left( { - \sin x} \right) = \cancel{2\sin x\cos x} - {\cos ^2}x + {\sin ^2}x - \cancel{2\sin x\cos x} = - \left( {{{\cos }^2}x - {{\sin }^2}x} \right) = - \cos 2x.$