Proving the continuity of the tangent function from first principles Okay, so I'm finally actually stuck on a question. I don't really have an idea of how to go forward from where I'm stuck. The question is:
Prove that $\lim_{x \to x_0} \tan(x) = \tan(x_0)$, if $x \neq (n+\frac{1}{2})\pi for n \in \mathbb{Z}$. 

Proof Attempt:
Let $\epsilon>0$ be given. Then, we need a $\delta>0$ so that:
$$0<|x-x_0| < \delta \implies |\tan(x)-\tan(x_0)| < \epsilon$$
So, we play around with $|\tan(x)-\tan(x_0)|$:
$$|\tan(x)-\tan(x_0)| = |\frac{\sin(x-x_0)}{\cos(x)\cos(x_0)}| \leq \frac{|x-x_0|}{\cos(x)\cos(x_0)} < \frac{\delta}{|\cos(x)\cos(x_0)|}$$
I don't really know where to go from there? Like, I was thinking of letting $\delta = \epsilon \cdot |\cos(x)| \cdot |\cos(x_0)|$ but that would mean that my $\delta$ would depend on $x$. I'm not too sure if that's allowed. 
I was also thinking of using, maybe, the continuity of $\cos(x)$ by introducing a separate $\delta$ and taking the minimum of that $\delta$ and another random number but I'm not quite sure how that would help.
I would appreciate if someone could give me a good hint on how to continue. I don't mind a full proof as well but I'm probably not going to look at your proof till I've completely had it with this problem. 
Also, I know very well that I can prove this by showing that $\sin(x)$ and $\cos(x)$ are continuous, before showing that the ratio of two continuous functions is, itself, continuous. But I don't want to do it that way, if it's possible. 
 A: You have the right idea where you stated

I was also thinking of using, maybe, the continuity of $\cos(x)$ by introducing a separate $\delta$ and taking the minimum of that $\delta$ and another random number but I'm not quite sure how that would help.

However, you don't need a "random number". Instead, you can use that if the second $\delta$ is small enough, $\cos(x)$ is non-zero over it's entire range. For example, you have, for all integers $n$, that
$$x_0 \neq \left(n + \frac{1}{2}\right)\pi \tag{1}\label{eq1A}$$
This means there exists an integer $n_0$ such that
$$\left(n_0 + \frac{1}{2}\right)\pi \lt x_0 \lt \left((n_0 + 1) + \frac{1}{2}\right)\pi \tag{2}\label{eq2A}$$
Choose the second delta, call it $\delta_2$, so it's a fraction less than $1$ of the minimum of the difference between $x_0$ and $\left(n_0 + \frac{1}{2}\right)\pi$, and that of the difference between $\left((n_0 + 1) + \frac{1}{2}\right)\pi$ and $x_0$. Let's say, rather arbitrarily, this fraction is $\frac{1}{2}$. In this region, then, $\cos(x)$ is not $0$ for any $x \in (x_0 - \delta_2, x_0 + \delta_2)$.
Since you stated you would appreciate just a good hint, I believe this qualifies. Nonetheless, since you also don't mind a full proof, I've provided the rest of the solution below, but put them in spoilers below.
Using this concept, you get

$$\delta_2 = \left(\frac{1}{2}\right)\min\left(x_0 - \left(n_0 + \frac{1}{2}\right)\pi,\left((n_0 + 1) + \frac{1}{2}\right)\pi - x_0\right) \tag{3}\label{eq3A}$$

Next, you can reason as follows:

Since $\cos(x) \neq 0$ for any $|x - x_0| \lt \delta_2$, this means the absolute value of $\cos(x)$ in that region has a positive minimum value, say $m$.

This gives

$$0 \lt m \le |\cos(x)| \implies \frac{1}{|\cos(x)|} \le \frac{1}{m} \; \forall \; x \in (x_0 - \delta_2, x_0 + \delta_2) \tag{4}\label{eq4A}$$

Thus, continuing your line of inequalities, you then have for $x \in (x_0 - \delta_2, x_0 + \delta_2)$ that

$$|\tan(x)-\tan(x_0)| \lt \frac{\delta}{|\cos(x)\cos(x_0)|} \le \frac{\delta}{m|\cos(x_0)|} \tag{5}\label{eq5A}$$

You would then next use the following statement:

Since your final $\delta$ needs to be at least as small as $\delta_2$ because, for any value of $\delta_2$ which is used, any smaller value will also still fulfill all of the conditions.

You would then have

$$\delta = \min(\delta_2, \epsilon \cdot m \cdot |\cos(x_0)|) \tag{6}\label{eq6A}$$

Of course, there are simpler ways to prove the continuity of $\tan(x)$, such as using that $\sin(x)$ and $\cos(x)$ are continuous, which you've stated yourself, but this shows how you can also do it directly as well.
