$ \lim_{x \to \infty} f(x) = a$? Let $g(y)$ be a continuous function defined for sufficiently large real numbers and $\displaystyle \lim_{y \to \infty} g(y) = \infty$.
Does $\displaystyle \lim_{y \to \infty} f(g(y)) = a$ implies $\displaystyle \lim_{x \to\infty} f(x) = a$ ?
I asked this question because I wanted to solve the above exercise from Lang's Undergraduate Analysis.($f(x) = x^x$. The solution is by Rami Shakarchi.)
I think Rami Shakarchi uses the result of my question.
 A: Consider some $M$ such that $M = g(y_0)$ for some $y_0\in \mathbb{R}$. Then, consider any $\{x_n\}_{n=1}^{\infty}\subset \mathbb{R}$ (without loss of generality, let $x_n$ be increasing and let $x_n > M$ for all $n$).$^1$ As $\lim_{y\to \infty} g(y) = \infty$, we have some $y_0'\in \mathbb{R}$ such that $y_0' > y_0$ and $g(y_0') > x_1$. Then, there is a $y_1\in (y_0, y_0')$ such that $g(y_1) = x_1$ by the intermediate value theorem. Do this inductively: for all $n$, choose a $y_n'$ such that $y_n' > y_n$ and $g(y_n') > x_{n+1}$, and let $y_{n+1}\in (y_n, y_n')$ such that $g(y_{n+1}) = x_{n+1}$. Then, $$\lim_{n\to \infty} f(x_n) = \lim_{n\to \infty} f(g(y_n)) = a$$ Since this holds for any $\{x_n\}$, we have that $\lim_{x\to \infty} f(x) = a$.

$^1$We can enforce the first condition here because every sequence that diverges to $\infty$ has a subsequence that increases monotonically. If $\{x_n\}$ is a general sequence such that $x_n\to \infty$, then we can choose any subsequence of $\{x_n\}$, and that subsequence will have a further subsequence that is monotonically increasing and which when mapped under $f$ will have the limit $a$ by the above logic. If every subsequence of a sequence has a further subsequence that converges to the same limit $a$, then the sequence converges to $a$, so $f(x_n)\to a$. We can enforce the second condition because any subsequence that diverges to $\infty$ only has a finite number of terms that are less than or equal to $M$, so we can throw these away because they will not affect the behavior of $f(x_n)$ as $n\to \infty$.
A: Yes. 
Suppose not. Then we can take some $\varepsilon$ such that no matter how big $K$ is, $f(t)$ is more than $\varepsilon$ away from $a$ for some $t>K$. 
Now by assumption, there exists $M$ big enough that $f(g(y))$ is within $\varepsilon$ of $a$ when $y$ is bigger than $M$. Now let $K=f(M)$. By our first statement, there exists $t>K$ such that $f(t)$ is more than $\varepsilon$ away from $a$. But since $g(x)$ approaches infinity, there must be a point $y>M$ where $g(y)>t$. By the Intermediate Value Theorem, there is some $x\in(M,y)$ such that $g(x)=t$.
And now we have a contradiction: Since $x>M$, $f(g(x))$ is within $\varepsilon$ of $a$. However, $g(x)=t$, so by the definition of $t$, we know that $f(g(x))$ is more than $\varepsilon$ away from $a$. 
Incidentally, the continuity is really important. Otherwise, we could let $g$ be the floor function, and let $f$ be some function that gets close to $a$ for integers, but moves far away for values between integers.
