TITLE: A certain kind of non-linear mapping from $\mathbb{R}^2$ to $\mathbb{R}^2$
QUESTION [8 upvotes]: Give an example of a map $T:\mathbb{R}^2\rightarrow\mathbb{R}^2$ with both of the following properties:
a. $T(kx)=kT(x)$ for all $x\in \mathbb{R}^2, k\in \mathbb{R}$
b. $T$ fails to be a linear transformation
I am really stuck on this. I can only find matrices that are not linear transformations and don't fulfill the first condition, or they are linear transformations and they do fulfill the first condition. I am not sure how to go about doing this.

REPLY [8 votes]: What about
$f(x,y) = \begin{cases}  (0,0) & x \ne 0 \\ (x,y) & x = 0\end{cases}\\$
Conceptually, the given condition requires that if we restrict $f$ to any line through the origin, it is linear.  Since each of those lines only overlaps at the origin, we can construct $f$ easily by constructing its value on each of those lines one by one.
In this case, we choose $f$ to be zero on every line except on the y axis.  On the y axis, it just looks like a the identity function.  The function constructed this way is not linear because its value on the y axis doesn't "agree" with its value everywhere else.  If we try to check whether the law of linearity applies, we check two points $p_1, p_2$, and verify that
$f(p_1 + p_2) = f(p_1) + f(p_2)$
Now, if both $p_1$ and $p_2$ are on the y axis, or both of them are not on the y axis, this equality will hold.  However, if one of them is on the y axis and the other isn't, you'll run into problems.  For example:
$p_1 = (1,0)$
$p_2 = (1,1)$
$f(p_1+p_2) = f(2,1) = (0,0)$
$f(p_1) + f(p_2) = (1,0) + (0,0) = (1,0)$
In general, you can see that there are infinitely many ways that we could choose different linear functions on all the lines through the origin and "piece together" a novel f that violates the constraints, even a continuous or differentiable one, as other people have demonstrated.