Linear functions are order-1 polynomials and can be informally thought about as the graph of lines if their input is a real number. A related concept are linear mappings which are equivalent transformations on matrices. More about this family of functions on [libretexts](https://k12.libretexts.org/Bookshelves/Mathematics/Analysis/01%3A_Analyzing_Functions/1.04%3A_Function_Families/1.4.01%3A_Linear_and_Absolute_Value_Function_Families)
![[Linear function example.png]]
File available on [geogebra](https://www.geogebra.org/calculator/vbpfgqhm)
## Slope
The slope is $m=\frac{\Delta y}{\Delta x} = \frac{\text{rise}}{\text{run}}$*Note:*
1. All lines $y_n = mx_n + c_n$ (ie with the same $m$) are parallel
2. All lines with $m_2 =-\frac{1}{m_1}$ are perpendicular to lines with slope $m_1$
3. if the sign of $m$ is positive, then $f(x)$ will _increase_ as $x$ increases so the graph will go _up_ as $x$ goes to the right. $f(x)$ is increasing everywhere ie over the interval $(-\infty,\infty)$
4. If $m$ is negative then $f(x)$ will _decrease_ as $x$ increases so the graph will go _down_ as $x$ goes to the right. $f(x)$ is decreasing everywhere ie over the interval $(-\infty,\infty)$
5. A common case is where you have two points $(x_1, y_1)$ and $(x_2, y_2)$ and need to calculate their slope. In this case it is simply $ m = \frac{y_1 - y_2}{x_1 - x_2}$ Although you can hopefully see that this is just another way to state the equation above, this form is helpful to just know as it is how point-slope form is derived. Notice that it doesn't matter in which order you use the points so long as you are consistent in the numerator and the denominator.
6. If the line is vertical then the denominator $x_1 - x_2$ will be zero so the slope will be undefined. In this case the line is simply $x = x_1$.
7. If the line is horizontal then the numerator $y_1 - y_2$ will be zero so the slope will be zero. In this case the line is simply $y=y_1$.
## Slope intercept form
A helpful form of any linear function is _slope intercept_ form, given as $f(x) = mx +c$ where $m$ is the slope and $\left(0,c\right)$ is the y-intercept.
The $x$-intercept can be found by setting $y=0$ in the equation of the line and solving for $x$.
$
\begin{align*}
0 &= mx+c \\
mx &= -c \\
x &= -\frac{c}{m}
\end{align*}
$
So the $x$-intercept of an arbitrary linear function $f(x) = mx+c$ is at $\left(-\frac{c}{m},0\right).$
## Point slope form
The _point slope_ form is an alternative form for the equation of a line and is given as $f(x) = m(x-x_1) + y_1$ where $(x_1, y_1)$ is some point that has been given. This can be helpful for problems where:
- we are given $m$ directly
- we are told the line is parallel to some other line. Since parallel lines have the same slope this is equivalent to being told $m$.
- the line is perpendicular to some other line. Lines perpendicular to some line $y=mx + c_1$ have the form $y=-\frac{1}{m}x+c_2$ so this is also equivalent to being told the slope.
The point we are given could be any arbitrary point, so the intersection of two lines or the $y$ or $x$ intercept would all qualify for this treatment.
The slope-intercept form could be seen as actually a special case of the point slope form with the point being the y-intercept $(0,c)$.
### Derivation of point-slope form
The most important slope equation comes if you have 2 points $(x,y)$ and $(x_1, y_1)$.[^1]
Then the respective deltas are just the difference of the coordinates, so
$
\begin{align*}
m &= \frac{y-y_1}{x-x_1} & \text{...which means} \\
y-y_1 &= m(x-x_1) & \text{...and thence}\\
y &=m(x-x_1) + y_1, & \text{which is point slope form.}
\end{align*}
$
[^1]: I'm using the slightly weird naming because it makes the derivation more obvious in that they work without variable renaming.
## Line through two points
Combining the [[#Slope]] and [[#Point slope form]], we have that the equation of a line through two points, $(x_1, y_1)$ and $(x_2, y_2)$ is $y - y_1 = \frac{y_1 - y_2}{x_1 - x_2}\bigl(x-x_1\bigr).$
Therefore it is always possible to write the equation of a line through two given points in a single step. Notice that here I chose $(x_1,y_1)$ as the point to substitute into the point-slope form, but I could equally have used the other point and and would ultimately get the same equation after simplification.
## General form
It can be seen that all the above equations for a line (including vertical and horizontal degenerate cases) can be generalized into a single form, which is $a x + b y = c,\quad a \ne 0 \text{ or } b \ne 0. $
This is perhaps slightly less immediately intuitive than the other forms in that the slope is not obvious, however it should be clear this is the graph of a line.
## Obtaining the graph of a linear function by translation
The graph of a linear function can be obtained by translation from the graph of $f(x) = x$ via the following set of steps that never need to change
1. Rewrite into slope intercept form
2. if $m$ is negative, mirror $f(x)$ about the $x$ axis
3. $|m|$ is the factor of vertical scaling, so take the graph obtained from step 2 and scale it vertically by $|m|$ [^1]
4. $c$ is the vertical shift. If $c$ is positive, shift _up_ by $c$, if $c$ is negative, shift _down_ by $|c|$.[^2]
[^1]: It can be seen that for linear functions, scaling vertically by $m$ is equivalent to scaling horizontally by $\frac{1}{m}$. So stretching $x$ is the same as squashing $y$ and vice-versa
[^2]: The point-slope form should make clear that for linear functions, shifting $m$ units vertically is the same as shifting 1 unit horizontally.
## Inverse of a linear function
Given some arbitrary linear $f(x) = mx + c \quad f:\mathbf{R} \to \mathbf{R}$ with $m,c \in \mathbf{R}, m\neq 0$, we can find $f^{-1}(x)$ (its inverse) by substituting $x$ for $f(x)$ and $g$ for $x$ and solving for $g$ as follows:
$
\begin{align*}
x &= mg + c \\
mg &= x -c \\
g &= \frac{1}{m}x - \frac{c}{m}.
\end{align*}
$
We can see that if $f$ has type $\mathbf{R} \to \mathbf{R}$ and $m$ and $c$ are real numbers (with $m\neq0$)that the same would be true about $g$ and also that $g$ should be defined everywhere $f$ is defined. Let us also check whether the function $g(x) = \frac{1}{m}x - \frac{c}{m}$ we have found is indeed the inverse of $f(x) = mx+c$. If this is the case, then $f\circ g(x) = x$ and $g\circ f(x) = x$
So let us evaluate those by substitution:
$
\begin{align*}
f\circ g(x) &= m\left( \frac{1}{m}x - \frac{c}{m}\right) + c \\
&= \frac{m}{m} x -\frac{mc}{m} + c\\
&= x - c + c\\
&= x\\[12pt]
g\circ f(x) &= \frac{1}{m}\left( mx + c\right) - \frac{c}{m} \\
&= \frac{m}{m} x +\frac{c}{m} - \frac{c}{m} \\
&= x
\end{align*}
$
Therefore the inverse of any real-valued linear function in slope intercept form
$f(x) = mx+c$ with $m,c\in \mathbf{R}$ and $m\neq0$ is $f^{-1}(x)=\frac{1}{m}x - \frac{c}{m}.$
The only remaining step to finding the inverse of any arbitrary linear function would be if the domain of $f(x)$ is restricted for some reason, apply the corresponding restriction to the domain of $g(x)$ by evaluating $f$ at the boundary points of its domain (this will give you the image set of $f$) and using that interval to bound the domain of $g$. The image set of $g$ will then be the restriction applied to the domain of $f$.
*Note:*
1. The graphs of $f(x)$ and $f^{-1}(x)$ are symmetrical about $y=x$.
2. If $f(x)$ is linear then $f^{-1}(x)$ is linear and vice versa.
3. If $m=0$ the function is not invertible. If you think about it, if it existed the inverse of something like $f(x)=c$ would have a domain of $c$ and map it to every possible $x$, which would be "interesting".
### Obtaining the graph of $f^{-1}(x)$ from $y=x$ by translation
As with any other linear function, you could just carry out the steps above.
1. Mirror about the $x$ axis if $m$ is negative
2. Scale vertically by $\frac{1}{|m|}$
3. Shift vertically by $-\frac{c}{m}$
## Special cases
1. $x=c$ is not a function (because it not a “one to one” or “many to one” mapping, so fails the “vertical line test”) so has no inverse. It seems related to linear functions given that it does define a line, it's just the line has infinite slope. For the same set of reasons its limit is not defined anywhere, and it is not continuous anywhere.
2. $f(x)=c$ is a function with $m=0$. It is constant and continuous everywhere and has limit $c$ everywhere (incl at $\pm\infty$ - see [[Limits and continuity of linear functions (incl proofs)#|here]] for proofs). It is not one to one so does not have an inverse however.
## Parametric form of a linear function
A straight line can be expressed in _parametric form_ as a set of point vectors
$\{P + tA\} \qquad t\in \mathbf{R}. \tag{1}$ In this form $t$ is a scalar parameter. $A$ is a vector of coefficients giving the slope with respect to $t$ in each dimension and $p$ is an offset equivalent to the $c$ parameter in the normal slope intercept form. Both $A$ and $P$ are vectors, so what this is really saying is
you obtain the line by starting with some vector $P$ and adding $A$ times the
scalar factor $t$. On a point of notation, these are written in uppercase
because they are point vectors, rather than writing them $\mathbf{a}$ and
$\mathbf{p}$ or similar.
A conceptually-simpler version of this which possibly appears more frequently is a set of parametric equations such as
$
\begin{align*}
x &= at + b\\
y &= ct + d
\end{align*}
$
With $a\ne 0, c\ne 0$.
As a general matter, any parametric system of the form
$\begin{align*}
x &= a_1t + p_1\\
y &= a_2t + p_2\\
\vdots \\
x_n &= a_nt + p_n
\end{align*}
$
with $a_1 \ne 0, \dots a_n \ne 0$ describes a linear function parameterised by $t$. Written like this it, is hopefully easy to see that no matter how many dimensions you have, you can scoop up all the coefficients of $t$ into a vector and call it $A$ and take all the constants and call those $P$, and you have the form in (1).
## Piecewise linear functions
TODO
## Absolute value of a linear function
TODO
## Limits and proofs of continuity
Are in their own page because it was getting kinda long and unwieldy.
[[Limits and continuity of linear functions (incl proofs)]]