# Isn't my book wrongly equating $\frac{\frac{\sin^2x-\cos^2x}{\sin x\cos x}}{\frac{\sin^2x+\cos^2x}{\sin x\cos x}}$ and $-\cos2x$?

Problem:

Differentiate with respect to x: $$\frac{\tan x-\cot x}{\tan x+\cot x}$$

My book's solution:

\begin{align} \frac{\tan x-\cot x}{\tan x+\cot x} &=\frac{\dfrac{\sin x}{\cos x}-\dfrac{\cos x}{\sin x}}{\dfrac{\sin x}{\cos x}+\dfrac{\cos x}{\sin x}} \\[0.5em] &=\frac{\dfrac{\sin^2x-\cos^2x}{\sin x\cos x}}{\dfrac{\sin^2x+\cos^2x}{\sin x\cos x}}\tag{1}\\[0.5em] &=\frac{\sin^2x-\cos^2x}{\sin^2x+\cos^2x}\tag{2}\\[0.5em] &=-\cos 2x \end{align}

Now,

$$\frac{d}{dx}(-\cos 2x)=2\sin 2x$$

Question:

$$(1)$$ and $$(2)$$ are different because their domains are different. So, isn't saying $$(1)=(2)$$ wrong?

• good observation. So the derivate only exists for $x \ne \frac \pi 2$ Commented Oct 12, 2021 at 14:59
• You have a series of questions revolving around the theme of your textbook not being clear about the domain of some function and/or identity. I think that by now it should be plain to you that textbooks often cut corners in the interest of brevity of exposition. Continuing to use this as the essence of your questions seems disingenuous to me. Commented Oct 19, 2021 at 4:53
• Yes, the given expression comes with implicit conditions, which naturally apply also to its derivative. The implicit conditions being that $\cos x,$ $\sin x,$ and $(\tan x+\cot x)$ are all nonzero; the third condition is true on $\mathbb R,$ so only the first two conditions actually end up restricting the domain. Commented Feb 1, 2022 at 6:29

$$\tan x$$ is not defined when $$\cos x =0$$ and $$\cot x$$ is not defined when $$\sin x =0$$. So it is implicitly assumed the domain excludes points where $$\sin x \cos x=0$$.