See how we can add or subtract two functions to create a new function.
Just like we can add and subtract numbers, we can add and subtract functions. For example, if we had functions $f$ and $g$, we could create two new functions: $f+g$ and $f-g$.

### Eksempel

Let's look at an example to see how this works.
Given that $f(x)=x+1$ and $g(x)=x^2-2x+5$, find $(f+g)(x)$.

### Solution

The most difficult part of combining functions is understanding the notation. What does $(f+g)(x)$ mean?
Well, $(f+g)(x)$ just means to find the sum of $f(x)$ and $g(x)$. Mathematically, this means that $(f+g)(x)=f(x)+g(x)$.
Now, this becomes a familiar problem.
\begin{aligned} (f+g)(x) &= f(x)+g(x) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\small{\gray{\text{Define.}}}\\\\ &= \left(x+1\right)+\left(x^2-2x+5\right) ~~~~~~~~\small{\gray{\text{Substitute.}}}\\\\ &= x+1+x^2-2x+5~~~~~~~~~~~~~~~~\small{\gray{\text{Remove parentheses.}}}\\\\ &=x^2-x+6~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\small{\gray{\text{Combine like terms.}}} \end{aligned}

### We can also see this graphically:

The images below show the graphs of $y=f(x)$, $y=g(x)$, and $y=(f+g)(x)$.
From the first graph, we can see that $f(2)=\greenD 3$ and that $g(2)=\blueD 5$. From the second graph, we can see that $(f+g)(2)=\goldD 8$.
So $f(2)+g(2)=(f+g)(2)$ because $\greenD{3}+\blueD{5}=\goldD{8}$.
Now you try it. Convince yourself that $f(1)+g(1)=(f+g)(1)$.

## Let's try some practice problems.

In problems 1 and 2, let $a(x)=3x^2-5x+2$ and $b(x)=x^2+8x-10$.

## Subtracting two functions

Subtracting two functions works in a similar way. Here's an example:

### Eksempel

$p(t)=2t-1$ and $q(t)=-t^2-4t-1$.
Let's find $(q-p)(t)$.

### Solution

Again, the most complicated part here is understanding the notation. But after working through the addition example, $(q-p)(t)$ means just what you'd think!
By definition, $(q-p)(t)=q(t)-p(t)$. We can now solve the problem.
\begin{aligned} &\phantom{=}(q-p)(t) \\\\ &=q(t)-p(t)\quad\small{\gray{\text{Define.}}} \\\\ &= (-t^2-4t-1)-(2t-1)\quad\small{\gray{\text{Substitute.}}}\\\\ &=-t^2-4t-1-2t+1\quad\small{\gray{\text{Distribute negative sign.}}}\\\\ &=-t^2-6t \quad\small{\gray{\text{Combine like terms.}}}\end{aligned}
So $(q-p)(t)=-t^2-6t.$

## Let's try some practice problems.

### Opgave 3

$j(n)=3n^3-n^2+8$
$k(n)=-8n^2+3n-5$

### Opgave 4

$g(x)=4x^2-7x+2$
$h(x)=2x-5$

## An application

One college states that the number of men, $M$, and the number of women, $W$, receiving bachelor degrees $t$ years since 1980 can be modeled by the functions $M(t)=526-t$ and $W(t)=474+2t$, respectively.
Let $N$ be the total number of students receiving bachelors degrees at that college $t$ years since 1980.