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

• 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. Commented Jun 8, 2016 at 15:51
• @Karlo the comments are gone so your comment is confusing. Do you mind clarifying? perhaps the definition of affine might elucidate. Commented Aug 26, 2020 at 16:53
• @CharlieParker Thanks for pointing this out. I do not remember what it was about. Should I remove my comment? More information is given in the answers below. Commented Aug 27, 2020 at 15:13

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.

Linear functions between vector spaces 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 bases for vector spaces $V$ and $W$ of dimensions $m$ and $n$ respectively, and consider functions $f\colon V\to W$, then $f$ is linear if $f(v)=Av$ for some $n\times m$ matrix $A$ and $f$ is affine if $f(v)=Av+b$ for some matrix $A$ and vector $b$, where coordinate representations are used with respect to the bases chosen.

• 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 Commented Sep 20, 2014 at 17:46
• Fixed! Thanks for catching that; it's slightly unnerving that something so wrong survived for 18 months!
– mdp
Commented Sep 25, 2014 at 8:59
• @JonasMeyer I think your comment is wrong, because the linear transformation preserves the distance, while the affine transformation, on the other hand, does not have this property because it has a translational term. Commented Jul 11, 2019 at 10:26
• @godaygo: It was a question because I didn't understand what was intended in the original version of the answer. I deleted it because I just reread the answer and see that it was obsolete. Your comment is incorrect however, because neither linear transformations nor affine transformations typically preserve distance. The reason is not the translational term. A translation map does preserve distances. Commented Dec 2, 2019 at 4: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

• Not sure why this got downvoted, made the most sense to me. Commented Sep 25, 2014 at 9:02
• Probably because this is just a particular case. In general an affine space needs to be introduced. Commented Feb 8, 2015 at 18:16
• For those in need of a picture: thesciencepan.com/…
– Bart
Commented Aug 10, 2022 at 14:35

An affine function between vector spaces is linear if and only if it fixes the origin.

In the simplest case of scalar functions in one variable, linear functions are of the form $f(x)=ax$ and affine are $f(x)=ax +b$, where $a$ and $b$ are arbitrary constants.

More generally, linear functions from $\mathbb{R}^n$ to $\mathbb{R}^m$ are $f(v)=Av$, and affine functions are $f(v)=Av +b$, where $A$ is arbitrary $m\times n$ matrix and $b$ arbitrary $m$-vector. Further, $\mathbb{R}$ can be replaced by any field.

More abstractly, a function is linear if and only if it preserves the linear (aka vector space) structure, and is affine if and only if it preserves the affine structure. A vector space structure consists of the operations of vector addition and multiplication by scalar, which are preserved by linear functions:

$$f(v_1+v_2) = f(v_1) + f(v_2), \quad f(kv) = k f(v).$$

An affine structure on a set $S$ consists of a transitive free action $(v,s)\to v + s$ by a vector space $V$ (called the associated vector space). Informally, $v+s\in S$ is the translation of the point $s\in S$ by the vector $v\in V$, and for any pair of points $s_1, s_2\in S$, there is an unique translation vector $v\in V$ with $v + s_1=s_2$, also written as $v = \overrightarrow{s_1 s_2}$. Then a function between two affine spaces $S$ and $T$ (i.e. sets with affine structures) is affine if and only if it preserves the structure, that is

$$f(v + s) = h(v) + f(s)$$

where $h$ is a linear function between the corresponding associated vector spaces.

$(1)$Linear continuous Functional equations of the Form: $$F(\alpha x +\delta y)= \alpha F(x) + \delta F(y)$$;

or rather 1- point homogeneity

$(1a)$ (often with Cauchy's equation as well), as in the above post. However, sometimes Cauchy's equation is not needed in addition to $(1a)$ if one can get to it $(1a)$ (for all reals) directly, which is not generally the case.

$(2)$Affine of the form;

Continuous Function Form: $$\forall (x,y)\in \mathbb{R}F((1-t) x + t y)= tF(y) +(1-t)F(y); t\in [0,1]$$ ie:'concave and convex' .

*Or is it $\forall (x,y)\in$ $\text{dom(F)}$ or $\forall (x,y)\in$[0,1]$? For(2) Function Form: $$F(x)=Ax+B$$ Where$A$is an arbitrary constant (1a)$$\forall x\in \mathbb{R},\forall \delta \in \mathbb{R}:F(\delta x)=\delta F(x)$$ (1/1a) Linear Function: $$F(x)=Ax$$(in this case$A=F(1)$) One always (or nearly always) needs to derive Cauchy's equation beforehand, to derive$(1a)$for all rational numbers. And then a weak regularity requirement, generally, given Cauchy's equation, to extend homogeneity to all reals ie to get to equation$(1a)$) Sometimes on can extend it to the algebraic irrationals given the field auto-morph-ism equations, although they 'apparently' already specify the function and grant continuity I have some issues with that (but that another story; vis a vis- the trans-transcendental numbers). In both cases, I may have accidentally may be restricted domain to$[0,1]$but are in their continuous forms, so that in some sense they are now function rather than functional equations . Or rather in a functional form from which the function should be directly derivable; as opposed to 'the general (often continuous) solution to Cauchy equation or Jensen's equation etc). Although that may not be quite correct. I think that sometimes convex functions (presumably not convex and concave ones but I might be wrong) can have trouble with continuity at the end points . However, I presume they are ruled as degenerate or not possible in the current system, ie not Lebesgue measurable. And often that is when one is speaking of midpoint convexity or Jensen's equation rather than their,already, or (possibly) allegedly already, continuous versions$(1)$and$(2)$. I am just being tentative about$(2)$here. I am not disputing anything, I just want to be careful. Generally unless it is not restricted to an interval (or real line version). interval (there is presumably a real line generalization). Notice that delta is restricted here, one cannot solve for the origin directly. I presume that$(2)$is just the real line version$(2)$of convexity and concavity perhaps. once the origin has been fixed. In (2) One cannot solve for$F(0)=0$,or directly solve for$F(1)=a$; for$F(x)=ax$, but only that$F(0)=b$for$F(x)=ax+b$. Although I think that both$(1)$and$(2)$are the restricted versions to the unit range, but with$F(0)$being directly incorporated into$(1)$. As one can set$a=1$and$b=1$,$x=0$,$y=0$To get$[F(0)=2F(0)]\,\Rightarrow\,F(0)=0$in$(1)$But one cannot do so in$(2)$. As there is only one free parameter, so that one always gets$F(0)=F(0)$I suppose one gets that (I think/perhaps) (2a)$$F(tA)= t(F(A)-F(0)] +F(0)$$ Where $$F(A)$$ is the F(max element of domain; when$A$positive or increasing) or $$F(A)=F(1)-F(0)$$ here. I am not sure if$(2)$, in this form,$F$is defined only the domain$[0,1]$. However, its unclear whether$F(x)=ax+b$falls out/(is derivable) of$(2)$As directly as$F(x)=Ax$(is derivable)/falls out of$(1)$. I am probably using the wrong version confined to that domain$[0,1]\$ domain).

$$f(x) = a + bx$$
where $$a$$ and $$b$$ are independent of $$x$$ (not necessarily Real). For example, $$f(n) = a + bn$$, where $$n \in N$$ is an affine function over the Natural number set $$N$$.
A linear function in the French sense is an affine function that passes through the origin, that is $$a=0$$ and $$f(x)=bx$$ for some number $$b$$ independent of $$x$$.