Two continuous functions intersection Suppose $f,g:[a,b]\to\mathbb{R}$ are continuous functions such that
$f(a)\leq g(a)$ and $f(b)\geq g(b)$.
Prove that $f(c)=g(c)$ for at least one $c \in [a,b]$
okay now suppose that a is less than b and $f:[a,b]\to\mathbb{R}$ is a continuous function such that the range of f contains [a,b]. Prove that f has a fixed point
 A: Consider $h : [a,b] \rightarrow \mathbb{R}$ defined by $h(x) := f(x) - g(x)$. This function is continuous on $[a,b]$ and you know that 
$$h(a) = f(a) - g(a) \leq 0$$
and
$$ h(b) = f(b) - g(b) \geq 0.$$
Now apply the Intermediate Value Theorem to $h(x)$; there exists $c \in [a,b]$ such that $h(c) = 0$. But this means that $f(c) - g(c) = 0$, i.e. $f(c) = g(c)$.
Edit : 
Let's now discuss the second half. Let's suppose the trivial cases $f(a) = a$ and $f(b) = b$ do not occur.
Consider the function $g : [a,b] \rightarrow \mathbb{R}$ defined by $g(x) = x$; i.e. $g$ is the identity function on $[a,b]$. We will proceed just as in the first part by considering the continuous function $h :[a,b] \rightarrow \mathbb{R}$ defined by $h(x) := f(x) - g(x)$. We will consider two cases :


*

*Suppose that $f(a) < g(a)$. Since the range of $f$ contains $[a,b]$ there exists $d \in (a,b)$ such that $f(d) = b$. Then 
$$f(d) = b  > g(x),~~~~~~\forall x \in [a,d].$$
To sum up, $h(a) \leq 0$ and $h(d) \geq 0$. Apply the Intermediate Value Theorem to $h(x)$; there exists $c \in [a,d]$ such that $h(c) = 0$ which means that $f(c) = g(c) = c$;

*Suppose that $f(a) > g(a)$. Since the range of $f$ contains $[a,b]$ there exists $d \in (a,b)$ such that $f(d) = a$. Then 
$$f(d) = a  > g(x),~~~~~~\forall x \in (a,d].$$
To sum up, $h(a) \geq 0$ and $h(d) \leq 0$. Apply the Intermediate Value Theorem to $h(x)$; there exists $c \in [a,d]$ such that $h(c) = 0$ which means that $f(c) = g(c) = c$;

A: Let $h(x)=f(x)-g(x).$ Then $h$ is continuous and $h(a)\leq 0\leq h(b), $ so $h(c)=0$ for some $c\in [a,b].$ 
