TITLE: Why $\lim$ of $\cos(f)$ equals to $\cos$ of $\lim(f)$?
QUESTION [6 upvotes]: Let
$$\lim_{n\rightarrow \infty}\left(\cos\left(\frac{n\pi}{n+1}\right) \right) = \cos\left(\lim_{n\rightarrow \infty}\left(\frac{n\pi}{n+1} \right)\right)$$
Why the $\cos(x)$ function can be extracted outside of the limit equation? I know it has something to do with $\cos(x)$ being continuous, but not sure of the formal proof for that.

REPLY [4 votes]: If you don't remember what continuity is or how $\cos$ satisfies its definition, you can use the definition of $\cos(\theta)$ in which it is equal to the value of the $x$-coordinate of the endpoint of an arc of length $\theta$ traced counter-clockwise from $(1,0)$ along a unit circle centered at the origin, to prove geometrically that $$|\cos(\theta_2) - \cos(\theta_1)| \le |\theta_2 - \theta_1|.\tag{i}\label{i}$$ This is because a line segment is necessarily smaller or equal in length to any curve sharing the same endpoints, and each of the legs of a right triangle are necessarily smaller or equal to the hypotenuse.

This makes $\cos$ an example of a Lipschitz continuous function. 
Furthermore, since $$\lim_{n\rightarrow\infty} \frac{n\pi}{n+1} = \pi$$ this means that for any $\epsilon>0$ there exists $N$ such that if $n \ge N$ then $$\left|\frac{n\pi}{n+1} - \pi\right| < \epsilon.$$ Consequently, due to $\eqref{i}$, $$\left|\cos\left(\frac{n\pi}{n+1}\right) - \cos(\pi)\right| < \left|\frac{n\pi}{n+1} - \pi\right| < \epsilon.$$ Thus $$\lim_{n\rightarrow\infty} \cos\left(\frac{n\pi}{n+1}\right) = \cos(\pi) = -1$$