Problem 52
Hard Differentiation Techniques

Find y' for y = (x sin x)/(1+ tan x)

Find $y'$ for $y = \dfrac{x\sin x}{1+\tan x}$.

Explanation of Method

Combine the product rule inside the quotient rule, then simplify.

Step 1: Identify $u$ and $v$ for the quotient rule

\[ u = x\sin x, \qquad v = 1+\tan x. \]

The numerator is itself a product, so it needs the product rule first.

Step 2: Differentiate $u$ by the product rule

\[ u' = (x)'\sin x + x(\sin x)' = \sin x + x\cos x. \]

Step 3: Differentiate $v$

Using $(\tan x)' = \dfrac{1}{\cos^{2}x}$ from Problem 16: $v' = \frac{1}{\cos^{2} x}$.

Step 4: Apply the quotient rule

\[ y' = \frac{u'v - uv'}{v^{2}} = \frac{\bigl(\sin x + x\cos x\bigr)\bigl(1+\tan x\bigr) - \dfrac{x\sin x}{\cos^{2} x}}{\bigl(1+\tan x\bigr)^{2}}. \]

This is already a correct answer, but it can be cleared of its inner fractions.

Step 5: Clear the fractions

Multiply numerator and denominator by $\cos^{2}x$. Since $\bigl(1+\tan x\bigr)\cos x = \cos x + \sin x$, the denominator becomes

\[ \bigl(1+\tan x\bigr)^{2}\cos^{2}x = \bigl(\cos x+\sin x\bigr)^{2}, \]

and the numerator becomes

\[ \cos x\bigl(\sin x + x\cos x\bigr)\bigl(\cos x + \sin x\bigr) - x\sin x. \]

Hence \[y' = \frac{\cos x\bigl(\sin x + x\cos x\bigr)\bigl(\cos x + \sin x\bigr) - x\sin x}{\bigl(\cos x+\sin x\bigr)^{2}}.\]

Step 6: Factor the numerator

Expanding and using $\cos^{2}x - 1 = -\sin^{2}x$ together with $\cos^{3}x - \sin^{3}x = (\cos x-\sin x)\bigl(1+\sin x\cos x\bigr)$, the numerator collapses to

\[ x\bigl(\cos x-\sin x\bigr)\bigl(1+\sin x\cos x\bigr) + \sin x\cos x\bigl(\sin x+\cos x\bigr). \]

Step 7: Verification

\[x = 0:\quad \text{numerator} = 0 + 0 = 0 \;\Longrightarrow\; y'(0) = 0, \text{ matching } y(x) \approx x^{2} \text{ near } 0 \;\;\checkmark\]

\[x = \frac{\pi}{4}:\quad y' = \frac{0 + \frac12\cdot\sqrt{2}}{\bigl(\sqrt{2}\bigr)^{2}} = \frac{\sqrt{2}}{4} \approx 0.35355\]

\[\frac{y(\pi/4 + 10^{-5}) - y(\pi/4 - 10^{-5})}{2\times 10^{-5}} \approx 0.35355 \;\;\checkmark\]


Result

Final answer:

\[\boxed{\,y' = \frac{x\bigl(\cos x-\sin x\bigr)\bigl(1+\sin x\cos x\bigr) + \sin x\cos x\bigl(\sin x+\cos x\bigr)}{\bigl(\cos x+\sin x\bigr)^{2}}\,}\]

Remark

Remark. The function is undefined where $\tan x$ is undefined $\left(x = \tfrac{\pi}{2}+k\pi\right)$ and where $1+\tan x = 0$ $\left(x = -\tfrac{\pi}{4}+k\pi\right)$; the second family is exactly where $\cos x + \sin x = 0$, the zeros of the simplified denominator. The two forms of the answer therefore have the same domain, as they must.