max/min and compactness if $f(x)=\frac{1}{1+x^2}$ and $-\infty<x<\infty$, show that $f$ attains a $max$ but does not attain a $min$.
what I ve learnt so far is that :
if $f$ is a real valued function from a compact metric space, then $f$ attains a max and min at some point of $M$.
if $f$ is a real valued function from a closed bounded set, then $f$ attains a max and min at some point of that set. 
I believe I must be able to apply any of these two statements to analyse such questions. right?
Now since $-\infty<x<\infty$ and not closed in $R$, so I ignore the second statement.
but for the first statement since $-\infty<x<\infty$ represents real numbers $R$, and we know $R^n$ is not compact, so the first statement does not apply!
Well this is an excercise after those two statements. how are they going to help then?
 A: To maximize $f(x)$, you need to minimize the denominator. The minimum value of the denominator is 1 because $x^2 \ge 0$. But there is no way to minimize $f(x)$ as we can keep increasing the value of $x$ which will make it smaller and smaller.
A: To show the max of $f$ is $f(0)=1$, here's one way:
$f(x)=\frac{1}{1+x^2}\leq\frac{1}{1}=1$ so $1$ is an upper bound. Therefore, $\sup f(x) \leq 1$. At the same rate $f(0)=1$ shows all upper bounds most be at least $1$. Therefore, $\sup f(x)\geq 1$. Therefore, $\sup f(x)=1$ and $f(0)=\sup f(x)$ so $f$ has a maximum.
For the next part, $f(x)\geq 0$ so $0$ is a lower bound. Therefore, $\inf f(x)\geq 0$. Suppose $\inf f(x)>0$. Choose $\epsilon$ such that $0<\epsilon<\inf f(x)$. Then $\epsilon$ is a lower bound for $f$ so $f(x)\geq \epsilon$ for all $x$. We arrive at a contradiction by finding $x$ such that $f(x)<\epsilon$.
Solving $\frac{1}{1+x^2}<\epsilon \implies 1<\epsilon(1+x^2)\implies \frac{1-\epsilon}{\epsilon}<x^2\implies x>\sqrt{\frac{1-\epsilon}{\epsilon}}$ or $x< -\sqrt{\frac{1-\epsilon}{\epsilon}}$. Pick any such $x$ and we have a contradiction. Therefore, $\inf f(x)=0$.
If $f$ has a minimum, there must exist $x_0$ such that $f(x_0)=0$. But then $\frac{1}{1+x_0^2}=0$, which implies $1=0$, a contradiction. Thus, $f$ has no minimum.
Remark: The two statements you provided aren't enough. The space is not compact so you really have to perform the analysis.
