# Combining Functions

It’s quite interesting that functions can be treated like numbers, namely you can define $+$, $-$, $\times$, and $\div$ on a collection of functions. How do we do this? For instance given two functions $f$ and $g$, we can define a new function $f+g$ by
$$(f+g)(x)=f(x)+g(x)$$
for all $x$ in the domain (for sake of simplicity we assume that $f$ and $g$ both have the same domain. If not, one can take the intersection of the domains of $f$ and $g$, no big deal). In a similar manner, we can also define $f-g$, $fg$, and $\frac{f}{g}$ respectively as
\begin{align*}
(f-g)(x)&=f(x)-g(x)\\
(fg)(x)&=f(x)g(x)\\
\left(\frac{f}{g}\right)(x)&=\frac{f(x)}{g(x)}\ \mbox{provided}\ g(x)\ne 0
\end{align*}

Example. Let $f(x)=\frac{1}{x-2}$ and $g(x)=\sqrt{x}$.

(a) Find the functions $f+g$, $f-g$, $fg$ and $\frac{f}{g}$ and their domains.

(b) Find $(f+g)(4)$, $(f-g)(4)$, $(fg)(4)$, $\left(\frac{f}{g}\right)(4)$

Solution. (a) $\mathrm{Dom}(f)=\{x|x\ne 2\}$ and $\mathrm{Dom}(g)=\{x|x\geq 0\}$. So the intersection is $\{x|0\leq x<2\}\cup\{x|x>2\}=[0,2)\cup(2,\infty)$ and this is the domain of $f+g$, $f-g$ and $fg$. For $\frac{f}{g}$ since $g$ is not defined at $x=0$, its domain should be $(0,2)\cup(2,\infty)$.
\begin{align*}
(f+g)(x)&=\frac{1}{x-2}+\sqrt{x}\\
(f-g)(x)&=\frac{1}{x-2}-\sqrt{x}\\
(fg)(x)&=\frac{\sqrt{x}}{x-2}\\
\left(\frac{f}{g}\right)(x)&=\frac{1}{(x-2)\sqrt{x}}
\end{align*}

(b) I will do only $(f+g)(4)$. One way to evaluate $(f+g)(4)$ is to use $(f+g)(x)$ we obtained in part (a) i.e. $(f+g)(4)=\frac{1}{4-2}+\sqrt{4}=\frac{5}{2}$. Another way is evaluating $f(4)$ and $g(4)$ first which are $f(4)=\frac{1}{2}$ and $g(4)=2$. Then $(f+g)(4)=f(4)+g(4)=\frac{5}{2}$.

Composite Functions

Given two functions $f$ and $g$, if the range of $f$ is a subset of the domain of $g$, then we can combine the two functions to create a new function which we will denote by $g\circ f$.
$$x\stackrel{f}{\longmapsto} f(x)\stackrel{g}{\longmapsto} g(f(x))$$
The above diagram hints us that we can define a new function $g\circ f$ by
$$(g\circ f)(x)=g(f(x))$$
We call $g\circ f$ “$f$ followed by $g$.”

Example. Let $f(x)=x^2$ and $g(x)=x-3$.

(a) Find composite functions $f\circ g$ and $g\circ f$ and their domains.

(b) Find $(f\circ g)(5)$ and $(g\circ f)(5)$.

Solution. (a) By definition $(f\circ g)(x)=f(g(x))=f(x-3)=(x-3)^2$. Also by definition $(g\circ f)(x)=g(f(x))=g(x^2)=x^2-3$. From these we can clearly see both their domains are $(-\infty,\infty)$. In general $\mathrm{Dom}(f\circ g)=\mathrm{Dom}(g)$ and $\mathrm{Dom}(g\circ f)=\mathrm{Dom}(f)$.

(b) $(f\circ g)(5)$ can be evaluated using $(f\circ g)(x)$ we obtained in part (a).
$$(f\circ g)(5)=(5-3)^2=4$$
There is another way to do this. If you don’t have to find $(f\circ g)(x)$ but only need to calculate $(f\circ g)(5)$, this may be simpler. First note $(f\circ g)(5)=f(g(5))$. $g(5)=5-3=2$, so $f(g(5))=f(2)=2^2=4$. Similarly we find $(g\circ f)(5)=22$. In general $(f\circ g)(x)\ne (g\circ f)(x)$.

# Nonlinear Inequalities

Nonlinear inequalities may seem more complicated and difficult to solve than linear inequalities. However it is not really the case. There is one simple way to solve a nonlinear inequality. It’s called the test point method. I will explain this with an example.

Example. Solve the inequality $x^2\leq 5x-6$.

Solution. The inequality can be rewritten $x^2-5x+6\leq 0$. First we find points at which $x^2-5x+6=0$. Since $x^2-5x+6=(x-2)(x-3)$, $x=2,3$. These two points divide the real line into 3 regions, where $x<2$, where $2<x<3$, and where $x>3$ as shown in Figure 1.

In each region we pick a test point to see if that test number satisfies the given inequality. If it does, any other number in the same region would satisfy the inequality. If not, any other number in the same region wouldn’t either. While this is pretty cool, you may wonder why this works. One number speaks for the entire numbers in the same region. It’s hard to explain here though but it is due to the continuity of the function $f(x)=x^2-5x+6$. I will leave it at that and will not delve into that any further. You will understand what I said when you learn calculus. In the region $x<2$, I would pick $x=0$ for a test point. But $x=0$ won’t satisfy the inequality as the LHS is $6>0$. Move onto the next region $2<x<3$. I pick $x=2.5=\frac{5}{2}$. Since $\left(\frac{5}{2}\right)^2-5\frac{5}{2}+6=\frac{25-50+24}{4}=-\frac{1}{4}<0$. So this means that $2<x<3$ is a solution of the inequality. In the final region $x>3$ I pick $x=4$. $(4)^2-5(4)+6=2>0$ so no number in this region would satisfy the inequality. Since $x=2$ and $x=3$ also satisfy the inequality, the overall solution is $2\leq x\leq 3$ or $[2,3]$ in interval notation.

The inequalities like one we just did is called quadratic inequalities. For quadratic inequalities we can actually classify solutions depending on inequalities without going through the test point method every time. Let us assume that the quadratic function $f(x)=ax^2+bx+c$ with $a>0$ has two real solutions $\alpha$ and $\beta$ ($\alpha<\beta$). Then the graph of $f(x)$ would look like one in Figure 2. You can find the solution of each of the following quadratic inequalities easily from the graph in Figure 2.

1. $ax^2+bx+c>0$: $x<\alpha$ or $x>\beta$. In interval notation, $(-\infty,\alpha)\cup(\beta,\infty)$.
2. $ax^2+bx+c\geq 0$: $x\leq\alpha$ or $x\geq\beta$. In interval notation, $(-\infty,\alpha]\cup[\beta,\infty)$.
3. $ax^2+bx+c<0$: $\alpha<x<\beta$. In interval notation, $(\alpha,\beta)$.
4. $ax^2+bx+c\leq 0$: $\alpha\leq x\leq\beta$. In interval notation, $[\alpha,\beta]$.

Let us go over a couple more examples of nonlinear inequalities that are not quadratic inequalities.

Example. Solve $x(x-1)^2(x-3)<0$.

Solution. The method is the same as the first example. We use the test point method. First find $x$ at which $x(x-1)^2(x-3)=0$. They are $x=0, 1, 3$. So there are 4 regions under consideration. $x<0$, $0<x<1$, $1<x<3$, and $x>3$. In the region where $x<0$, the test point $x=-1$ results the sign of the LHS is $+$. So $x<0$ is not a solution. In the region $0<x<1$, the test point $x=\frac{1}{2}$ results the sign of the LHS $-$, so $0<x<1$ is a solution. In the region $1<x<3$, the test point $x=2$ results the sign of the LHS still $-$. This is actually due to $(x-1)^2$. In general if you see an even number of repeated term $x-a$ in your polynomial inequality like the one we have the sign of the polynomial does not change at $x=a$. A little goody to know so you can save time. Let us move onto next and last one. For $x>3$ the test point $x=4$ results the sign of the LHS $+$, so $x>3$ is not a solution. Therefore, the overall solution is $0<x<1$ or $1<x<3$. In interval notation, it is $(0,1)\cup(1,3)$.

Example. Solve $\frac{1+x}{1-x}\geq 1$.

Solution. First rewrite the inequality as $\frac{1+x}{1-x}-1\geq 0$ which simplifies to $\frac{2x}{1-x}\geq 0$. Inequality like this we consider points at which the numerator is 0 and also points at which the denominator is 0. In our case they are $x=0, 1$ and these two points divide the real line into three regions: $x<0$, $0<x<1$, $x>1$. In the region $x<0$, the test point $x=-1$ results the sign of the LHS $-$, so $x<0$ is not a solution. In the region $0<x<1$, the test point $x=\frac{1}{2}$ results the sign of the LHS $+$, so $0<x<1$ is a solution. Finally in the region $x>1$ the test point $x=2$ results the sign of the LHS $-$, so $x>1$ is not a solution. Since $x=0$ also satisfies the inequality, the overall solution is $0\leq x<1$ or $[0,1)$ in interval notation.

# Absolute Value Equations and Absolute Value Inequalities

Absolute Value Equations

First let us review the definition of absolute value $|\cdot |$.

Definition. The absolute value of $|a|$ of a number $a$ is defined by
$$|a|=\left\{\begin{array}{ccc} a & \mbox{if} & a\geq 0\\ -a & \mbox{if} & a<0 \end{array}\right.$$
Interestingly a lot of students get confused with the definition while they have no problem with getting the absolute of a particular number correctly like $|2|=2$ and $|-2|=2$. That’s because of the way they were taught. Many teachers teach absolute value like some sort of magic: “Hey guys what absolute value does is whatever number you put into between the two vertical lines it becomes positive.” While this may be easy to understand for students this is not an action performed in mathematics. In algebra whatever action you do should be carried out by operations such as $+$, $-$, $\times$, or $\div$. In terms of an operation what happens to $|-2|=2$ is in fact that $|-2|=-(-2)=2$. It is not abracadabra. For a letter $a$ representing a number, if $a<0$, to make it positive $|a|=-a$. Students get confused because $-a$ looks like negative but it is not. Remember the condition $a<0$. So $-a$ is actually positive. So don’t be deceived by its look.

Now we are ready to discuss absolute value equations. All you need to know is

\label{eq:abs}
|x|=k\ \mbox{if and only if}\ x=\pm k

for $k>0$. If $k=0$, $x=0$. If $k<0$, obviously there is no solution.

Example. Solve the equation
$$|2x-5|=3$$

Solution. By \eqref{eq:abs}, we get the two linear equations $2x-5=\pm 3$. Solving these equation, we find $x=4$ or $x=1$.

Absolute value equations are related to quadratic equations. If you square the above equation, we get the quadratic equation
$$x^2-5x+4=0$$
Solving this quadratic equation, we of course obtain the same solutions. In practice why bother? Solving absolute value equations directly is easier. Note though that absolute value equations are actually obtained when you solve quadratic equations by the method of completing the square.

Absolute Value Inequalities

For absolute value inequalities all you have to know is the following picture.

Figure 1. Absolute Value Inequalities

From Figure 1 we can read for $k>0$

1.  $|x|<k$ if and only if $-k<x<k$.
2. $|x|\leq k$ if and only if $-k\leq x\leq k$.
3. $|x|>k$ if and only if $x<-k$ or $x>k$.
4. $|x|\geq k$ if and only if $|x|\leq -k$ or $|x|\geq k$.

Example. Solve the inequality $|x-5|<2$.

Solution. $|x-5|<2$ implies that $-2<x-5<2$ i.e. $3<x<7$.

Example. Solve the inequality $|3x+2|\geq 4$.

Solution. $|3x+2|\geq 4$ implies that $3x+2\leq -4$ or $3x+2\geq 4$ i.e. $x\leq-2$ or $x\geq\frac{2}{3}$.

# Lines

A line in the plane is determined by two points meaning there is only one line passing through two given points in the plane. But it could be determined by some other quantities. An important such quantity is slope. Slope measures steepness of a line and it is defined by $\frac{\mbox{rise}}{\mbox{run}}$. If two points $(x_1,y_1)$ and $(x_2,y_2)$ are known, the slope $m$ of the line through the two points is

\label{eq:slope}
m=\frac{y_2-y_1}{x_2-x_1}

Example. Find the slope of the line passing through the points $P(2,1)$ and $Q(8,5)$.

Solution. Note that it really doesn’t matter which ones you label as $(x_1,y_1)$ and $(x_2,y_2)$. Here we choose $(x_1,y_1)=(2,1)$ and $(x_2,y_2)=(8,5)$. Using \eqref{eq:slope} we find the slope
$$m=\frac{5-1}{8-2}=\frac{4}{6}=\frac{2}{3}$$

A cool thing to see is that certain geometric objects can be described by equations so we can study geometry in terms of algebra. Such objects include lines, circles, parabolas, elipses, and so on so forth. Why is this cool? Because algebra is much easier than geometry. A branch of mathematics that studies geometric objects in terms of algebra is analytic geometry and this is further generalized into another branch called algebraic geometry.

So how do we write an equation for a given line? Well, we already have it. The equation \eqref{eq:slope}. But in order to write it as an equation we need to tweak it a bit. An equation relates an arbitrary point $(x,y)$ on the line to some known quantities. So let’s say slope $m$ and a point $(x_1,y_1)$ is known. Then by \eqref{eq:slope} we get
$$m=\frac{y-y_1}{x-x_1}$$
This is the equation of the line with slope $m$ passing through a point $(x_1,y_1)$. But to make it look a bit nicer we rewrite it as

\label{eq:line}
y-y_1=m(x-x_1)

Example. Find the equation of the line through $(-1,3)$ with slope $-\frac{1}{2}$ and sketch the line.

Solution. Using \eqref{eq:line} we find
$$y-3=-\frac{1}{2}(x-(-1))$$
Solving this for $y$ we obtain
$$y=-\frac{1}{2}x+\frac{5}{2}$$
There are two ways to sketch the line. One is using the slope and the given point. Slope being $-\frac{1}{2}$ means that when $x$ moves 2 units to the right its corresponding $y$ moves 1 unit downward. Apply this to the point $(-1,3)$ we will land at another point which is $(1,2)$. You draw the line passing through the two points $(-1,3)$ and $(1,2)$ as shown in Figure 1.

Figure 1. Drawing a line

The other way to sketch the line is to find another point. An easy choice is to find the $x$-intercept by setting $y=0$. The $x$-intercept is $(5,0)$. You draw the line through $(-1,3)$ and $(5,0)$.

As a special case if the slope $m$ and the $y$-intercept $(0,b)$ are given, the equation \eqref{eq:line} becomes

\label{eq:line2}
y=mx+b

Even though the $y$-intercept is not known in fact \eqref{eq:line2} can be also used to find the equation of the line in the previous example. Since $m=-\frac{1}{2}$, we set
$$y=-\frac{1}{2}x+b$$
The line is passing through $(-1,3)$ we have
$$3=-\frac{1}{2}(-1)+b$$
Solving this for $b$ we find $b=\frac{5}{2}$.

Parallel and Perpendicular Lines

It’s obvious that two lines with slopes $m_1$ and $m_2$ are parallel if $m_1=m_2$. What’s not so obvious however is the following property.

Two lines with slopes $m_1$ and $m_2$ are perpendicular if $m_1m_2=-1$.

We will not mind the proof of this property here.

Example. Find an equation of the line through $(5,2)$ that is parallel to the line $y=-\frac{2}{3}x-\frac{5}{6}$.

Solution. The slope is $m=-\frac{2}{3}$. Since this line is passing through the point $(5,2)$, by \eqref{eq:line} the equation is
$y-2=-\frac{2}{3}(x-5)$. This simplifies to
$y=-\frac{2}{3}x+\frac{16}{3}$.

Example. Find an equation of the line through $(5,2)$ that is perpendicular to the line $y=-\frac{2}{3}x-\frac{5}{6}$.

Solution. The slope is $m=\frac{3}{2}$. Since the line is passing through $(5,2)$, by \eqref{eq:line} the equation is
$y-2=\frac{3}{2}(x-5)$ which simplifies to $y=\frac{3}{2}x-\frac{11}{2}$.

Figure 2. Two perpendicular lines y=-(2/3)x-5/6 (in blue) and y=(3/2)x-11/2 (in red)

# Graphing Polynomial Functions

Polynomial functions have the following important property:

Every polynomial function of degree $n$ has at most $n$ real zeros.”

This property is called the Fundamental Theorem of Algebra.

As an application of this property, we see that a polynomial function of degree $n$ can have at most $n$ $x$-intercepts and at most $(n-1)$ turning points (local maximum and local minimum values).

Example. The function $f(x)=x^4-7x^3+12x^2+4x-16$ has three turning points that are two local minimum values and one local maximum value.

Graphing a Polynomial Function $p(x)$

1. First find all zeros of $p(x)$
2. Considering the even or odd multiplicity of each factor of $p(x)$, we can see the graph is crossing or touching the $x$-axis at each zero.
3. Use the leading-term test to determine the end behavior.
4. Use the $y$-intercept.

Example. Consider $f(x)=x^4-7x^3+12x^2+4x-16$. It can be factored as $f(x)=(x+1)(x-2)^2(x-4)$. (At this moment you don’t have to worry about how we get the facotring. We will discuss this in Sections 3.3 and 3.4.) So we find three zeros $-1$, $2$ (with multiplicity 2), and $4$. We can tell that the graph crosses at $-1$ and $4$ and touches the graph without crossing at $2$. Since the degree is $4$, an even number the graph goes up when $x\to -\infty$ and $x\to\infty$. These findings are all featured in the above graph.

The Intermediate Value Theorem

Let $p(x)$ be a polynomial (with real coefficients). Suppose that $p(a)$ and $p(b)$ have different signs for two distinct numbers $a$ and $b$. Then the graph of $p(x)$ must cross the $x$-axis between $a$ and $b$, i.e. $p(x)$ must have a zero between $a$ and $b$. This property is called the Intermediate Value Theorem.

Example. (a) Use the Intermediate Value Theorem to determine if
$$f(x)=x^3+3x^2-9x-13$$
has a zero between $a=1$ and $b=2$.

Solution. All you have to do is to evaluate $f(x)$ at $x=1$ and $x=2$, i.e. calculate $f(1)$ and $f(2)$ and see if they are different.
\begin{align*}
f(1)&=(1)^3+3(1)^2-9(1)-13=-18,\\
f(2)&=(2)^3+3(2)^2-9(2)-13=-11.
\end{align*}
$f(1)$ and $f(2)$ have the same sign, so the Intermediate Value Theorem won’t tell if $f(x)$ has a zero between $1$ and $2$. The following graph shows that it actually does not.

(b) Does $f(x)$ has a zero between $a=-5$ and $b=-4$?

Solution. $f(-5)=-18$ and $f(-4)=7$. Since their signs are different, by the Intermediate Value Theorem, there must be a zero between $-5$ and $-4$. The following graph confirms it.