# 1.3 Linear Functions, slopes, and applications.
## Linear Functions:
- $f(x)=2x+5$
- $f(x)=4x-7$
- $f(x)=-3x-20$
- $f(x)=-\dfrac{1}{2}x+90$
- $f(x)=3.6x-7.1$
- $f(x)=-\dfrac{3}{4}x-\dfrac{17}{4}$
- $f(x)=-6x$
- $f(x)=-31$
- $f(x)=mx+b$
- Graph is a straight line
- Linear Functions: $y=f(x)=mx+b$
- Horizontal line: $m=0$, so get function $f(x)=b$, a **constant** function.
- ($y$ value is always $b$, a 'constant'. $y=b$)
- Vertical line: has form $x=a$. Not a function.
### Example. Graph $y=3$, $y=-5$, $y=0$, $x=4$, $x=-3$, and $x=0$:

| A | B | C | D | E | F |
|-------|--------|--------|--------|--------|--------|
| $y = 3$ | $y = -5$ | $y = 0$ | $x = 4$ | $x = -3$ | $x = 0$ |
## Slope
- The slope measures how steep a line is.
- Given points $(x_1,y_1)$ and $(x_2,y_2)$, the slope through them is
$$m=\dfrac{y_2-y_1}{x_2-x_1}$$
provided that $x_1 \neq x_2$.
- If $x_1=x_2$, the slope is not defined. Then the line is vertical.
### Example 1. Find the slope of the line through $(2,-5)$ and $(3,7)$.
::: spoiler
<summary> Solution:</summary>
$m=\dfrac{7-(-5)}{3-2}=\dfrac{7+5}{3-2}=\dfrac{12}{1}=12$
We could have done the points in reverse order:
$m=\dfrac{-5-7}{2-3}=\dfrac{-12}{-1}=\dfrac{12}{1}=12$
- Must be consistent with order of $x$ and $y$ values.

:::
### Example 2. Find the slope of the line that passes through $(-1,-2)$ and $(7,2)$ or show that it is not defined.
::: spoiler
<summary> Solution:</summary>
To solve this problem, we need to find the slope of the line that passes through the points $(-1, -2)$ and $(7, 2)$.
The formula for the slope $m$ between two points $(x_1, y_1)$ and $(x_2, y_2)$ is given by:
$$
m = \frac{y_2 - y_1}{x_2 - x_1}
$$
Substitute the given points $(-1, -2)$ and $(7, 2)$ into this formula:
$$
m = \frac{2 - (-2)}{7 - (-1)} = \frac{2 + 2}{7 + 1} = \frac{4}{8} = \frac{1}{2}
$$
So, the slope of the line is $\frac{1}{2}$.

:::
### Example 3. Find the slope of the line through (7, 2) and (7, −3) or show it is not defined.
::: spoiler
<summary> Solution:</summary>
To find the slope of the line passing through the points $(7, 2)$ and $(7, -3)$, we use the slope formula:
$$
m = \frac{y_2 - y_1}{x_2 - x_1}
$$
Substituting the points $(7, 2)$ and $(7, -3)$ into the formula:
$$
m = \frac{-3 - 2}{7 - 7}
$$
Since division by zero is undefined, the slope of the line is **not defined**. This means the line is vertical.
Also note that $x_1=x_2$.

:::
### Example 4. Find the slope of the line through (7, −2) and (−4, −2) or show it is not defined.
::: spoiler
<summary> Solution:</summary>
To find the slope of the line passing through the points $(7, -2)$ and $(-4, -2)$, we use the slope formula:
$$
m = \frac{y_2 - y_1}{x_2 - x_1}
$$
Substituting the points $(7, -2)$ and $(-4, -2)$ into the formula:
$$
m = \frac{-2 - (-2)}{-4 - 7} = \frac{-2 + 2}{-4 - 7} = \frac{0}{-11} = 0
$$
Since the slope is $0$, the line is **horizontal**.

:::
### Example 5. Find the slope of the line through (1, −4) and (3, 2) or show it is not defined.
::: spoiler
<summary> Solution:</summary>
To find the slope of the line passing through the points $(1, -4)$ and $(3, 2)$, we use the slope formula:
$$
m = \frac{y_2 - y_1}{x_2 - x_1}
$$
Substituting the points $(1, -4)$ and $(3, 2)$ into the formula:
$$
m = \frac{2 - (-4)}{3 - 1} = \frac{2 + 4}{3 - 1} = \frac{6}{2} = 3
$$
So, the slope of the line is $3$.

:::
### Example 6. Find the slope of the line through (1, 4) and (−5, 4) or show it is not defined.
::: spoiler
<summary> Solution:</summary>
To find the slope of the line passing through the points $(1, 4)$ and $(-5, 4)$, we use the slope formula:
$$
m = \frac{y_2 - y_1}{x_2 - x_1}
$$
Substituting the points $(1, 4)$ and $(-5, 4)$ into the formula:
$$
m = \frac{4 - 4}{-5 - 1} = \frac{0}{-6} = 0
$$
Since the slope is $0$, the line is **horizontal**.

:::
### Example 7. Find the slope of the line through (5, −4) and (5, 2) or show it is not defined.
::: spoiler
<summary> Solution:</summary>
To find the slope of the line passing through the points $(5, -4)$ and $(5, 2)$, we use the slope formula:
$$
m = \frac{y_2 - y_1}{x_2 - x_1}
$$
Substituting the points $(5, -4)$ and $(5, 2)$ into the formula:
$$
m = \frac{2 - (-4)}{5 - 5} = \frac{2 + 4}{0} = \frac{6}{0}
$$
Since division by zero is undefined, the slope of the line is **not defined**. This means the line is **vertical**.

:::
### Example 8. Find the slope through $\left(3 , \dfrac{1}{2}\right)$ and $\left(5,-\dfrac{7}{3}\right)$.
::: spoiler
<summary> Solution:</summary>
To find the slope of the line passing through the points $\left(3 , \dfrac{1}{2}\right)$ and $\left(5,-\dfrac{7}{3}\right)$, we use the slope formula:
$$
m = \frac{y_2 - y_1}{x_2 - x_1}
$$
Substituting the points $\left(3 , \dfrac{1}{2}\right)$ and $\left(5,-\dfrac{7}{3}\right)$ into the formula:
$$
m = \frac{-\dfrac{7}{3} - \dfrac{1}{2}}{5 - 3}
$$
To subtract the fractions in the numerator, we find a common denominator:
$$
-\dfrac{7}{3} - \dfrac{1}{2} = -\dfrac{14}{6} - \dfrac{3}{6} = -\dfrac{17}{6}
$$
So the slope becomes:
$$
m = \frac{-\dfrac{17}{6}}{2} = \frac{-17}{6 } \cdot \dfrac{1}{2}= \frac{-17}{12}
$$
Thus, the slope of the line is $\frac{-17}{12}$.

:::
---
## Slope$=\dfrac{\text{rise}}{\text{run}}=\dfrac{\text{change in } y}{\text{change in } x}$

- What do slopes look like when they are positive?


- What do slopes look like when they are negative?


- What about zero slope?


---
## $y=mx+b$
- With $y=mx+b$, the slope is $m$ and the $y$-intercept is $(0,b)$.
### Example 9. Let $y=-2x-2$. Find the slope and $y$-intercept. Graph.
::: spoiler
<summary> Solution:</summary>
The $y$-intercept is found by setting $x=0$ and solving for $y$.
When $x=0$:
$y=-2(0)-2=0-2=-2$.
Thus the $y$-intercept is $(0,-2)$.
The slope is the number in front of the $x$ which is $-2$. The slope being $\dfrac{-2}{1}$ means the line goes to the right 1 and down 2. The $y$-intercept can be found by looking at the constant term $-2$, which is the point $(0,-2)$.

:::
### Example 10. Let $y=-6$. Find the slope and $y$-intercept. Graph.
::: spoiler
<summary> Solution:</summary>
The $y$-intercept is found by setting $x=0$ and solving for $y$.
When $x=0$:
$y=-6$.
Thus the $y$-intercept is $(0,-6)$.
The slope is the number in front of the $x$ which is $0$. (Can be rewritten as $y=0x-6$.) The slope being $\dfrac{0}{1}$ means the line goes to the right 1 and up 0 (flat/horizontal). The $y$-intercept can be found by looking at the constant term $-6$, which is the point $(0,-6)$.

:::
### Example 11. Let $y=-\dfrac{1}{3}x+2$. Find the slope and $y$-intercept. Graph.
::: spoiler
<summary> Solution:</summary>
The $y$-intercept is found by setting $x=0$ and solving for $y$.
When $x=0$:
$y=-\dfrac{1}{3}(0)+2=0+2=2$.
Thus the $y$-intercept is $(0,2)$.
The slope is the number in front of the $x$ which is $-\dfrac{1}{3}$. The slope being $\dfrac{-1}{3}$ means the line goes to the right 3 and down 1. The $y$-intercept can be found by looking at the constant term $2$, which is the point $(0,2)$.

:::
### Example 12. Let $x=1.5$. Find the slope and $y$-intercept. Graph.
::: spoiler
<summary> Solution:</summary>
Note that $x=1.5$ is a vertical line that has $x$-value $1.5$.
Vertical lines have undefined slope.
Graphing it, note that it has no $y$-intercept either. It does however have an $x$-intercept.

:::
### Example 13. Let $y=\dfrac{1}{2}x+2$. Find the slope and $y$-intercept. Graph.
::: spoiler
<summary> Solution:</summary>
The $y$-intercept is when $x=0$, so $y=\dfrac{1}{2}(0)+2=0+2=2$. Thus the $y$-intercept is $(0,2)$.
The slope can be found in front of the $x$, which is $\dfrac{1}{2}$. This means that the graph goes to the right $2$ and up $1$.

:::
### Example 14. Let $y=-2x$. Find the slope and $y$-intercept. Graph.
::: spoiler
<summary> Solution:</summary>
The $y$-intercept is when $x=0$, so $y=-2(0)=0$. Thus the $y$-intercept is $(0,0)$.
The slope can be found in front of the $x$, which is $-2=\dfrac{-2}{1}$. This means that the graph goes to the right $1$ and down $2$.

:::
### Example 15. Let $3x+5y=10$. Find the slope and $y$-intercept. Graph.
::: spoiler
<summary> Solution:</summary>
The $y$-intercept is when $x=0$:
\begin{align}
3x+5y&=10 \\
3(0)+5y&=10 \\
5y&=10 \\
\dfrac{5y}{5}&=\dfrac{10}{5} \\
y&=2
\end{align}
So, the $y$-intercept is $(0,2)$.
To find the slope, we need to convert it to $y=mx+b$ form and then look at the number in front of the $x$:
\begin{align}
3x+5y&=10 \\
5y&=-3x+10 \\
\dfrac{5y}{5}&=\dfrac{-3x+10}{5} \\
y&=\dfrac{-3}{5}x+\dfrac{10}{5} \\
y&=-\dfrac{3}{5}x+2
\end{align}
Thus the slope is the number in front of the $x$, which is $-\dfrac{3}{5}$. This means the graph goes to the right 5 and down 3.
Note that the $y$-intercept is found by looking at the constant term, $(0,2)$.

:::
### Example 16. Let $4x-3y=3$. Find the slope and $y$-intercept. Graph.
::: spoiler
<summary> Solution:</summary>
The $y$-intercept is when $x=0$:
\begin{align}
4x-3y&=3 \\
4(0)-3y&=3 \\
-3y&=3 \\
\dfrac{-3y}{-3}&=\dfrac{3}{-3} \\
y&=-1
\end{align}
So, the $y$-intercept is $(0,-1)$.
To find the slope, we need to convert it to $y=mx+b$ form and then look at the number in front of the $x$:
\begin{align}
4x-3y&=3 \\
-3y&=-4x+3 \\
\dfrac{-3y}{-3}&=\dfrac{-4x+3}{-3} \\
y&=\dfrac{-4}{-3}x+\dfrac{3}{-3} \\
y&=\dfrac{4}{3}x-1
\end{align}
Thus the slope is the number in front of the $x$, which is $\dfrac{4}{3}$. This means the graph goes to the right 3 and up 4.
Note that the $y$-intercept is found by looking at the constant term, $(0,-1)$.

:::
### Example 17. Let $2x-5y-20=0$. Find the slope and $y$-intercept. Graph.
::: spoiler
<summary> Solution:</summary>
The $y$-intercept is when $x=0$:
\begin{align}
2x-5y-20&=0 \\
2(0)-5y-20&=0 \\
-5y-20&=0 \\
-5y&=20 \\
\dfrac{-5y}{-5}&=\dfrac{20}{-5} \\
y&=-4
\end{align}
So, the $y$-intercept is $(0,-4)$.
To find the slope, we need to convert it to $y=mx+b$ form and then look at the number in front of the $x$:
\begin{align}
2x-5y-20&=0 \\
2x-5y&=20 \\
-5y&=-2x+20 \\
\dfrac{-5y}{-5}&=\dfrac{-2x+20}{-5} \\
y&=\dfrac{-2}{-5}x+\dfrac{20}{-5} \\
y&=\dfrac{2}{5}x-4
\end{align}
Thus the slope is the number in front of the $x$, which is $\dfrac{2}{5}$. This means the graph goes to the right 5 and up 2.
Note that the $y$-intercept is found by looking at the constant term, $(0,-4)$.

:::