# Linear function

In mathematics, the term linear function refers to a function that satisfies the following two properties:

$f(x + y) = f(x) + f(y)$
$f(ax) = af(x).$

Linear functions may be confused with affine functions. One variable affine functions can be written as $f(x) = mx + b$. Although affine functions make lines when graphed, they do not satisfy the properties of linearity.

## Vector spaces

In mathematics, a linear function means a function that is a linear map, that is, a map between two vector spaces that preserves vector addition and scalar multiplication. For example, if $x$ and $f(x)$ are represented as coordinate vectors, then the linear functions are those functions $f$ that can be expressed as

$f(x) = \mathrm{M}x,$

where M is a matrix. A function

$f(x) = mx + b$

is a linear map if and only if $b$ = 0. For other values of $b$ this falls in the more general class of affine maps.

Linear functions form the basis of linear algebra.