Derivative of cot(x) If we rewrite $\displaystyle \frac {d} {dx} \cot(x)$ as $\displaystyle \frac {d} {dx} \frac {1} {\tan(x)}$ and then apply the quotient rule, we get to $\displaystyle \frac {\tan(x)\frac{d}{dx}1-1\frac{d}{dx}\tan(x)} {\tan^2(x)}$ and then $\displaystyle \frac {-\sec^2(x)} {\tan^2(x)} = -\frac {1} {\cos^2(x)} \cdot \frac{\cos^2(x)} {\sin^2(x)} = -\csc^2(x)$
My question is that will this proof be valid for $\displaystyle \frac {\pi} {2}$? The derivative of $\tan(x)$ is $\sec^2(x)$ only for angles for which $\tan(x)$ is defined. $\tan(x)$ is undefined for $\frac {\pi} {2}$, so in the above quotient rule, when it is claimed that $\frac {d} {dx} \tan(x) = \
sec^2(x)$, that comes with the caveat that $x \neq \frac {\pi} {2}$ (as well as $\frac {3\pi} {2}$ and their co-terminals).
Now $\frac {\pi} {2}$ is in the domain of $\cot(x)$, but I don't think that the proof in the opening paragraph holds for $\frac {\pi} {2}$
If I go by the first principle i.e.
$$\displaystyle \lim_{h \to 0} \frac  {cot(x+h)-cot(h)} {h}$$, then I get a proof which works for all angles in the domain of $\cot(x)$ including $\frac {\pi} {2}$
Similarly, if I apply the quotient rule on $\displaystyle \frac {d} {dx} \cot(x) = \frac {d} {dx} \frac {\cos(x)} {\sin(x)}$, I don't run into any problems with $\frac {\pi} {2}$ 
So, I am just curious if the proof outlined in the first para is applicable for $\frac {\pi} {2}$. I am not so convinced, but wherever I have seen that approach on the internet, I haven't seen anyone make a note or caveat that this approach may have some issues.
Thanks.
 A: If you use a definition of $\cot$ that is not defined for $\frac \pi 2$ like $\cot x=\frac 1 {\tan x}$, then the proof that you make will not prove the derivative for $x=\frac \pi 2$. Meanwhile, if you do not make that assumption and use the general properties of $\cot$ like the $\cot$ addition identity or $\cot x=\frac{\cos x}{\sin x}$, then you will have a more robust proof.
People probably use $\cot x=\frac 1 {\tan x}$ because it's easy and leads to the right answer, even if it does not prove the derivative for $x=\frac \pi 2$.
A: No, you don't get the derivative at $\pi/2$; however, the cotangent function is continuous at $\pi/2$ and
$$
\lim_{x\to\pi/2}\cot'(x)=
\lim_{x\to\pi/2}-\frac{1}{\sin^2(x)}=-1
$$
so you can say that
$$
\cot'(\pi/2)=-1=-\frac{1}{\sin^2(\pi/2)}
$$
It's a standard application of l'Hôpital's theorem: continuity of the function at the point ensures the hypotheses of the theorem hold.
More generally, suppose you have a function $f$ that is continuous on $(x_0-\delta,x_0+\delta)$ and differentiable on $(x_0-\delta,x_0)\cup(x_0,x_0+\delta)$; if $f'$ has a removable singularity at $x_0$, then $f$ is also differentiable on $x_0$ and
$$
f'(x_0)=\lim_{x\to x_0}f'(x)
$$
A classical example is
$$
f(x)=\begin{cases}
x^3\sin\frac{1}{x} & \text{if $x\ne0$}\\
0 & \text{if $x=0$}
\end{cases}
$$
Since, for $x\ne0$,
$$
f'(x)=3x^2\sin\frac{1}{x}-x\cos\frac{1}{x}
$$
and
$$
\lim_{x\to0}f(x)=0,\qquad \lim_{x\to0}f'(x)=0,
$$
we can say that $f$ is also differentiable at $0$ and $f'(0)=0$ (which can also be verified by the definition).
Note that the converse is not true; the function might be differentiable at $x_0$ without the derivative having a removable singularity. Just change $x^3$ into $x^2$ in the above example to get an instance of this.
A: This is a problem of limits. No matter how a function is constructed. Nor does it matter if this function can be defined in several ways. If you can prove that a function $f(z)$ at a given point $z_0$ in the complex plane is a removable singularity, then the derivative of that function on that point can be saved, and therefore, can be defined. Check this link.
To test (and save) a removable singularity, you can use the limit:
$$
\lim\limits_{r\to 0} f(z_0 - re^{i\phi}) = \ell_{z_0}(\phi)
$$
This limit can be intuitively interpreted as a limit oriented. If the limit oriented acquires a fixed value for any value of angle $\phi$, then the function must be continuous at the point $z_0$ and therefore this is a removable singularity:
$$
\forall \phi\in\mathbb{R},\quad \ell_{z_0}(\phi) = L \quad\Rightarrow\quad z_0 \mbox{ is a removable singularity of } f(z) \quad\therefore\quad f(z_0) = L
$$
In your case, taking limit:
$$
\lim\limits_{r\to 0} \cot\left(\dfrac{\pi}{2} - re^{i\phi}\right) = 0 \quad\Rightarrow\quad \dfrac{\pi}{2} \mbox{ is a removable singularity of } \cot(z) \quad\therefore\quad \cot\left(\dfrac{\pi}{2}\right) = 0
$$
Then, the derivative of $\cot(z)$ on the point $\frac{\pi}{2}$ is defined.
Now, taking limit:
$$
\lim\limits_{r\to 0} \tan\left(\dfrac{\pi}{2} - re^{i\phi}\right) = (\infty) e^{-i\phi}\quad\Rightarrow\quad \dfrac{\pi}{2} \mbox{ is not a removable singularity of } \tan(z)
$$
Then, the derivative of $\tan(z)$ on the point $\frac{\pi}{2}$ is not defined. It's a polarized singularity.
A: Note that the limit $\lim_{x\rightarrow \frac{\pi}{2}} \dfrac{1}{\tan x}$ exists. If you "calculated" the derivative of $\dfrac{x^3 - 8}{x-2}$ at $x = 2$, it is equal to the derivative of $x^2 + 2x + 4$. However note that the derivatives for both these functions are equal they are not equally continuous. This is because of the restrictions of their parent functions. However if you consider the derivative as an independent function instead of the derivative of another function, then these restrictions vanish.
For the same reason if you "calculated" the derivative of $\dfrac{1}{\tan x}$ at $x = \dfrac{\pi}{2}$ it would be the same as the derivate of $\cot x$ at $x = \frac{\pi}{2}$ This is because the functions $\dfrac{1}{\tan x}$ and $\cot x$ are essentially the same, except for their discontinuities. And so you notice that $\lim_{x \rightarrow \frac{\pi}{2}} \dfrac{d}{dx}\big(\dfrac{1}{\tan x}\big) = \lim_{x \rightarrow \frac{\pi}{2}} \dfrac{d}{dx} \big(\cot x\big) $ The only difference is that $\dfrac{d}{dx} \big(\cot x\big)$  is continuous at $\frac{\pi}{2}$ while $\dfrac{d}{dx}\big(\dfrac{1}{\tan x}\big)$ is not. 
In the same vein, it would be very useful if you keep this in mind: $$\cot (a) \neq \dfrac{1}{\tan(a)}$$ However $$\cot a = \lim_{x \rightarrow a}\dfrac{1}{\tan x}$$  
Similarly for $0 \le x \le \frac{\pi}{2}$ (I took this limited range just as an example)
$$\dfrac{d}{dx} cotx = \begin{cases} 
\dfrac{d}{dx} \dfrac{1}{tanx} & \text{if $x\neq \frac {\pi}{2}$}\\
\lim_{x \rightarrow \frac{\pi}{2}} \dfrac{1}{tanx} & \text{if $x= \frac{\pi}{2}$}
\end{cases}
$$
However if you took the derivative as a function in and of itself without its ties to its parent function $\dfrac{1}{tanx}$, then the statement holds regardless.
