<s>[INST] Confusion regarding value of $f(x) = \frac{1}{\tan\left(x\right)}$ at $x=\pi/2$ So I was trying to find what $f(x) = \dfrac{1}{\tan\left(x\right)}$ evaluated at $\dfrac{\pi}{2}$ is and first I thought that it is undefined because $\tan(x)$ is undefined at $\dfrac{\pi}{2}$ but then thinking it through a bit more I tried to evaluate $\lim_{x\to\tfrac{\pi}{2}}\dfrac{1}{\tan(x)}=0$ so I was like aha there is a hole in the graph at $x=\dfrac{\pi}{2}$. Finally I realized that $\dfrac{1}{\tan(x)}$ can be written as $\dfrac{\cos(x)}{\sin(x)}$ and this is continuous at $x=\dfrac{\pi}{2}$. So what is going on? Does this mean that $\dfrac{1}{\tan(x)}\neq\dfrac{\cos(x)}{\sin(x)}$ at least for $x=\dfrac{\pi}{2}$? This mode of thinking would also imply that $\dfrac{1}{\dfrac{1}{x}}\neq x$ at least for $x = 0$.
 [/INST] The problem is that $$f(x)=\tan x=\frac{\sin x}{\cos x}\;\text{ is indeed undefined at $x=\frac{\pi}{2}$ since $\cos\frac{\pi}{2}=0$}$$
However $$f(x)=\frac{1}{\tan x}=\color{blue}{\frac{\cos x}{\sin x}}$$ is defined at $x=\frac{\pi}{2}$ since the denominator equals $1$. In fact

$$\color{brown}{\frac{1}{\tan \frac{x}{2}}=\frac{\cos \frac{x}{2}}{\sin \frac{x}{2}}=\frac{0}{1}=0}$$

Your conclusion in the last sentence is correct.
</s>