Linear function

In basic mathematics, a **linear function** is a function whose graph is a straight line in 2-dimensions (2D, see images).  An example is: _y_=2_x_–1. In higher mathematics, a linear function often refers to a linear mapping.

## Basic Properties

Formally, a linear function is a function _f_(_x_):**R**→**R** such that the graph of _f_ is a line. This means the domain or input of _f_ is a real number **R** and the range or output of _f_ is also a real number **R**. Usually we write _y_(_x_) or just _y_ in place of _f_(_x_). So the formal statement means:
- we input or substitute a real number _x_ into the linear function
- the linear function outputs or gives a real number _y_ and
- all of these points (_x_,_y_) make a line.

There are three main forms for writing linear functions: **slope-intercept**, **standard** and **parametric**.

### Slope-intercept form

The **slope-intercept** (also called point-slope or explicit) form of a linear function is    or   . This form has 2 variables _x_ and _у_ and 2 constants _m_ and _b_.
- The letters _m_ and _b_ are constants. Before working with a linear function, we replace _m_ and _b_ with actual real numbers.
- The letters _x_ and _y_ are variables.
- In slope-intercept form, the letter _m_ stands for the slope and _b_ stands for the y-intercept.
    - The variable _x_ is called the independent variable or argument. Any real number _x_ can  be _input_ or _substituted_ into a linear function. The function will then _output_ the corresponding value for _y_.
    - The variable _y_ is called the dependent variable. It is the output value after substituting an input value for _x_.
---
- Horizontal lines are included. The line is horizontal if and only if _m_=0. Then we have just _y_=_b_. Since _b_ is a real number, this is a constant function. So a constant function is also a linear function.
- Vertical lines are never included because a vertical line is not a function. A vertical line does not pass the vertical line test. (A vertical line is defined by the equation: _x_=_b_ where _b_ is a real number.)
- Slanted lines are included. The line is slanted if and only if _m_≠0.
---
- The slope-intercept form is unique. A different value of _m_ or a different value of _b_ gives a different line.
- A linear function is a polynomial function of first or zero degree in one variable _х_ .
- The constant term is _b_. If we substitute _x_=0 into the function, we get _y_=_b_. So the number _b_ is the **_y_-intercept** and the line crosses the _у_-axis at the point (0,_b_).
- If _m_≠0, the number <sup>–b</sup>/<sub>m</sub> is the _x_-intercept or root or zero and (<sup>–b</sup>/<sub>m</sub>,0) is the point where the line crosses the _х_-axis. Here the value of the function is zero.
- The coefficient _m_ of _x_ is called the **slope** or _gradient_ of the line. For each line, the number _m_ is a constant and so the slope is constant for the whole line. The slope determines both the direction and steepness of the line. Direction and steepness are called the rate of change. So the _rate of change_ is _m_ and it is constant for each line.
    - The sign of _m_ determines the direction. If _m_>0 then the linear function is increasing; if _m_<0 then the function is decreasing.
    - The absolute value of _m_ determines the steepness. If |_m_|<1 then the slope is gentle; if |_m_|>1 then the slope is steep.
    - If the slope of a line is _m_ and (_х_,_у_) is any point on the line, we must also have the point (_х_+1, _y_+_m_) on the line.

**Example:** _y_=–2_x_+4. The slope is _m_= –2 and the _y_-intercept is _b_=4 or the point (0,4). Substituting _y_=0 and solving for _x_, we get 0=–2_x_+4 or _x_=2. So _x_=2 is the root of this linear function and the point (2,0) is the _x_-intercept.  Since the slope is _m_ = –2, the line is decreasing. Since |–2|=2>1, the decrease is _relatively_ steep. For each change in _х_ of 1 (to the right), the value of _у_ changes -2 (goes down).
---
- The **graph** of a line is determined by **two points**. To graph a linear function, we can substitute two different values for _x_ into the function and solve for the corresponding _y_-values. We graph these two points. Using a straightedge, we draw the line through these two points extending it past both points.

**Example:** _y_=–2_x_+4. Substituting _x_=0 we get _y_=4 (this is the _y_-intercept) and thus the point (0,4). Substituting _x_=1, we get _y_=2 and thus the point (1,2). Plot these points and draw the line. (Notice that the 2nd point is 1 to the right and 2 down from the 1st point. As we said in the above example, this happens because the slope is _m_= –2)
---
- A linear function that is not a constant function is a bijection. It will output each real number (surjection) for exactly one input value (injection).

**Example:** _y_= –_x_+2. Suppose _y_= –1. We substitute _y_= –1 and get: –1= –'x_+2 or _x_=3. This is the only solution. We can do this for any _y_-value.

### Standard form

.
- The standard form has 2 variables _x_ and _у_ and 3 constants _A_, _B_, and _C_ that are replaced by actual real numbers before working. This form is often used in geometry and in systems of linear equations.
**Example:** The linear function 3_x_–2_y_=1 is in standard form. The constants are _A_=3, _B_=–2 and _C_=1.
- This form is sometimes written as: . So instead of writing 3_x_-2_y_=1, we write the equivalent equation 3_x_-2_y_-1=0.
- The constants _A_, _B_, and _C_ are **not** uniquely determined. If we multiply them by a factor _k_, the value of these constants change, but the line is still the same.

**Example:** The lines 3_x_–2_y_=1  and 6_x_–4_y_=2 are coincident (same line). Here the factor is: _k_=2. We multiplied the first equation by 2 to get the second equation. The unique slope-intercept form of this line is: _y_=1.5_x_–0.5 (solve either equation for y).

### Vector-Parametric form

Parametric form:     or

Vector form:   or   .
- The parametric or vector or vector-parametric form has 1 parameter _t_, 2 variables _x_ and _у_, and 4 constants _a_<sub>1</sub>, _a_<sub>2</sub>, _x_<sub>1</sub>, and _y_<sub>1</sub>. The coefficients _a_<sub>1</sub>, _a_<sub>2</sub>, _x_<sub>1</sub>, and _y_<sub>1</sub> are **not** uniquely determined. The line passes through the points _А_=(_x_<sub>1</sub>,_y_<sub>1</sub>) and _B_=(_x_<sub>1</sub>+_a_<sub>1</sub>,_y_<sub>1</sub>+_a_<sub>2</sub>) so that taking taking any other points or even just reversing the order ot the points will result in different constants for the same line.
- The parameter _t_ is not visible on the graph.
- Engineers usually use the letter _t_ for the parameter. Mathematicians often use the Greek letter λ.

**Example:** **X**=(–1,1)+_t_(2,3), t∈**R** is a line in vector form. Here: _a_<sub>1</sub>=2, _a_<sub>2</sub>=3, _x_<sub>1</sub>=–1 and _x_<sub>2</sub>=1. The line goes through the points (_x_<sub>1</sub>,_y_<sub>1</sub>)=(–1,1) and (_x_<sub>1</sub>+_a_<sub>1</sub>,_y_<sub>1</sub>+_a_<sub>2</sub>)=(1,4). The corresponding parametric form of this line is: _x_(_t_)= –1+2_t_, _y_(_t_)=1+3_t_.  The unique slope-intercept form of this line is: _y_(_x_)=1.5_x_+2.5   (solve the first equation for _t_ and substitute this result into the second equation).
- The vector-parametric form of a line extends naturally to lines in 3-dimensional and higher spaces. The other forms do not.
**Example:** **X**=(–1,1,2)+_t_(2,3,–1), t∈**R** is a line in 3-dimensional space. The line goes through the points (–1,1,2) and (1,4,1).

## Derivative of a linear function

In the context where it is defined, the derivative of a function is a measure of the rate of change of function values with respect to change in input values. A linear function has a constant rate of change. This rate of change is the slope _m_. So _m_ is the derivative. This is often written:

**Example:** _y_= –2_x_+4. Here _m_= –2 and so _y_′= –2.

## Linear function vs. Linear equation

Often, the terms _linear equation_ and _linear function_ are confused. Both are polynomials. However, the word _linear_ in _linear equation_ means that all terms with variables are first degree. (The word _linear_ in _linear function_ means the graph is a line.) A linear equation can have 1, 2, 3, or more variables. So a linear equation is a linear function only if it has exactly 2 variables. (A linear equation in one variable is a point on the number line and a linear equation in 3 variables is a plane in 3-dimensional space.)

## Notation

Many countries and disciplines use different letters and ordering for the different forms.

In many countries, a linear functions is often written as  where _a_ is the slope and _b_ is the _y_-intercept.

In business and economics, a linear function is often written as  where _a_ is the _y_-intercept and _b'' is the slope.

## Related pages

- Line
- Polynomial
- Constant function
- Quadratic equation
- Linear equation

## Other websites

- (interactive)
- (interactive)
- (examples from economics)