# Why contraction mapping must require $f: ~A\to A$?

In the definition of contraction mapping, it requires:

$$(1)$$ the function $$f$$ must map the domain $$A$$ to $$A$$, where $$A\subseteq\mathbb{R}$$.

$$(2)$$ There exists a constant $$0, such that $$\forall x,y\in A, |f(x)-f(y)|\le c|x-y|$$

My question is, why it must require $$(1)$$, and is there a counter-example such that $$f: A\to B$$, where $$A\neq B$$, but it is not a contraction mapping? To make this counter-example more strong, assume both $$A$$ and $$B$$ are compact sets.

In this post, it shows $$\cos(x)$$ is a contraction mapping on $$[0, \pi]$$, but clearly it is not a $$A\to A$$ mapping.

• You could let $B$ be a single point and $f$ be a constant map from any metric space $A$ to $B$. Then $f$ satisfies the conditions of the contraction mapping theorem but has no fixed points if the point in $B$ is not in $A$. Commented Aug 10, 2022 at 4:49
• $f(x)=\frac 1 2 x+2$ from $[0,1] \to [2,3]$. Commented Aug 10, 2022 at 4:54
• What do you mean by a counterexample? You gave a definition. Do you mean the contraction mapping theorem, which says a contraction from a set to itself has a fixed point?
– Alan
Commented Aug 10, 2022 at 5:21
• Thank you! So the only motivation to require $f: A\to A$ is to make sure the fixed point $f(x_p)$ is reachable, right? In other words, if $x_p\in A\cap B,$ then we can allow $f: A\to B,~A\neq B$, right? @Zarrax Commented Aug 10, 2022 at 14:57
• Thank you for this example! @geetha290krm Commented Aug 10, 2022 at 14:57

The general idea of a contraction mapping is that it shrinks the distance between any two points. It is easy to generalize the idea, let $$f: (A,d_a) \rightarrow (B,d_b)$$, f is a contraction if $$d_b(fx, fy) \leq \alpha d_a(x,y)$$ for some $$\alpha < 1$$.
Since you mention compactness, it is possible that you are discussing this in the context of fixed point theorem. But if $$(A,d_a), (B,d_b)$$ share no points, then it is impossible that there will be any $$x$$ such that $$f(x) = x$$.
• Thank you for the explanation! So the only motivation to require $f: A\to A$ is to make sure the fixed point $f(x_p)$ is reachable, right? In other words, if $x_p\in A\cap B,$ then we can allow $f: A\to B,~A\neq B$, right? Commented Aug 10, 2022 at 14:56
• @MathFail we can allow that it be a contraction mapping, but that doesn't mean that $x_p$ is your desired fix point. Commented Aug 10, 2022 at 17:35
• @MathFail I haven't worked it out, so take it with a grain of salt, but if f: A $\rightarrow$ B, then we can't necessarily iterate it on itself. Typically fix point theorem is proved by iterating f repeatedly. Hence just because A, B share a point does not mean that we can prove fixpoint theorem. Commented Aug 10, 2022 at 20:08