# Intro to combining functions

Become familiar with the idea that we can add, subtract, multiply, or divide two functions together to make a new function.
Just like we can add, subtract, multiply, and divide numbers, we can also add, subtract, multiply, and divide functions.

# The sum of two functions

## Part 1: Creating a new function by adding two functions

Let's add f, left parenthesis, x, right parenthesis, equals, x, plus, 1 and g, left parenthesis, x, right parenthesis, equals, 2, x together to make a new function.
Let's call this new function h. So we have:
h, left parenthesis, x, right parenthesis, equals, f, left parenthesis, x, right parenthesis, plus, g, left parenthesis, x, right parenthesis, equals, 3, x, plus, 1

## Part 2: Evaluating a combined function

We can also evaluate combined functions for particular inputs. Let's evaluate function h above for x, equals, 2. Below are two ways of doing this.
Method 1: Substitute x, equals, 2 into the combined function h.
\begin{aligned}h(x)&=3x+1\\\\ h(2)&=3(2)+1\\\\ &=\greenD{7} \end{aligned}
Method 2: Find f, left parenthesis, 2, right parenthesis and g, left parenthesis, 2, right parenthesis and add the results.
Since h, left parenthesis, x, right parenthesis, equals, f, left parenthesis, x, right parenthesis, plus, g, left parenthesis, x, right parenthesis, we can also find h, left parenthesis, 2, right parenthesis by finding f, left parenthesis, 2, right parenthesis, plus, g, left parenthesis, 2, right parenthesis.
First, let's find f, left parenthesis, 2, right parenthesis:
\begin{aligned}f(x)&= {x + 1}\\\\ f(2)&=2+1 \\\\ &=3\end{aligned}
Now, let's find g, left parenthesis, 2, right parenthesis:
\begin{aligned}g(x)&={2x}\\\\ g(2)&=2\cdot 2 \\\\ &=4\end{aligned}
So f, left parenthesis, 2, right parenthesis, plus, g, left parenthesis, 2, right parenthesis, equals, 3, plus, 4, equals, start color greenD, 7, end color greenD.
Notice that substituting x, equals, 2 directly into function h and finding f, left parenthesis, 2, right parenthesis, plus, g, left parenthesis, 2, right parenthesis gave us the same answer!

# Now let's try some practice problems.

In problems 1 and 2, let f, left parenthesis, x, right parenthesis, equals, 3, x, plus, 2 and g, left parenthesis, x, right parenthesis, equals, x, minus, 3.

#### Problem 1

Find f, left parenthesis, x, right parenthesis, plus, g, left parenthesis, x, right parenthesis.

#### Problem 2

Evaluate f, left parenthesis, minus, 1, right parenthesis, plus, g, left parenthesis, minus, 1, right parenthesis.

Here are a couple of ways to find the answer.
Method 1: Find f, left parenthesis, minus, 1, right parenthesis and g, left parenthesis, minus, 1, right parenthesis separately. Then add the two.
First, let's find f, left parenthesis, minus, 1, right parenthesis:
\begin{aligned} f(x) &=3x+2\\\\ f(-1)&= 3(-1)+2\\\\ &= -1\end{aligned}
Next, let's find g, left parenthesis, minus, 1, right parenthesis:
\begin{aligned} g(x) &=x-3\\\\ g(-1)&= -1-3\\\\ &= -4\end{aligned}
So f, left parenthesis, minus, 1, right parenthesis, plus, g, left parenthesis, minus, 1, right parenthesis, equals, minus, 1, plus, left parenthesis, minus, 4, right parenthesis, equals, start color greenD, minus, 5, end color greenD
Method 2: Find f, left parenthesis, x, right parenthesis, plus, g, left parenthesis, x, right parenthesis first, and then evaluate this expression when x, equals, minus, 1.
When x, equals, minus, 1, this expression is equal to 4, left parenthesis, minus, 1, right parenthesis, minus, 1 or start color greenD, minus, 5, end color greenD.

# A graphical connection

We can also understand what it means to add two functions by looking at graphs of the functions.
The graphs of y, equals, m, left parenthesis, x, right parenthesis and y, equals, n, left parenthesis, x, right parenthesis are shown below. In the first graph, notice that m, left parenthesis, 4, right parenthesis, equals, 2. In the second graph, notice that n, left parenthesis, 4, right parenthesis, equals, 5.
Let p, left parenthesis, x, right parenthesis, equals, m, left parenthesis, x, right parenthesis, plus, n, left parenthesis, x, right parenthesis. Now look at the graph of y, equals, p, left parenthesis, x, right parenthesis. Notice that p, left parenthesis, 4, right parenthesis, equals, start color blueD, 2, end color blueD, plus, start color maroonD, 5, end color maroonD, equals, start color purpleD, 7, end color purpleD.
Challenge yourself to see that p, left parenthesis, x, right parenthesis, equals, m, left parenthesis, x, right parenthesis, plus, n, left parenthesis, x, right parenthesis for every value of x by looking at the three graphs.

## Let's practice.

#### Problem 3

The graphs of y, equals, f, left parenthesis, x, right parenthesis and y, equals, g, left parenthesis, x, right parenthesis are shown below.
Which is the best approximation of f, left parenthesis, 3, right parenthesis, plus, g, left parenthesis, 3, right parenthesis?

We can use the graphs of y, equals, f, left parenthesis, x, right parenthesis and y, equals, g, left parenthesis, x, right parenthesis to find f, left parenthesis, 3, right parenthesis and g, left parenthesis, 3, right parenthesis.
The graph below shows that f, left parenthesis, 3, right parenthesis, equals, 6.
The graph below shows that g, left parenthesis, 3, right parenthesis, equals, 3.
So f, left parenthesis, 3, right parenthesis, plus, g, left parenthesis, 3, right parenthesis, equals, 6, plus, 3, equals, 9.

# Other ways to combine functions

All of the examples we've looked at so far create a new function by adding two functions, but you can also subtract, multiply, and divide two functions to make new functions!
For example, if f, left parenthesis, x, right parenthesis, equals, x, plus, 3 and g, left parenthesis, x, right parenthesis, equals, x, minus, 2, then we can not only find the sum, but also ...
... the difference.
\begin{aligned}f(x)-g(x)&=(x+3)-(x-2)~~~~~~~\small{\gray{\text{Substitute.}}}\\\\ &=x+3-x+2~~~~~~~~~~~~~\small{\gray{\text{Distribute negative sign.}}}\\\\ &=5~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\small{\gray{\text{Combine like terms.}}}\end{aligned}
... the product.
\begin{aligned}f(x)\cdot g(x)&=(x+3)(x-2)~~~~~~~~~~~~\small{\gray{\text{Substitute.}}}\\\\ &=x^2-2x+3x-6~~~~~~~~\small{\gray{\text{Distribute.}}}\\\\ &=x^2+x-6~~~~~~~~~~~~~~~~~~~\small{\gray{\text{Combine like terms.}}}\end{aligned}
... the quotient.
\begin{aligned}f(x)\div g(x)&=\dfrac{f(x)}{g(x)} \\\\ &=\dfrac{(x+3)}{(x-2)}~~~~~~~~~~~~~~~~~~~~~\small{\gray{\text{Substitute.}}} \end{aligned}
In doing so, we have just created three new functions!

# Challenge problem

p, left parenthesis, t, right parenthesis, equals, t, plus, 2
q, left parenthesis, t, right parenthesis, equals, t, minus, 1
r, left parenthesis, t, right parenthesis, equals, t
Evaluate p, left parenthesis, 3, right parenthesis, dot, q, left parenthesis, 3, right parenthesis, dot, r, left parenthesis, 3, right parenthesis, minus, p, left parenthesis, 3, right parenthesis.

Let's first find p, left parenthesis, 3, right parenthesis, q, left parenthesis, 3, right parenthesis, and r, left parenthesis, 3, right parenthesis by substituting t, equals, 3 into each of the formulas.
First, let's find p, left parenthesis, 3, right parenthesis:
\begin{aligned}p(t) &=t+2\\\\ p(3)&= 3+2\\\\ &=\blueD5\end{aligned}
Next, let's find q, left parenthesis, 3, right parenthesis:
\begin{aligned} q(t) &=t-1\\\\ q(3)&= 3-1\\\\ &=\purpleC2\end{aligned}
Finally, let's find r, left parenthesis, 3, right parenthesis:
\begin{aligned} r(t) &=t\\\\ r(3)&= 3\\\\ &=\goldD3\end{aligned}
We can now find p, left parenthesis, 3, right parenthesis, dot, q, left parenthesis, 3, right parenthesis, dot, r, left parenthesis, 3, right parenthesis, minus, p, left parenthesis, 3, right parenthesis as follows:
\begin{aligned} p(3) \cdot q(3) \cdot r(3) - p(3)&= \blueD5\cdot \purpleC2\cdot \goldD3-\blueD5 \\\\ &= 30-5 \\\\ &= 25 \end{aligned}
We could also find p, left parenthesis, t, right parenthesis, dot, q, left parenthesis, t, right parenthesis, dot, r, left parenthesis, t, right parenthesis, minus, p, left parenthesis, t, right parenthesis first, and then find the value of this expression when t, equals, 3. This would be more complicated, though, since the result would be a third degree polynomial!