Let $f:[a,+\infty] \to \mathbb R$ is continuous and the lim as x approaches $+\infty$ is $l$, $l \in \mathbb R, f(a)<l$. Prove that the function is bounded and it attains its minimum.
I proved that the function is bounded but I don't know how the show that it attains its minimum. My thoughts: If f is bounded that means there exists $\inf\{f(x) | x \in [a,+\infty] \}=k$. So we have to choose $\epsilon$ such that there exists a real number $M$ such that for every $x>M: |f(x)-l|< \epsilon$. Therefore, I will find the minimum in the interval $[a,M]$. But I don't know how to find $\epsilon$.
Let $\epsilon=l-f(a)>0,$
then $\exists M>0, \forall x > M, |f(x)-l|<\epsilon = l-f(a)$
Hence $\forall x > M, f(x) > l -(l-f(a))=f(a)$,
Hence the minimum is in the interval $[a,M]$ which is a compact set.