Function with finite domain can be linear? Consider a function $f:\mathcal{X}\rightarrow \mathcal{Y}$ prescribed by $f(x)=3x$, 
where $\mathcal{X}=\{1,2,3\}$ and $\mathcal{Y}\equiv \{3,6,9\}$.
Can we say that $f$ is linear? My confusion stems from the finite domain. 
 A: No because in general $f(ax)$ is not defined and cannot equal $af(x)$.
A: Typically we only ask if a function is linear if it is a function between vector spaces (a.k.a. linear spaces), or some other suitably structured set for which a notion of 'linearity' makes sense, such as a module over a ring.
A function $f$ between two such structures is then linear if it preserves the linear structure: this usually amounts to saying something like $f(ax+by) = af(x) +bf(y)$ for all vectors $x,y$ and all scalars $a,b$.
In this case, $\mathcal{X}$ and $\mathcal{Y}$ are just sets with three elements. They are certainly not vector spaces or modules over a ring, so it doesn't really make sense to ask if $f$ is linear.
As Yanko says in a comment, though, we can embed $\mathcal{X}$ and $\mathcal{Y}$ in the vector space $\mathbb{R}$, and then $f$ is the (co)restriction of a linear function $\mathbb{R} \to \mathbb{R}$ to a function $\mathcal{X} \to \mathcal{Y}$. However, there are also functions $\mathbb{R} \to \mathbb{R}$ which are not linear, but whose (co)restriction to $\mathcal{X}$ and $\mathcal{Y}$ is the function $x \mapsto 3x$. One example is $x \mapsto x^3-6x^2+14x-6$.
So is $f$ linear? Not really.
