Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|cite|improve this question

migrated from Jan 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.

$f(x)=2x$ is linear and affine. $f(x)=2x+3$ is affine but not linear. – Rahul Jan 10 '13 at 18:39
A quick definition for linearity would be "$f(x)$ is linear if $f(\alpha x_1+\beta x_2)=\alpha f(x_1)+\beta f(x_2)$". This is coherent with the comment by @Rahul above. – Karlo Jun 8 at 15:51

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). While affine functions don't preserve the origin, they do preserve some of the other geometry of the space, such as the collection of straight lines.

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$.

share|cite|improve this answer
Affine functions preserve the distance between two points? – Jonas Meyer Sep 15 '14 at 2:59
An affine transformation does not necessarily preserve angles between lines or distances between points, though it does preserve ratios of distances between points lying on a straight line. From Wikipedia – paldepind Sep 20 '14 at 17:46
Fixed! Thanks for catching that; it's slightly unnerving that something so wrong survived for 18 months! – Matthew Pressland Sep 25 '14 at 8:59

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

share|cite|improve this answer
Not sure why this got downvoted, made the most sense to me. – Phil H Sep 25 '14 at 9:02
Probably because this is just a particular case. In general an affine space needs to be introduced. – Fizz Feb 8 '15 at 18:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.