6 LINEAR FUNCTIONS
6.1. Linear and affine functions
Definition
Linear functions are functions which preserve scaling and addition of the input argument. Affine functions are ‘‘linear plus constant’’ functions.
Formal definition, linear and affine functions. A function is linear if and only if preserves scaling and addition of its arguments:
- for every , and , ; and
- for every , .
A function is affine if and only if the function with values is linear.
An alternative characterization of linear functions:
A function is linear if and only if either one of the following conditions hold. 1. preserves scaling and addition of its arguments: – For every in , and in , ; and – For every in , . 2. vanishes at the origin: , and transforms any line segment in into another segment in :
3. is differentiable, vanishes at the origin, and the matrix of its derivatives is constant: there exist in such that
|
Example 1: Consider the functions with values |
|
|
|
The function is linear; is affine; and is neither. |
Connection with vectors via the scalar product
The following shows the connection between linear functions and scalar products.
Theorem: Representation of affine function via the scalar product
A function is affine if and only if it can be expressed via a scalar product:
for some unique pair , with and , given by , with the -th unit vector in , , and . The function is linear if and only if . |
The theorem shows that a vector can be seen as a (linear) function from the ‘‘input“ space to the ‘‘output” space . Both points of view (matrices as simple collections of numbers, or as linear functions) are useful.
Gradient of an affine function
The gradient of a function at a point , denoted , is the vector of first derivatives with respect to (see here for a formal definition and examples). When (there is only one input variable), the gradient is simply the derivative.
An affine function , with values has a very simple gradient: the constant vector . That is, for an affine function , we have for every :
Example 2: gradient of a linear function: |
Consider the function , with values . Its gradient is constant, with values |
|
For a given in , the -level set is the set of points such that : |
|
The level sets are hyperplanes, and are orthogonal to the gradient. |
Interpretations
The interpretation of are as follows.
- The is the constant term. For this reason, it is sometimes referred to as the bias, or intercept (as it is the point where intercepts the vertical axis if we were to plot the graph of the function).
- The terms , , which correspond to the gradient of , give the coefficients of influence of on . For example, if , then the first component of has much greater influence on the value of than the third.
See also: Beer-Lambert law in absorption spectrometry.
6.2. First-order approximation of non-linear functions
Many functions are non-linear. A common engineering practice is to approximate a given non-linear map with a linear (or affine) one, by taking derivatives. This is the main reason for linearity to be such an ubiquituous tool in Engineering.
One-dimensional case
Consider a function of one variable , and assume it is differentiable everywhere. Then we can approximate the values function at a point near a point as follows:
where denotes the derivative of at .
Multi-dimensional case
With more than one variable, we have a similar result. Let us approximate a differentiable function by a linear function , so that and coincide up and including to the first derivatives. The corresponding approximation is called the first-order approximation to at .
The approximate function must be of the form
where and . Our condition that coincides with up and including to the first derivatives shows that we must have
where the gradient of at . Solving for we obtain the following result:
Theorem: First-order expansion of a function.
The first-order approximation of a differentiable function at a point is of the form
where is the gradient of at . |
Example 3: a linear approximation to a non-linear function |
Consider the log-sum-exp function |
|
admits the gradient at the point given by |
|
Hence can be approximated near by the linear function |
|
6.3. Other sources of linear models
Linearity can arise from a simple change of variables. This is best illustrated with a specific example.
Example: Power laws.