218

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

Willie Wong
  • 68,963
  • 11
  • 143
  • 246
user34790
  • 3,772
  • 4
  • 20
  • 26
  • 4
    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 08 '16 at 15:51
  • 2
    @Karlo the comments are gone so your comment is confusing. Do you mind clarifying? perhaps the definition of affine might elucidate. – Charlie Parker Aug 26 '20 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. – Karlo Aug 27 '20 at 15:13

5 Answers5

197

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.

Dmitri Zaitsev
  • 529
  • 6
  • 11
mdp
  • 13,771
  • 1
  • 34
  • 61
  • 15
    _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](http://en.wikipedia.org/wiki/Affine_transformation) – paldepind Sep 20 '14 at 17:46
  • 4
    Fixed! Thanks for catching that; it's slightly unnerving that something so wrong survived for 18 months! – mdp Sep 25 '14 at 08: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. – godaygo Jul 11 '19 at 10:26
  • 1
    @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. – Jonas Meyer Dec 02 '19 at 04:59
33

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

Nicholas Stull
  • 2,974
  • 14
  • 22
kozenko
  • 621
  • 7
  • 4
  • 2
    Not sure why this got downvoted, made the most sense to me. – Phil H Sep 25 '14 at 09:02
  • 3
    Probably because this is just a particular case. In general an [affine space](http://en.wikipedia.org/wiki/Affine_space) needs to be introduced. – Fizz Feb 08 '15 at 18:16
28

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.

Dmitri Zaitsev
  • 529
  • 6
  • 11
4

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

William Balthes
  • 552
  • 1
  • 5
  • 16
1

Answer for any confused French reader.

In France/French, the distinction between linear and affine appears to be different from other countries.

An affine function in the French sense is a any function that may be written

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

Reference: wiki/Fonction_affine

PatrickT
  • 180
  • 2
  • 13