Linear and Affine

The concepts of linearity and affinity appear frequently in mathematics, because linear and affine functions and linear equations are omnipresent. They occur particularly frequently in linear algebra and analysis.

This page defines the two terms and highlights their differences. The distinction between linear and affine is important, because the term “linear” is often used in some branches of mathematics (such as analysis) for functions that are not truly linear (in the sense of the definition below) but in fact affine. In the end, it is just nomenclature and what is important is that the reader is aware of the mathematical properties that are meant. This short article aims to prevent any confusion.

At the very end of this article, we also introduce the terminology of control affine, which appears in control theory and is based on these mathematical definitions.

Linear

A linear mapping or linear function \(f: V \rightarrow W\) between two vector spaces \(V\) and \(W\) over the same field \(K\) satisfies the following two conditions. For any vectors \(\mathbf{x}, \mathbf{y} \in V\) and scalar \(\lambda \in K\):

  • Additivity: \(f(\mathbf{x}+\mathbf{y}) = f(\mathbf{x}) + f(\mathbf{y})\)
  • Homogeneity of Degree 1: \(f(\lambda \mathbf{x}) =\lambda f(\mathbf{x})\)

A linear map preserves the operations of vector addition and scalar multiplication of the two vector spaces and is therefore often also called a vector space homomorphism (see our linear algebra primer for more details).

Representing the linear map by matrix multiplication, as is customary in linear algebra when working with specific bases, a linear map can be written as

$$f(\mathbf{x}) = A\mathbf{x},$$

where \(A\) denotes the matrix of the linear map \(f\) with respect to the bases chosen in \(V\) and \(W\). In this notation, the entries of matrix \(A\) are from field \(K\) and \(\mathbf{x}\) is an \(n\)-tuple of vector coefficients with respect to the chosen basis in \(V\).

If \(V\), \(W\) and \(K\) are simply \(\mathbb{R}\), then such a linear function has the form

$$f(x) = ax,$$

where \(a\in\mathbb{R}\) is a constant, the slope of the function. The graph of such a function is a straight line going through the origin (zero point) of the coordinate system. If some of the above mathematical jargon confuses you, just remember this last formula—this is linear.

Affine

Affine functions are linear functions with an additional constant offset. Using the same definitions as above, an affine map can be written as

$$ f(\mathbf{x}) = A\mathbf{x} + \mathbf{b},$$

where \(\mathbf{b}\) is some fixed vector in \(W\), which provides a translation. The affine map is thus a linear map with a fixed translation added. It does not satisfy the conditions of linearity and homogeneity of degree 1 stated above.

Again, if \(V\), \(W\) and \(K\) are simply \(\mathbb{R}\), then affine functions have the form

$$f(x) = ax+b,$$

where \(a, b \in \mathbb{R}\) are both constants. \(a\) is the slope of the function, whereas \(b\) is the vertical axis intercept. The graph of an affine function is still a straight line, but it does not pass through the origin of the coordinate system. Such affine functions are a polynomial of first order or less. Remember the above formula an associate it with the adjective “affine”.

Often such affine functions are also called “linear” functions in some branches of mathematics, because their graphs are straight lines. However, they do not actually satisfy the additivity and homogeneity conditions of linearity stated earlier above, and are therefore more precisely called affine. Always pay attention and be aware of what is actually meant, when the word “linear” is used.

Control Affine (in Control Theory)

We will encounter the concept of affinity in control theory, for instance, during nonlinear dynamic inversion, when we discuss modern flight control systems. There we will assume that the way the control input \(u(t)\) enters the equation of motion of the system is control affine, i.e. the control input appears in the equation as

$$ \dot{\mathbf{x}} = f(\mathbf{x}) + g(\mathbf{x}) u(t) $$

where \(\mathbf{x}\) in this case denotes the state of the system (position, velocity, etc.). One can see that this has the same shape as the generic affine function \(f(x)=b+ax\) encountered above, with control input \(u(t)\) playing the role of \(x\), \(f()\) playing the role of \(b\), and \(g()\) playing the role of \(a\). One term of the right hand side of the equation does not depend on \(u(t)\) at all, while a second term, which is added to the first, depends on \(u(t)\) linearly (i.e. to the power of 1, not squared or some higher power or via some other complicated function, such as a trigonometric function).


Such control affine systems arise in control theory quite naturally. A mass-spring-damper system (harmonic oscillator), for example, with a (potentially position- and velocity-dependent) external forcing function \(F(x, \dot x, t):=h(x, \dot x)u(t)\) with time-dependent control input \(u(t)\) is control affine. The system’s equation of motion

$$ m\ddot x + d\dot x + kx = F(x, \dot x, t) $$

can be written by rearranging terms as

$$ \ddot x = – \frac{d}{m} \dot x – \frac{k}{m} x + \frac{h(x, \dot x)}{m}u(t),$$

which has the form

$$ \ddot x = f(x, \dot x) + g(x, \dot x) u(t)$$

that we have previously defined as being control affine, if we set \(f(x, \dot x):= – \frac{d}{m} \dot x – \frac{k}{m} x\) and \(g(x, \dot x):=\frac{h(x, \dot x)}{m}\).