Bounded subsets and bounded functions on a metric space In my metric spaces course I was given these two definions:

Definition 1: A subset $X \subseteq M$ of a metric space $(M,d)$ is said to be bounded in $M$ if for all $x,y\in X$ we have $d(x,y)\le c$ for some $c>0$.
Definition 2: Let $X$ be an arbitrary set. A function $f: X\to \mathbb{R}$ is said to be bounded if there is a $k>0$ such that $|f(x)|\le k$ for all $x\in X$.

Also I knew that this definition 3 is quite common:

Definition 3: Let $f:X\to Y$ be a function and $X,Y$ metric spaces. $f$ is said to be bounded if $f(X)$ is a bounded subset in $Y$.

It's easy to see that $2\Rightarrow 3$, but I am unable to prove that definitions 2 and 3 are equivalent, but, in a question that asks to prove that a real-valued function is bounded, I can't see weather it's talking about boundedness in the sense of definition 2 or defintion 3.
If definitions 2 and 3 are indeed equivalent, how can I show $3\Rightarrow 2$?
 A: Assume Definition 3. If $f : X \to \Bbb R$ is bounded, then $f(X)$ is a bounded subset of $\Bbb R$. This means there is some number $c > 0$ such that $\lvert f(x) - f(y)\rvert \le c$ for all $x,y\in X$. Fix $x_0\in X$ and set $k =  c + \lvert f(x_0)\rvert$. Then $k > 0$ and by the triangle inequality, $$\lvert f(x)\rvert  = \lvert [f(x) - f(x_0)] + f(x_0)\rvert\le \lvert f(x) - f(x_0)\rvert + \lvert f(x_0)\rvert \le c + \lvert f(x_0)\rvert = k$$
for all $x\in X$.
A: I don't see the point in proving equivalence between the two definitions as both have different ranges of application. In fact, definition $(2)$ is a special case of definition $(3)$ with the metric space$\mathit Y$ replaced by $\Bbb R$ and thus we can only show $(3) \Rightarrow(2)$.
For that, notice that $\mathit f(X)$ is bounded in $\mathit Y$ $\Rightarrow \exists \,x_0\in X\; and\,r \gt 0\ni \mathit f(X) \subset B_r(x_0)$ i.e. $\mathit f(X)$ is contained in some closed ball in $\mathit Y.$ (Generally open ball is used but we can also use its closure).Now in $(2)$, we have $\mathit Y = \Bbb R$ then the ball here is just an interval centered at $x_0$ and we have $$|f(x) - f(x_0)| \le r \;\forall x \in X.$$Thus $|f(x)|\le k \;\forall x∈X,$ where $k = r\,+ |x_0|$ by triangle inequality.
