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 1. – For every – For every 2.
3.
|
Example 1: Consider the functions ![]() |
|
|
|
The function ![]() ![]() ![]() |
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
for some unique pair |
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 ![]() ![]() |
|
For a given ![]() ![]() ![]() ![]() |
|
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 where |
Example 3: a linear approximation to a non-linear function |
Consider the log-sum-exp function |
|
admits the gradient at the point ![]() |
|
Hence ![]() ![]() |
|
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.