# Continuity question.

Gold Member
i have a continuous function f:R->R and we are given that lim f(x)=L as x approaches infinity and limf(x)=L as x approaches minus infinity, i need to prove that f gets a maximum or minimum in R.

obviously i need to use weirstrauss theorem, but how to implement it in here.
i mean by defintion:
Ae>0,EM_e,Ax>=M_e, |f(x)-L|<e
Ae>0,Em_e,Ax<=m_e,|f(x)-L|<e

so if we look at the intervals:
[M1,M2],[M1,M3]....
[m2,m1],[m3,m1]....
in each interval the function gets a maximum and minimum by the theorem i quoted above, at the capital M's as x ais bigger than M1 its interval of f is increased i.e for x>=M1 L-1<f(x)<L+1 for x >=M2 L-2<f(x)<L+2 so it means the maximum in the first interval isnt bigger than the maximum in the second interval (the problem is i cannot say the same about the minimum).
now if f has a maximum then we finished if it doesnt then i should show it has a minimum, but if it doesnt have a maximum then each maximum in the intervals is bigger than the previous one, but we have that there isnt a maximum.
here im stuck and i dont know how to procceed from here, any help will be appreciated.