## 2.1 - Increasing, decreasing, piecewise functions
### Increasing function:

* The graph rises from **left to right**.

- The value of $y$ is the thing that is _increasing_ from **left to right**.
- Note $f(2) < f(5) < f(6)$.
- Rule: if $a < b$, $f(a) < f(b)$.
### Decreasing Function:

* The graph falls from **left to right**.
Decreasing function:

- The value of $y$ is the thing that is _decreasing_ from **left to right**.
- Note $f(2) > f(3) > f(6)$.
- Rule: if $a < b$, $f(a) > f(b)$.
### Sometimes increasing, sometimes decreasing:

Increasing when green, decreasing when red:

Note intervals of x when increasing or decreasing:

- Write: $f(x)$ is decreasing on intervals $(0, 2)$ and $(3, 4)$
- Write: $f(x)$ is increasing on intervals $(2, 3)$, $(4,\infty)$, and $(−\infty, 0)$.
### Example 1. Determine the intervals where the given function is increasing, and the intervals where it is decreasing.


The graph of $f(x)$ is increasing on intervals $(-\infty,-2)$, $(1,2)$, and $(5,\infty)$.
The graph of $f(x)$ is decreasing on intervals $(-2,1)$ and $(2,5)$.
### Example 2. Determine the intervals where the given function is increasing, and the intervals where it is decreasing.


- The graph of $f(x)$ is increasing on the intervals $(2,3)$ and $(5,\infty)$.
- The graph of $f(x)$ is decreasing on the intervals $(-\infty,2)$ and $(3,5)$.
### Constant Function. $f(x)$ is the same for all $x$:

### Sometimes increasing, sometimes decreasing, sometimes constant:


- $f(x)$ is increasing on intervals $(-\infty,-2)$, $(2,3)$, and $(6,\infty)$.
- $f(x)$ is decreasing on intervals $(0,2)$ and $(3,4)$.
- $f(x)$ is constant on the intervals $(-2,0)$ and $(4,6)$.
## Relative (or local) maximum.

- Notice we are given $f(0) = 2.5$ and $f(3) = 1.7$.
- The point $(0, 2.5)$ is higher than other nearby points on the graph (in
purple).
- The point $(3, 1.7)$ is higher than other nearby points on the graph (in
orange).
- Write: $f(x)$ has a **relative (or local) maximum** when $x = 0$. The ‘maximum value’ there is $y = 2.5$.
- Write: $f(x)$ has a **relative (or local) maximum** when $x = 3$. The ‘maximum value’ there is $y = 1.7$.
## Relative (or local) minimum.

- Notice we are given $f(2) = −1.5$ and $f(4) = −0.5$.
- The point $(2, −1.5)$ is lower than other nearby points on the graph (in
blue).
- The point $(4, −0.5)$ is lower than other nearby points on the graph (in
green).
- Write: $f(x)$ has a **relative (or local) minimum** when $x = 2$. The ‘minimum value’ there is $y = −1.5$.
- Write: $f(x)$ has a **relative (or local) minimum** when $x = 4$. The ‘minimum value’ there is $y = −0.5$.
### Example. In the graph below, determine the x values where $f(x)$ has a local (or relative) maximum. What is the maximum ($y$) value there?

In the graph, determine the $x$ values where $f(x)$ has a local (or relative)
minimum. What is the minimum ($y$) value there?
### Example. In the graph below, determine the x values where $f(x)$ has a local (or relative) maximum. What is the maximum ($y$) value there?

In the graph, determine the $x$ values where $f(x)$ has a local (or relative)
minimum. What is the minimum ($y$) value there?
## Piecewise functions
- $f(x)$ is a piecewise function if it uses different formulas to calculate $f(x)$ depending on the value of x.
$$f(x)=\begin{cases} 2x-5 & \quad \text{ if } x \leq 1 \\ x^2 \quad & \text{ if } 1 <x \leq 4 \\ 3x+1 & \quad \text{ if } x>4 \end{cases}$$
- If $x \leq 1$, use the $2x-5$ formula:
$f(1)=2(1)-5=2-5=-3$
- If $1 <x \leq 4$, use the $x^2$ formula:
$f(3)=3^2=9$
- If $x>4$, use the $3x+1$ formula:
$f(5)=3(5)+1=15+1=16$
#### Steps:
1. **Identify which piece of the function to use**:
- Check the value of $x$.
- Choose the correct rule based on the range of $x$.
2. **Substitute the value of $x$ into the chosen rule**.
3. **Calculate the result**.
#### Example Calculations:
1. $f(-1)$:
- $-1\leq 1$, so use $2x-5$.
- $f(-1)=2(-1)-5=-2-5=-7$.
2. $f(6)$:
- $6>4$, so use $3x+1$.
- $f(6)=3(6)+1=18+1=19$.
3. $f\left(\dfrac{1}{2}\right)$:
- $\frac{1}{2}\leq 1$, so use $2x-5$.
- $f\left(\dfrac{1}{2}\right)=2\left(\dfrac{1}{2}\right)-5=1-5=-4$.
4. $f(4)$:
- $1<4\leq 4$, so use $x^2$.
- $f(4)=4^2=16$.
5. $f\left(\dfrac{3}{4}\right)$:
- $\frac{3}{4}\leq 1$, so use $2x-5$.
- \begin{align}f\left(\dfrac{3}{4}\right)&=2\left(\dfrac{3}{4}\right)-5 \\&=\dfrac{6}{4}-5 \\&=\dfrac{6}{4}-\dfrac{20}{4} \\&=-\dfrac{14}{4} \\&=-\dfrac{7}{2}\end{align}
6. $f(-2)$:
- $-2\leq 1$, so use $2x-5$.
- $f(-2)=2(-2)-5=-4-5=-9$.
7. $f(0)$:
- $0\leq 1$, so use $2x-5$.
- $f(0)=2(0)-5=-5$.
8. $f(-3)$:
- $-3\leq 1$, so use $2x-5$.
- $f(-3)=2(-3)-5=-6-5=-11$.
### Example
$$f(x)=\begin{cases} 3x-7 & x \leq 2 \\ 2x-2 & 2 <x \leq 5 \\ 2x^2 & x>5 \end{cases}$$
#### Example Calculations:
1. $f(4)$:
- $2<4\leq 5$, so use $2x-2$.
- $f(4)=2(4)-2=8-2=6$.
2. $f\left(\frac{3}{4}\right)$:
- $\frac{3}{4}\leq 2$, so use $3x-7$.
-
\begin{align*}
f\left(\frac{3}{4}\right) &= 3\left(\frac{3}{4}\right)-7 \\
&= \frac{9}{4}-7 \\
&= \frac{9}{4}-\frac{28}{4} \\
&= -\frac{19}{4}.
\end{align*}
3. $f(-2)$:
- $-2\leq 2$, so use $3x-7$.
- $f(-2)=3(-2)-7=-6-7=-13$.
4. $f(0)$:
- $0\leq 2$, so use $3x-7$.
- $f(0)=3(0)-7=-7$.
5. $f(7)$:
- $7>5$, so use $2x^2$.
- $f(7)=2(7)^2=2(49)=98$.
6. $f\left(\frac{1}{2}\right)$:
- $\frac{1}{2}\leq 2$, so use $3x-7$.
-
\begin{align*}
f\left(\frac{1}{2}\right) &= 3\left(\frac{1}{2}\right)-7 \\
&= \frac{3}{2}-7 \\
&= \frac{3}{2}-\frac{14}{2} \\
&= -\frac{11}{2}.
\end{align*}
7. $f(-5)$:
- $-5\leq 2$, so use $3x-7$.
- $f(-5)=3(-5)-7=-15-7=-22$.