Why can't $f(a) = f(b)$ in the intermediate value theorem. In calculus class the intermediate value theorem was introduced as follows:

If $f(x)$ is continuous on the interval $[a,b]$
If $f(a) \not = f(b)$
If $k \in [f(a),f(b)]$
Then $\exists c \in [a,b], f(c) = k $

However, I do not see why it is necessary that the second condition hold, because it is true that if $k\in[f(a),f(a)]$ then there exist such a $c$, namely $a$.
(Note that this theorem was stated for the reals only, but I am comfortable with general metric spaces, if that helps..)
 A: You ask if it is true that given continuous $f:[a,b]\to\mathbb{R}$ and $k$ lying between $f(a)$ and $f(b)$, but not strictly between, then we can find $c\in[a,b]$ such that $f(c)=k$.
Yes, it is true. If $f(a)=f(b)$, then $k$ must be $f(a)$, because that is the only value lying between $f(a)$ and $f(b)$, and hence we can take $c=a$. If $f(a)\ne f(b)$, then we can use the IVT. 
Why is the IVT not usually stated that way? Well it is usually stated that we can find $c\in(a,b)$, rather than $c\in[a,b]$, so it would become false if we did not require strict inequalities as shown by Silynn. But you could state it the way you suggest. However, once one way has got well established it is usually confusing to start using a subtly different way.
A: The Intermediate Value Theorem states:

Consider an interval $I=[a,b]$ in $\mathbb{R}$ and a continuous function $f:I \to \mathbb{R}$. Then there exists a number $c \in [a,b]$ such that $k:=f(c)$ is between $f(a)$ and $f(b)$, that is, $$f(a) < k < f(b)  \text{ or }  f(a) > k > f(b).$$

If $f(a)=f(b)$, then it is impossible to place the value $f(c)$ between $f(a)=f(b)$, and expect to have either relation of $f(a) < k < f(b)$ or $f(a) > k > f(b)$ satisfied.
A: So the issue is that usually the IVT is defined for open intervals. 
On an open interval with $f(a)=f(b)$ continuity does not guarantee that you can find $c\in(a,b)$ such that $f(c)=f(a)$.
For a counterexample, consider $f(x)=x^2-1$ for $a=-1$ and $b=1$.
A: If you allow $c$ to be in $[a,b]$, the result is trivially true: just let $c=a$. So the theorem should always be stated with an open interval in the conclusion: "$\exists c \in (a,b)$". Once you have this restriction on $c$, the theorem becomes false if you allow $f(a)=f(b)$ and $k \in [f(a), f(b)]$ (or even false if $f(a) \neq f(b)$, for that matter: requiring an open interval in the conclusion forces one in the hypothesis).
