In calculus and related areas of mathematics, a linear function from the real numbers to the real numbers is a function whose graph (in Cartesian coordinates) is a non-vertical line in the plane. The characteristic property of linear functions is that when the input variable is changed, the change in the output is proportional to the change in the input.
Linear functions are related to linear equations.
A linear function is a polynomial function in which the variable x has degree at most one:
Such a function is called linear because its graph, the set of all points in the Cartesian plane, is a line. The coefficient a is called the slope of the function and of the line (see below).
If the slope is , this is a constant function defining a horizontal line, which some authors exclude from the class of linear functions. With this definition, the degree of a linear polynomial would be exactly one, and its graph would be a line that is neither vertical nor horizontal. However, in this article, is required, so constant functions will be considered linear.
If then the linear function is said to be homogeneous. Such function defines a line that passes through the origin of the coordinate system, that is, the point . In advanced mathematics texts, the term linear function often denotes specifically homogeneous linear functions, while the term affine function is used for the general case, which includes .
The natural domain of a linear function , the set of allowed input values for x, is the entire set of real numbers, One can also consider such functions with x in an arbitrary field, taking the coefficients a, b in that field.
The graph is a non-vertical line having exactly one intersection with the y-axis, its y-intercept point The y-intercept value is also called the initial value of If the graph is a non-horizontal line having exactly one intersection with the x-axis, the x-intercept point The x-intercept value the solution of the equation is also called the root or zero of
The slope of a nonvertical line is a number that measures how steeply the line is slanted (rise-over-run). If the line is the graph of the linear function , this slope is given by the constant a.
The slope measures the constant rate of change of per unit change in x: whenever the input x is increased by one unit, the output changes by a units: , and more generally for any number . If the slope is positive, , then the function is increasing; if , then is decreasing
In calculus, the derivative of a general function measures its rate of change. A linear function has a constant rate of change equal to its slope a, so its derivative is the constant function .
The fundamental idea of differential calculus is that any smooth function (not necessarily linear) can be closely approximated near a given point by a unique linear function. The derivative is the slope of this linear function, and the approximation is: for . The graph of the linear approximation is the tangent line of the graph at the point . The derivative slope generally varies with the point c. Linear functions can be characterized as the only real functions whose derivative is constant: if for all x, then for .
A given linear function can be written in several standard formulas displaying its various properties. The simplest is the slope-intercept form:
from which one can immediately see the slope a and the initial value , which is the y-intercept of the graph .
Given a slope a and one known value , we write the point-slope form:
In graphical terms, this gives the line with slope a passing through the point .
The two-point form starts with two known values and . One computes the slope and inserts this into the point-slope form:
Its graph is the unique line passing through the points . The equation may also be written to emphasize the constant slope:
Linear functions commonly arise from practical problems involving variables with a linear relationship, that is, obeying a linear equation . If , one can solve this equation for y, obtaining
where we denote and . That is, one may consider y as a dependent variable (output) obtained from the independent variable (input) x via a linear function: . In the xy-coordinate plane, the possible values of form a line, the graph of the function . If in the original equation, the resulting line is vertical, and cannot be written as .
The features of the graph can be interpreted in terms of the variables x and y. The y-intercept is the initial value at . The slope a measures the rate of change of the output y per unit change in the input x. In the graph, moving one unit to the right (increasing x by 1) moves the y-value up by a: that is, . Negative slope a indicates a decrease in y for each increase in x.
For example, the linear function has slope , y-intercept point , and x-intercept point .
Suppose salami and sausage cost €6 and €3 per kilogram, and we wish to buy €12 worth. How much of each can we purchase? If x kilograms of salami and y kilograms of sausage costs a total of €12 then, €6×x + €3×y = €12. Solving for y gives the point-slope form , as above. That is, if we first choose the amount of salami x, the amount of sausage can be computed as a function . Since salami costs twice as much as sausage, adding one kilo of salami decreases the sausage by 2 kilos: , and the slope is −2. The y-intercept point corresponds to buying only 4 kg of sausage; while the x-intercept point corresponds to buying only 2 kg of salami.
Note that the graph includes points with negative values of x or y, which have no meaning in terms of the original variables (unless we imagine selling meat to the butcher). Thus we should restrict our function to the domain .
Also, we could choose y as the independent variable, and compute x by the inverse linear function: over the domain .
If the coefficient of the variable is not zero (a ≠ 0), then a linear function is represented by a degree 1 polynomial (also called a linear polynomial), otherwise it is a constant function – also a polynomial function, but of zero degree.
A straight line, when drawn in a different kind of coordinate system may represent other functions.
For example, it may represent an exponential function when its values are expressed in the logarithmic scale. It means that when log(g(x)) is a linear function of x, the function g is exponential. With linear functions, increasing the input by one unit causes the output to increase by a fixed amount, which is the slope of the graph of the function. With exponential functions, increasing the input by one unit causes the output to increase by a fixed multiple, which is known as the base of the exponential function.
If both arguments and values of a function are in the logarithmic scale (i.e., when log(y) is a linear function of log(x)), then the straight line represents a power law:
On the other hand, the graph of a linear function in terms of polar coordinates:
is an Archimedean spiral if and a circle otherwise.