Why is $\tan(x)$ a function? A function $f:X\rightarrow Y$ maps each $x\in X$ to some $y \in Y$. So consider $\tan{\frac{\pi}{2}}$ for which $\tan(x)$ is undefined, so in this case, $\tan(x)$ does not map to an element of its range. This conflicts with my understanding of what a function is. Why do we still consider $\tan(x)$ a function?
 A: When you say $f$ is a function, you should specify its domain (and codomain, but that's not really the issue here). If the domain is not specified, we take it to be the largest set on which the expression is defined. As you've pointed out $\tan$ is not defined at $\frac{\pi}{2}$ (so you should not even write $\tan\frac{\pi}{2}$ as this means the value of the function $\tan$ at the point $\frac{\pi}{2}$). Furthermore, $\tan$ is undefined at $\frac{\pi}{2} + k\pi$ for every integer $k$. Therefore, the largest set on which $\tan$ is defined is $\mathbb{R}\setminus\{\frac{\pi}{2}+k\pi\mid k \in \mathbb{Z}\}$; this is the domain of $\tan$ if the domain is unspecified.
A: The set $X$ in your definition is the domain of the function.  The domain of $\tan(x)$ is typically taken to be 
$$
X=\bigcup_{k\in\Bbb{Z}} \left(-\frac{\pi}{2}+k\pi,\frac{\pi}{2}+k\pi\right)
$$
Thus $\pi/2\notin X$, and so don't need to assign a value to $\tan(\pi/2)$ (or for any $\pi/2+k\pi,k\in\Bbb{Z}$ for that matter). 
A: Actually that is the definition of a continuous function. The definition for a function is that for all inputs there is exactly one output. In a non-continuous function, when the input doesn't map to anything, it is not in the domain. So if f(pi/2) is undefined, pi/2 is not in the domain and therefore not an input.
