Shouldn't tan(π/2) = ∞? We will first prove that $\sin(x)/\cos(x) = \tan(x)$.
By definition, $\sin(x) = O/H$, $\cos(x) = A/H$ and $\tan(x) = O/A$, where $O$,$A$ and $H$ are the opposite, adjacent and hypotenuse of a right angled triangle.
$\sin(x)/\cos(x) = O/H ÷ A/H = O/H × H/A = OH/AH = O/A = \tan(x)$
So $\tan(π/2) = \sin(π/2)/\cos(π/2) = 1/0$, which is undefined. However, we know that it can either be $∞$ or $-∞$. Therefore, $\tan(π/2)$ is equal to $∞$ or $-∞$.
If $\tan(π/2) = -∞$, then the limit of $\arctan(x)$ as $x$ approaches $-∞$ should equal $π/2$. However, it equals $-π/2$ instead. Therefore, $\tan(π/2)$ cannot be $-∞$, so it must be $∞$.
Is there any mistake in my working?
 A: Let's clear a few things up. Unless you're working in nonstandard analysis (which I would avoid if I were you!) the statement
$$\lim_{x\to x_0}f(x)=\infty$$
Is nonsense. When dealing with limits, there are two possibilities:

*

*The limit exists and is equal to some real number $L$. ($\boldsymbol \infty$ is not a real number!)

*The limit doesn't exist.

However, in mathematics, the statements
$$\lim_{x\to x_0}f(x)=\infty~~~\text{and}~~~\lim_{x\to x_0}f(x)=\text{undefined}$$
Have slightly different implications, even though the one on the left is, as of now, nonsense. Let's define what the left statement means. When we say
$$\lim_{x\to x_0}f(x)=\infty$$
What we really mean is this:

$\exists\delta\in\mathbb{R}$ s.t $\forall \epsilon<\delta$, $\exists M\in\mathbb{R}$ s.t $f(x)> M$ for all $x$ satisfying $|x-x_0|<\epsilon$.

Similarly the statement $\lim_{x\to x_0}f(x)=-\infty$ means

$\exists\delta\in\mathbb{R}$ s.t $\forall \epsilon<\delta$, $\exists M\in\mathbb{R}$ s.t $f(x)\color{red}{\boldsymbol <} M$ for all $x$ satisfying $|x-x_0|<\epsilon$.

Neither of these apply to your case (prove this!) so all we can say is
$$\lim_{x\to x_0}f(x)=\text{undefined}$$
A: What @ultralegend5385 has said is pretty much correct. You cannot define $\infty$ as undefined (ie, $\infty$ ≠ undefined). The term undefined basically denotes that the value does not exist, whereas $\infty$ is way of saying something is endless.
For example, say an arbitrary function $f(x)$ has the domain (-$\infty$, $\infty$). It's just stating the function is endless. Now, that is not the same as being undefined, is it?
From what I believe, you might be looking for the word asymptote or asymptotic in terms of a graph:
The graph of $y = \tan{x}$ has the first, positive asymptote at $\frac{\pi}{2}$ and then for every $\pm \pi$ recurring after that.

A: There are other great answers, yet I will like to present my explanation, which I believe adds to the post.
First of all, what is $\tan$? Well, certainly, it can be defined in terms of right triangles or circles, but to be "standard" let's use the definition:
$$\tan:\,\mathbb{R}\mapsto\mathbb{R}; \tan x:=\dfrac{\sin x}{\cos x}$$
(Note that I used the domain and codomain to be $\mathbb{R}$, presuming that's what you should be using.)
Now, clearly the fraction on the right is a real number when the denominator is not zero i.e. $\cos x\neq 0$ is the restriction for our function. What you did is didn't notice that and put $\cos x=0$. A zero in the denominator should be a red flag in the first place that things aren't right. So, the actual domain should be $\mathbb{R}\setminus\{x:\cos x=0\}$. (This simply means all values from $\mathbb{R}$ except those at which $\cos$ becomes zero.)
Coming to your second point, this is a common misconception that students have, namely they say that $1/0=\infty$ (or put a $\pm$, doesn't change the point). Remember it, division by zero is not allowed. (There are certain aspects of this, which you should not care about as of now.) So, basically
$$\dfrac10\color{red}{\neq}\infty$$
And definitions matter in math. You are not allowed to put that $\pi/2$ in place of the $x$ in $\tan x$, because it's defined that way!
As I said in the comments,
$$f(a)=\lim_{x\to a}f(x)$$
is not true for any $f$ and $a$; it's in fact the definition of continuity (in limit terms), the above condition defines that $f$ is continuous at $x=a$. Here, $\tan x$ is not continuous at $x=\pi/2$. If you've learnt about it, you can notice the type of discontinuity.
Hope this helps. Ask anything if not clear :)
A: Let's consider a point $P$ in the unit circle whose coordinate is $(\cos \theta, \sin \theta)$ for $0 \leq \theta \leq 2\pi$. Now, draw a line that passes through the points $(0,0)$ and $P$. Solving for the equation, we have
\begin{align*}
    y - 0 &= \left(\frac{\sin\theta - 0}{\cos\theta - 0}\right)(x - 0) \\
    y &= \left(\frac{\sin\theta}{\cos\theta}\right)x \\
    y &= (\tan\theta)x
\end{align*}
Now, as $\theta < \frac{\pi}{2}$ approaches $\frac{\pi}{2}$, the slope increases without bound. Also, as $\theta > \frac{\pi}{2}$ approaches $\frac{\pi}{2}$, the slope decreases without bound. If $\tan\theta$ is continuous from $\theta_1 = \theta < \frac{\pi}{2}$ to $\theta_2 = \theta > \frac{\pi}{2}$, then for $\theta = \frac{\pi}{2}$, $\tan\theta$ must be something in between $\tan\theta_1$ and $\tan\theta_2$. However, almost all real numbers are a candidate for $\tan\theta$ and if it does equal a finite value, $m$, then as $\theta_1$ approaches $\frac{\pi}{2}$, $\tan\theta_1$ should decrease to equal $m$. We know that $\tan\theta_1$ increases as $\theta_1$ approaches $\frac{\pi}{2}$ which is a contradiction. Furthermore, as $\theta_2$ approaches $\frac{\pi}{2}$, $\tan\theta_2$ must increase to equal $m$ which is also not the case.
Therefore, we can say that $\tan\theta$ is undefined for $\frac{\pi}{2}$.
