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}$$


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


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

  • 1
    $\begingroup$ good observation. So the derivate only exists for $x \ne \frac \pi 2$ $\endgroup$
    – miracle173
    Commented Oct 12, 2021 at 14:59
  • 2
    $\begingroup$ 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. $\endgroup$ Commented Oct 19, 2021 at 4:53
  • $\begingroup$ 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. $\endgroup$
    – ryang
    Commented Feb 1, 2022 at 6:29

2 Answers 2


$\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$.


In a sense, you are correct. Because they have different domains, they are not exactly the same expression. But they are equal wherever both are defined. The author doesn't mention this detail because it is considered obvious, and it doesn't affect the result. This kind of omission is pretty common - to save space and avoid distractions, math books (and papers, etc.) will leave out details that are "well-known."

On the other hand, it's also pretty common when reading math to come to points where you have to stop for a couple minutes and try to figure out some detail that the author left out. (Or, at least, it was for me when I was studying.)


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .