##### Tools

This site is devoted to mathematics and its applications. Created and run by Peter Saveliev.

# Preview of calculus: part 2

This is a part of Calculus 1: course.

## 1 Piecewise Defined Functions

The absolute value function $$f(x) = |x|$$ is computed as follows: $$f(x) = \text{ if } x < 0 \text{ then } y = - x$$ $$f(x) = \text{ if } x \geq 0 \text{ then } y = x$$

We can re-write this algebraically as $$f(x) = \begin{cases} -x & \text{ if } x < 0 \\ x & \text{ if } x \geq 0 \end{cases}$$

This is called a piecewise definition. It's a special case of algebraic representation of functions.

Where do functions like this comes from?

Example:

Hypothetically...

The law says $$\begin{cases} \text{if income } & < 10000 \text{ then tax rate } = 0\% \\ \text{if } 10000 & \leq \text{ income } < 20000 \text{ then tax rate } = 10\% \\ \text{if income } & \geq 20000 \text{ then tax rate } = 20\% \end{cases}$$

We can express this algebraically.

Suppose $$x$$ is the income and $$y = f(x)$$ is the tax rate, then $$f(x) = \begin{cases} 0 & \text{if } x < 10000 \\ 10 & \text{if } 10000 < x < 20000 \\ 20 & \text{if } x \geq 20000 \end{cases}$$

There is a possible problem with the above. There is no definition for $$x = 10000$$! Fix it.

## 2 Characteristics of Functions

Functions: Even Odd Neither
Graphical
Algebraic $$y = x^{2}$$ $$y = x^{3}$$ $y=x+1$, just about anything...

No symmetry!
We discover Same $$y$$ for two different $$x$$'s ($$x$$ & $$-x$$). $$y$$ for $$x$$ and $$-y$$ for $$-x$$.
Definition:
$$f(x) = f(-x)$$ $$f(-x) = -f(x)$$
Examples $$(-x)^{2} = x^{2} => y = x^{2}$$ is even $$(-x)^{3} = -x^{3} => y = x^{3}$$ is odd
Other Examples $$\cos x, x^{4}, x^{6}, x^{6} + x^{4} - 17x^{2}$$. $$x, x^{3}, x^{5}, x^{7}, x + x^{5} - 17 x^{17}, \sin x$$.
Numerical
Similar

Warning: there could be more values and these observations could turn out to be false:

## 3 Growth: Increasing/Decreasing Behavior

This verbal definition is simple and the geometric meaning is very clear. However, both are imprecise. Let's work out this concept algebraically.

Function $$y=f(x)$$ is increasing on interval $$(a, b)$$ if for any given $$x_{1}, x_{2}$$ in $$(a, b)$$,

$$\begin{array}% \text{ if } x_{1} < x_{2} & \text{ then } & f(x_{1}) < f(x_{2}), \\ \end{array}$$

How do we verify these conditions? It's hard (but easy with calculus).

Example:

$$f(x) = 3x - 7$$

If $$x_{1} < x_{2}$$ then

\begin{aligned} f(x_{1}) = 3 x_{1} - 7 & \overset{?}{<} f(x_{2}) = 3 x_{2} - 7 \\ 3 x_{1} & \overset{?}{<} 3 x_{2} \\ \therefore x_{1} & < x_{2} \end{aligned}

The computation suggests that $y=f(x)$ is increasing. To finish the proof, retrace your steps.

This is even harder for quadratic, cubic, ... functions as they lead to quadratic, cubic, .... equations.

Function $$y=f(x)$$ is decreasing on interval $$(a, b)$$ if for any given $$x_{1}, x_{2}$$ in $$(a, b)$$,

$$\begin{array}% \text{ if } x_{1} < x_{2} & \text{ then } & f(x_{1}) > f(x_{2}), \\ \end{array}$$

Notation:

• $\nearrow$ for increasing, and
• $\searrow$ for decreasing.

Review exercise:

$$y = \sqrt{u} + \sqrt{4 - u}$$

Find the domain, i.e. find all $$u$$'s for which the formula makes sense.

Start
Make sure that $$\sqrt{}$$ makes sense, i.e. what's inside can not be negative.
1. $$\sqrt{u} \Rightarrow u \geq 0$$, solved already
2. $$\sqrt{4 - u} \Rightarrow 4 - u$$, solve
• Subtract 4 from both sides, $$-u \geq -4$$
• Multiply by $$(-1)$$, $$u \leq 4$$

Each $$u$$ in the domain must satisfy both inequalities, $$u \geq 0$$ AND $$u \leq 4$$. Hence

$$A: D = [0,4]$$

## 4 Word Problems

Problem. A farmer with 100 yards of fencing material wants to build as large a rectangular enclosure as possible.

He would first try to apply his common sense.

Trial and Error:

\begin{aligned} 25 \times 25 & = 625 \text{ sq. yards} \\ 24 \times 26 & = 624 \ldots \\ \vdots & = \vdots \vdots \end{aligned}

More trials lead to better results but we cannot try all possible rectangles.

Numerical analysis with Excel:

Start with the perimeter : $$2( W + D ) = 100$$, where $W,D$ are the width and the depth of the rectangle.

Solve it $$D = 50 - W$$ What about the area? \begin{aligned} A & = WD \\ & = W(50-W) \end{aligned}

Using Excel, we see this:

Excel fills gaps with straight lines. We can see that the graphical representation is better and it suggests that 25 is the best solution.

But gaps are still an issue.

Algebra:

We can restate the problem as \begin{aligned} A & = W( 50 - W ) \\ & \textrm{Find the maximum} \end{aligned}

Later, we will use the derivative. Now we use the fact that this is a parabola.

What do we know about it?

• There is one max or min.
• But which one?

$$f(x) = -x^{2} + 50 x$$ (We replaced $$W$$ with $$x$$ here.)

Because of the "-", this one opens down, with a max.

Question. Where is the maximum?

Answer. It is the midpoint between the two $$x$$-intercepts.

In our case, the $$x$$-intercepts are 0 and 50. So the "vertex" of the parabola is at

$$x = \frac{ 0 + 50 }{ 2 } = 25$$

We've solved the problem but it's clear that with even a bit more complicated functions we wouldn't be able to handle the algebra. Calculus will help...

## 5 We need more functions

We need a library of elementary functions to build others.

A parabola (curve) is the graph of a function. But what kind of function?

\begin{aligned} & x^{2} \\ & x^{2} + 1 \\ & x^{2} + x + 1 \end{aligned}

Example:

Is this a parabola?

We don't know. Probably not because it has a flat bottom.

In fact, it looks like $$y = x^{4}$$, which is not a parabola.

## 6 Linear Functions

Linear functions are simpler than quadratic functions.

Slope-intercept form: $$\begin{matrix} y = & mx & b \\ & \uparrow & \uparrow \\ & \textrm{the slope} & y\textrm{-intercept} \end{matrix}$$

Monotinicity is very simple:

• $$m > 0$$ - $$f$$ is increasing, on the whole domain.
• $$m < 0$$ - $$f$$ is decreasing, on the whole domain.
• $$m = 0$$ - $$f$$ is constant, on the whole domain (technically not "linear").

Also, there are no max/min points.

The general form is $$f(x) = ax^{2} + bx + c$$

Facts we know

$$a > 0$$
parabola opens up
$$a < 0$$
parabola opens down
$$a = 0$$

The x-coordinate of the vertex of parabola (i.e., max or min) is $$v = - \frac{b}{2 a }$$ Find y.

Domain is all reals.

Now, a quadratic function will exhibit either:

• $$\underbrace{(-\infty, v)}_{\nearrow}$$ and $$\underbrace{(v, \infty)}_{\searrow}$$ - Maximum
• $$\underbrace{(-\infty, v)}_{\searrow}$$ and $$\underbrace{(v, \infty)}_{\nearrow}$$ - Minimum

Polynomials are "made up" of powers of $$x$$ as follows.

## 8 Power Functions:

$$x^{0} = 1 , \underbrace{x}_{\text{linear}}, \underbrace{x^{2}}_{\text{quadratic}}, \underbrace{x^{3}}_{\text{cubic}}, \cdots , x^{n}, \cdots$$

The degree, odd vs even, affects the shape of the graph.

Power is even

Power is even, then it looks "like" $$x^{2}$$ .

Power is odd

Power is odd, then it and looks "like" $$x^{3}$$ .

We can think algebraically and justify the pictures.

Later, we'll use the derivative.

$$f(x) = 5x^{3} - 3x^{2} + 17x - 18$$, cubic

Fact: The domain is all real numbers (no division, etc).

## 9 Rational Functions

Called this way because they are ratios of polynomials.

$$\left. \frac{ x - 1 }{ x + 1 } \right\} \text{ polynomials }$$

Also

$$\left(\frac{1 + x}{x^{2}}\right) \frac{x^{3}}{x^{2} + 1}$$

Definition: Function $f$ is called rational if

$$f(x) = \frac{P(x)}{Q(x)}$$

where $$P$$ and $$Q$$ are polynomials.

Question:

What is the domain of a rational function?

Example:

What is the domain of $$\dfrac{x - 1}{x + 1}$$?

Answer: $x \neq -1$

I.e., the $f(x)$ makes sense for all $$x$$ but -1.

Solution:

We look at the denominator, $$x + 1 = 0$$ and solve.

$$\Longrightarrow x = -1$$

not in the domain.

If we plug $$x = -1$$, we have a division by 0.

Problem:

What is the domain for

$$f(x) = \frac{x - 1}{x^{2} - 4}$$

Set the denominator to 0 and solve

\begin{aligned} x^{2} - 4 & = 0 \\ x^{2} & = 4 \\ x & = \pm 2 \end{aligned}

So the domain consists of all real numbers except $$\pm 2$$.

## 10 Algebraic Functions

I.e., the ones "with roots".

Problem. Find the domain to the function

$$\sqrt{ x - \sqrt{x}}$$

Whatever is inside the square root can't be negative. So,

1. $$x \geq 0$$, i.e. $$x$$ is positive.
2. $$x - \sqrt{x} \geq 0$$, solve it. \begin{aligned}x & \geq \sqrt{x} \\ x^{2} & \geq x \\x & \geq 1\end{aligned}

The domain is

$$D = [1, \infty).$$

## 11 Trigonometric Functions

These three will suffice 00% of the time: $$\sin x, \cos x, \tan x = \frac{\sin x}{\cos x}$$

Fact: The domain for sin and cos are all real numbers.

Fact: These functions are periodic, with period $2\pi$.

\begin{aligned} \sin( x + 2 \pi ) & = \sin x \\ \cos(x + 2\pi) & = \cos x \\ \tan(x+2\pi) &= \tan x \end{aligned}

for all $$x$$.

Recall the definitions (comes from the Pythagorean Theorem):

Domain of $$\tan x$$?

$$\tan x = \frac{ \sin x}{\cos x}$$

To find domain, set denominator to 0 and solve. Find all $$x$$'s

\begin{aligned} \cos x & = 0 \\ x & = \ldots, \frac{\pi}{2}, \frac{3\pi}{2}, \frac{5\pi}{2}, \ldots \end{aligned}

Question:

Is it increasing? It looks like it's increasing everywhere... But the correct question is: on what intervals is it increasing? In particulr, is it increasing on $$(-\infty, \infty)$$?

No. Because $$\tan$$ is undefined at $$\dfrac{\pi}{2}, \dfrac{3\pi}{2}, \ldots$$ in the first place. Plus, you can see the jumps.

Review exercise:

Plot the graph of the piece-wise defined function:

$$f(x) = \begin{cases} 3 - \frac{1}{2}x & \text{ for } x \leq 2 \\ 2x - 5 & \text{ for } x > 2 \end{cases}$$

Plot:

1. Plot $$3 - \dfrac{1}{2} x$$.
2. Plot $$3 - \dfrac{1}{2}x$$ with domain $$x \leq 2$$.
3. Plot $$2x - 5$$.
4. Plot $$2x - 5$$ with domain $$x > 2$$.
5. Combine 2) and 4).

## 12 New Functions From Old

We set up a library of elementary functions: powers, roots, exponent, sin, cos. Then we combine them algebraically with the 4 operations (+ one more). For example:

$$x^{3}, x^{5} \rightarrow x^{3} + x^{5}$$

The idea is below:

Graphical representations: How do these transformations of graphs affect the functions?

1. Shift (Two types: Horizontal and Vertical)
2. Stretch (Two types: Horizontal and Vertical)
3. Flip (Two types: Horizontal and Vertical)

Six in Total

Shift (Vertical)

Rule 1:

If the graph $$y = g(x)$$ is that of $$y = f(x)$$ shifted $$k$$ units up, then $$g(x) = f(x) + k$$ This is what happens to every point on the graph:

Fact: Same exact shape of the graph.

Example: \begin{aligned}x^{2}, x^{2} + 1, x^{2} + 10, & \textrm{ same shape} \\x^{2} - 1 , x^{2} - 10, & \textrm{ same shape}\end{aligned} What if we shift down? We have to rewrite the rule?

Rule 1 (rewritten):

If the graph $$y = g(x)$$ is that of $$y = f(x)$$ shifted $$k$$ units up/down, then $$g(x) = f(x) \pm k$$ No need for "down". Indeed, "-10 units up" mean "10 units down".

Example:

Suppose "I drive West, drive one hour at -60 m/h." Where am I? A: 60 miles east of here. \begin{aligned}\textrm{distance} & = \textrm{time} \times \textrm{velocity} \\& = (1) \times (-60) \\& = -60\end{aligned} What about the horizontal shift? Compare.

Vertical Shift: $$y = f(x) \Rightarrow y = f(x) + k$$

$$\therefore y_{1} = y_{0} + k,$$ So $$g(x) = f(x) + k$$

Horizontal Shift:

$$y_{0} = f(x_{0}) = g(x_{0} + k),$$ So $$g(x) = f(x - k)$$

Example:

$$f(x) = x^{2}$$, shift 2 units to the right and we get $$g(x) = f(x-2) = (x-2)^{2}$$ $$x$$ changes.

What is the $$x$$ -intercept of $$g$$?

Set $$f(x) = 0$$, and solve. $$\begin{array}{c | c}( x + 2) ^{2} = 0 & \textrm{opposite?} \\x - 2 = 0 & h(x) = (x + 2)^{2} \\x = 2 & x + 2 = 0 \\& x = -2\end{array}$$ $$h(x)$$ is shifted 2 units to the left.

Rule 1-2:

If the graph of $$g$$ is that of $$f$$, shifted $$k$$ units to the right, then $$g(x) = f(x-k)$$ Algorithmic interpretation of these shifts.

Vertical Shift

Horizontal Shift

Example:

Let $$h(x) = (x + 2)^{2} - 3$$ What is the graph?

A different kind of transformation.

Flip

Then $$y_{1} = - y_{0}$$, so $$g(x) = - f(x)$$

Rule 2-1:

If the graph of $$g$$ is that of $$f$$, flipped about the $$x$$-axis then $$g(x) = - f(x)$$

Example:

$$h(x) = - f(x) + 3$$ How do we get the graph of $$h$$? $$x \longmapsto f(x) \underbrace{\longmapsto}_{\textrm{vertical flip}} - f(x) \underbrace{\longmapsto}_{\textrm{vertical shift}} - f(x) + 3$$ The order matters... To know the order, read the function from inside-out.

Rule 2-2

If the graph of $$y = g(x)$$ is that of $$y = f(x)$$ flipped about the $$y$$- axis, then $$g(x) = f(-x)$$

Stretch:

The graph is not a wireframe anymore! The $$xy$$-plane is the one stretched, if you think of it as a rubber sheet, with a graph on it.

Consider the stretch by a factor of 2

Rule 3-1

If the graph of $$y = g(x)$$ is that of $$y = f(x)$$ stretched vertically by a factor of $$k > 0$$, then $$g(x) = kf(x)$$. (Factor outside of $$k$$ ).

Review exercise: Match graphs and formulas.

Rule 3-2

If graph $$y = g(x)$$ is that of $$y = f(x)$$ stretched by the factor $$k$$-horizontally, then $$g(x) = f(x/k)$$. (Factor inside of $$f$$ ).

Example: Given $$f(x) = x$$ Stretched by 2x vertically is $$g(x) = 2 x$$ On the other hand:

We can get $$y = g(x)$$ by shrinking $$y = f(x)$$ horizontally, factor 2x. $$2x = \frac{x}{\frac{1}{2}}$$ Stretch by factor $$\frac{1}{2}$$ = shrink by 2.

Example:

$$f(x) = x^{2}$$ Vertical stretch by 2 is $$g(x) = 2x^{2}$$.

Horizontal stretch by $$\sqrt{2}$$ is $$g(x) = (\sqrt{2} x )^{2}$$. \begin{aligned}(\sqrt{2} x)^{2} & = (\sqrt{2})^{2} \cdot x^{2} \\ & 2 x^{2}\end{aligned}

Example:

Verify the plot $$2 x^{2}$$ vs. $$(2 x )^{2}$$.

Not the same!

More generally we interpret these operations as compositions.

## 13 Compositions:

Consider:

More Generally:

Variables have to match!

Example:

Represent $$z = h(x) = \sqrt[3]{x^{2} + 1 }$$ as the composition of two functions. (Easy if you know how). $$x \rightarrow x^{2} + 1 \xrightarrow{y} \sqrt[3]{y} \xrightarrow{z}$$

Example:

Given Speed (60 m/h), Miles per gallon (30 m/gal) and Cost per gallon (\$5/gal), represent the expense as a function of time.

Analysis:

$$\text{time (hours)} \xrightarrow{\text{60 m/h}} \text{distance (miles)}\xrightarrow{\text{30 m/gal}} \text{gas used (gal)} \xrightarrow{\\text{5/gal}}\text{expense } (\)$$

Composition:

$$t \rightarrow \underset{f}{ 60 t } \rightarrow d \rightarrow \underset{k}{\frac{d}{30}} \rightarrow g \rightarrow \underset{h}{5 g} \rightarrow e$$

Compute:

$$d = f(t) = 60t, \; g = k(d) = \frac{d}{30} \; e = h(g) = 5g$$

Substitute \begin{aligned}g = k(d) & = k(f(t)) \\e = h(g) & = h(k(d)) \\& = h(k(f(t)))\end{aligned} Read from right to left. ( $$f(t)$$ is not $$(t)f$$.

Example: $$f(x) = x^{2}$$ and $$g(x) = \cos x$$. Find $$f(g(x))$$, replace $$x$$ in $$f$$ with $$(\cos x )$$, always with parentheses. $$x^{2} \Longrightarrow ( \cos x )^{2}$$ or $$cos^{2} x$$.

Example:

Find $$g(f(x))$$. Replace $$x$$ in $$g$$ with $$(x^{2})$$. $$\cos x \rightarrow \cos (x^{2})$$

Review Exercise.

1. Stretch vertically by 2 (about $$y$$: $$g(x) = 2 f(x)$$ ).
2. Shift horizontally - right by 2 (about $$x$$: $$h(x) = g(x-2)$$ ).Replace $$x$$ with $$( x-2 )$$.(Suggestion: use parentheses a lot).

Algebraically:

$$f(x) = \sqrt{3 x - x^{2}} \Longrightarrow ?????\sqrt{3x - x^{2} - 2}$$

$$\sqrt{3 ( x - 2 ) - ( x - 2 )^{2} }$$

## 14 Algebra of Functions

For opertions, we need to align the variables first -- but in a different way.

1. Addition -- rename the variables:
2. Composition -- rename the variables:

Example: Find the composition of these functions. $$f(x) = x + 1, \; g(x) = 2x, \; h(x) = x - 1.$$ Find $$f \circ g \circ h$$.

Diagram:

Rename the variable to make them match:

$$y = h(x) = x - 1, \; z = g(y) = 2y, \; u = f(z) = z + 1$$

Algebraically:

Algorithm:

\begin{alignat}{3}& & y = x - 1 \\& z = 2y & \\u = z + 1 & &\end{alignat}

Algebra:

\begin{aligned}u = z + 1 & = (2y) + 1 \\& = 2y + 1 \\& = 2(x - 1) + 1\end{aligned}