# What is the difference between linear and affine function

I am a bit confused. What is the difference between a linear and affine function? Any suggestions will be appreciated

-

## migrated from stats.stackexchange.comJan 10 '13 at 18:01

This question came from our site for people interested in statistics, machine learning, data analysis, data mining, and data visualization.

Please stop misusing the site and ignoring attempts to inform you about correct site usage (e.g. here). I think it's time you read the faq and the way homework problems are handled before you continue posting questions. –  Macro Jan 10 '13 at 16:54
$f(x)=2x$ is linear and affine. $f(x)=2x+3$ is affine but not linear. –  Rahul Jan 10 '13 at 18:39

A linear function fixes the origin, whereas an affine function need not do so. An affine function is the composition of a linear function with a translation, so while the linear part fixes the origin, the translation can map it somewhere else.

As an example, linear functions $\mathbb{R}^2\to\mathbb{R}^2$ preserve the vector space structure (so in particular they must fix the origin). Affine functions, however, preserve the geometry, i.e. the distance between two points. Translations preserve this just fine, even though they don't fix the origin, so there are some affine functions which aren't linear.

If you choose a basis for vector spaces $V$ and $W$, and consider functions $f\colon V\to W$, then $f$ is linear if $f(v)=Av$ for some matrix $A$ (of the appropriate size), and $f$ is affine if $f(v)=Av+b$ for some matrix $A$ and vector $b\in W$.

-
An affine function is the composition of a linear function followed by a translation. $ax$ is linear ; $(x+b)\circ(ax)$ is affine. see Modern basic Pure mathematics : C.Sidney