Skip to content
Family Table Math
Auto

Adding and Subtracting Functions

You can combine two functions into a new one just by adding or subtracting their outputs. This happens all the time in the real world: profit is revenue minus cost, and the sound of a chord or a phone’s dial tone is two waves added together. In this lesson you’ll add and subtract functions with equations, tables, and graphs, and see which properties of the pieces carry over to the result. Trig functions here use radians.

For two functions ff and gg:

(f+g)(x)=f(x)+g(x)(f−g)(x)=f(x)−g(x)(f + g)(x) = f(x) + g(x) \qquad\qquad (f - g)(x) = f(x) - g(x)

In words: put the same xx into both functions, then add (or subtract) the two outputs. For example, if f(2)=7f(2) = 7 and g(2)=−3g(2) = -3, then (f+g)(2)=7+(−3)=4(f + g)(2) = 7 + (-3) = 4 and (f−g)(2)=7−(−3)=10(f - g)(2) = 7 - (-3) = 10.

Order matters for subtraction: (g−f)(x)=−(f−g)(x)(g - f)(x) = -(f - g)(x), so the two differences are opposites.

(f+g)(x)(f + g)(x) only makes sense when both f(x)f(x) and g(x)g(x) exist. So the domain of f+gf + g (and of f−gf - g) is the set of xx-values that are in the domain of ff and in the domain of gg: the intersection, or overlap, of the two domains.

Line up the xx-values and add (or subtract) the outputs in each column. You can only combine at xx-values that appear in both tables.

To sketch y=f(x)+g(x)y = f(x) + g(x), add the heights of the two graphs at each xx, not the xx-values. Some points are especially easy:

  • Where g(x)=0g(x) = 0, the sum equals f(x)f(x), so the new graph meets the graph of ff there (and the same the other way round).
  • Where f(x)f(x) and g(x)g(x) are opposites, the sum is 00: a zero of f+gf + g.
  • Where f(x)=g(x)f(x) = g(x), the difference f−gf - g is 00.
  • Where both graphs are high, the sum is even higher; where one is positive and one is negative, they partly cancel.

Adding sinusoidal functions is called superposition. A musical chord, a phone’s dial tone (each key plays two pure tones at once), and noise-cancelling headphones all work by adding waves. The period of a sum like sin⁡x+sin⁡2x\sin x + \sin 2x is the smallest length after which both pieces repeat: sin⁡x\sin x repeats every 2π2\pi and sin⁡2x\sin 2x every π\pi, so the sum repeats every 2π2\pi. The sum is usually not a simple sinusoid: its shape can be quite different from either piece (see Example 3).

From even and odd functions: ff is even if f(−x)=f(x)f(-x) = f(x) and odd if f(−x)=−f(x)f(-x) = -f(x).

ffggf+gf + g and f−gf - g
eveneveneven
oddoddodd
evenoddusually neither

For example, if ff and gg are both even, then (f+g)(−x)=f(−x)+g(−x)=f(x)+g(x)=(f+g)(x)(f + g)(-x) = f(-x) + g(-x) = f(x) + g(x) = (f + g)(x).

Increasing behaviour adds up too: if ff and gg are both increasing on an interval, so is f+gf + g. But the difference of two increasing functions can do anything (see Practice question 9).

Let f(x)=x2−3xf(x) = x^2 - 3x and g(x)=2x+5g(x) = 2x + 5. Find (f+g)(x)(f + g)(x) and (f−g)(x)(f - g)(x), then evaluate (f−g)(−1)(f - g)(-1).

Solution.

(f+g)(x)=(x2−3x)+(2x+5)=x2−x+5(f + g)(x) = (x^2 - 3x) + (2x + 5) = x^2 - x + 5

For the difference, put brackets around g(x)g(x) so the minus sign reaches every term:

(f−g)(x)=(x2−3x)−(2x+5)=x2−3x−2x−5=x2−5x−5\begin{aligned} (f - g)(x) &= (x^2 - 3x) - (2x + 5) \\ &= x^2 - 3x - 2x - 5 \\ &= x^2 - 5x - 5 \end{aligned}

Then (f−g)(−1)=(−1)2−5(−1)−5=1+5−5=1(f - g)(-1) = (-1)^2 - 5(-1) - 5 = 1 + 5 - 5 = 1.

Check with the original functions: f(−1)=1+3=4f(-1) = 1 + 3 = 4 and g(−1)=−2+5=3g(-1) = -2 + 5 = 3, so (f−g)(−1)=4−3=1(f - g)(-1) = 4 - 3 = 1. ✓

Let f(x)=x−1f(x) = \sqrt{x - 1} and g(x)=5−xg(x) = \sqrt{5 - x}. Find the domain of h(x)=(f+g)(x)h(x) = (f + g)(x), and evaluate h(1)h(1), h(3)h(3) and h(5)h(5).

Solution. f(x)f(x) needs x−1≥0x - 1 \ge 0, so x≥1x \ge 1. g(x)g(x) needs 5−x≥05 - x \ge 0, so x≤5x \le 5. The sum needs both, so the domain is the overlap:

{x∈R∣1≤x≤5}\{x \in \mathbb{R} \mid 1 \le x \le 5\}

Now evaluate:

h(1)=0+4=2h(3)=2+2=22≈2.83h(5)=4+0=2\begin{aligned} h(1) &= \sqrt{0} + \sqrt{4} = 2 \\ h(3) &= \sqrt{2} + \sqrt{2} = 2\sqrt{2} \approx 2.83 \\ h(5) &= \sqrt{4} + \sqrt{0} = 2 \end{aligned}

Something like h(6)h(6) doesn’t exist: g(6)=−1g(6) = \sqrt{-1} isn’t a real number, even though f(6)=5f(6) = \sqrt{5} is fine.

Let h(x)=sin⁡x+sin⁡2xh(x) = \sin x + \sin 2x, with xx in radians. Make a table of values for 0≤x≤2π0 \le x \le 2\pi, sketch the graph, and find the period and the zeros.

Solution. Add the outputs of sin⁡x\sin x and sin⁡2x\sin 2x at multiples of π4\tfrac{\pi}{4} (decimals rounded to 2 places):

xx00π4\frac{\pi}{4}π2\frac{\pi}{2}3π4\frac{3\pi}{4}π\pi5π4\frac{5\pi}{4}3π2\frac{3\pi}{2}7π4\frac{7\pi}{4}2π2\pi
sin⁡x\sin x000.710.71110.710.7100−0.71-0.71−1-1−0.71-0.7100
sin⁡2x\sin 2x001100−1-1001100−1-100
h(x)h(x)001.711.7111−0.29-0.29000.290.29−1-1−1.71-1.7100
y = sin x (dashed), y = sin 2x (dotted) and their sum y = sin x + sin 2x from 0 to 2π. The sum has zeros at 0, 2π/3, π, 4π/3 and 2π and a maximum of about 1.76. −1 1 π/2 π 3π/2 2π max ≈ 1.76 y = sin x + sin 2x y = sin x y = sin 2x
The solid curve is the sum of the dashed and dotted waves: at every xx, its height is the sum of their heights.

Period. sin⁡x\sin x repeats every 2π2\pi, and sin⁡2x\sin 2x repeats every π\pi (so also every 2π2\pi). Both pieces are back to the start after 2π2\pi, so the period of hh is 2π2\pi.

Zeros. Use the double angle identity sin⁡2x=2sin⁡xcos⁡x\sin 2x = 2\sin x\cos x (you’ll see it in double angle formulas):

sin⁡x+2sin⁡xcos⁡x=sin⁡x (1+2cos⁡x)=0\sin x + 2\sin x\cos x = \sin x\,(1 + 2\cos x) = 0

So sin⁡x=0\sin x = 0, giving x=0,π,2πx = 0, \pi, 2\pi, or cos⁡x=−12\cos x = -\tfrac{1}{2}, giving x=2π3,4π3x = \tfrac{2\pi}{3}, \tfrac{4\pi}{3}. The zeros in [0,2π][0, 2\pi] are 00, 2π3\tfrac{2\pi}{3}, π\pi, 4π3\tfrac{4\pi}{3} and 2π2\pi.

Notice how different the sum looks from either wave. Its maximum, about 1.761.76 near x≈0.94x \approx 0.94, is less than 1+1=21 + 1 = 2, because sin⁡x\sin x and sin⁡2x\sin 2x never reach their peaks at the same xx.

Decide whether each function is even, odd, or neither.

  • (a) p(x)=x4+cos⁡xp(x) = x^4 + \cos x
  • (b) q(x)=x3+sin⁡xq(x) = x^3 + \sin x
  • (c) r(x)=x2+xr(x) = x^2 + x

Solution. Replace xx with −x-x and compare.

(a) x4x^4 and cos⁡x\cos x are both even: p(−x)=(−x)4+cos⁡(−x)=x4+cos⁡x=p(x)p(-x) = (-x)^4 + \cos(-x) = x^4 + \cos x = p(x). Even.

(b) x3x^3 and sin⁡x\sin x are both odd: q(−x)=(−x)3+sin⁡(−x)=−x3−sin⁡x=−q(x)q(-x) = (-x)^3 + \sin(-x) = -x^3 - \sin x = -q(x). Odd.

(c) r(−x)=(−x)2+(−x)=x2−xr(-x) = (-x)^2 + (-x) = x^2 - x. This is neither r(x)=x2+xr(x) = x^2 + x nor −r(x)=−x2−x-r(x) = -x^2 - x. Neither. A quick numerical check: r(1)=2r(1) = 2 but r(−1)=0r(-1) = 0, which is neither 22 nor −2-2.

Not distributing the minus sign. (x2−3x)−(2x+5)(x^2 - 3x) - (2x + 5) is x2−5x−5x^2 - 5x - 5, not x2−5x+5x^2 - 5x + 5. Always put brackets around the function you’re subtracting.

Using every xx that works for either function. The domain of f+gf + g is where both are defined, not where at least one is. In Example 2, x=6x = 6 works for ff but not for gg, so it’s not in the domain of the sum.

Adding the x-values on a graph. Graphical addition adds heights at the same xx. The point (2,3)(2, 3) on ff and (2,5)(2, 5) on gg give (2,8)(2, 8) on f+gf + g, not (4,8)(4, 8).

Treating f − g and g − f as the same. They’re opposites: if (f−g)(3)=4(f - g)(3) = 4, then (g−f)(3)=−4(g - f)(3) = -4.

Assuming the period of a sum is the smaller period. sin⁡x+sin⁡2x\sin x + \sin 2x does not repeat every π\pi: the sin⁡x\sin x part hasn’t come back yet. Look for the first length after which both pieces repeat.

Assuming even + odd is even (or odd). It’s usually neither, as in x2+xx^2 + x. Test with f(−x)f(-x), or try one number like x=1x = 1 and x=−1x = -1.

1. (Warm-up) Let f(x)=3x−4f(x) = 3x - 4 and g(x)=x2+1g(x) = x^2 + 1. Find (f+g)(x)(f + g)(x), (f−g)(x)(f - g)(x) and (g−f)(x)(g - f)(x).

Solution(f+g)(x)=3x−4+x2+1=x2+3x−3(f + g)(x) = 3x - 4 + x^2 + 1 = x^2 + 3x - 3(f−g)(x)=3x−4−(x2+1)=−x2+3x−5(f - g)(x) = 3x - 4 - (x^2 + 1) = -x^2 + 3x - 5(g−f)(x)=x2+1−(3x−4)=x2−3x+5(g - f)(x) = x^2 + 1 - (3x - 4) = x^2 - 3x + 5

Notice that g−fg - f is the opposite of f−gf - g.

2. (Warm-up) Use the table to complete a table of values for f+gf + g and f−gf - g.

xx−2-2−1-1001122
f(x)f(x)5522112255
g(x)g(x)−3-3−1-1113355
Solution

Add or subtract down each column:

xx−2-2−1-1001122
(f+g)(x)(f + g)(x)221122551010
(f−g)(x)(f - g)(x)883300−1-100

The difference is 00 at x=0x = 0 and x=2x = 2, exactly where f(x)=g(x)f(x) = g(x).

3. (Warm-up) On the same axes, the graph of ff passes through (1,4)(1, 4) and the graph of gg passes through (1,−6)(1, -6). Which point is on the graph of y=f(x)+g(x)y = f(x) + g(x)? Which is on y=f(x)−g(x)y = f(x) - g(x)?

Solution

Keep x=1x = 1 and add or subtract the heights.

f+gf + g: 4+(−6)=−24 + (-6) = -2, so the point is (1,−2)(1, -2).

f−gf - g: 4−(−6)=104 - (-6) = 10, so the point is (1,10)(1, 10).

4. (Core) Let f(x)=x+3f(x) = \sqrt{x + 3} and g(x)=1x−2g(x) = \dfrac{1}{x - 2}. State the domain of f+gf + g, and evaluate (f+g)(1)(f + g)(1).

Solution

ff needs x≥−3x \ge -3. gg needs x≠2x \ne 2. The sum needs both:

{x∈R∣x≥−3, x≠2}\{x \in \mathbb{R} \mid x \ge -3,\ x \ne 2\}(f+g)(1)=4+11−2=2−1=1(f + g)(1) = \sqrt{4} + \frac{1}{1 - 2} = 2 - 1 = 1

5. (Core) A bakery’s daily revenue from selling nn loaves is R(n)=15nR(n) = 15n dollars, and its daily cost is C(n)=0.02n2+3n+800C(n) = 0.02n^2 + 3n + 800 dollars.

  • (a) Find the profit function P(n)=R(n)−C(n)P(n) = R(n) - C(n).
  • (b) Find the profit when 200200 loaves are sold.
  • (c) How many loaves give the maximum profit, and what is that profit?
Solution

(a)

P(n)=15n−(0.02n2+3n+800)=−0.02n2+12n−800P(n) = 15n - (0.02n^2 + 3n + 800) = -0.02n^2 + 12n - 800

(b) P(200)=−0.02(40 000)+2400−800=−800+2400−800=800P(200) = -0.02(40\,000) + 2400 - 800 = -800 + 2400 - 800 = 800, so the profit is $800.

(c) PP is a parabola opening down. Its vertex is at n=−b2a=−122(−0.02)=300n = -\dfrac{b}{2a} = -\dfrac{12}{2(-0.02)} = 300:

P(300)=−0.02(90 000)+3600−800=−1800+3600−800=1000P(300) = -0.02(90\,000) + 3600 - 800 = -1800 + 3600 - 800 = 1000

Selling 300300 loaves gives the maximum profit, $1000.

6. (Core) Decide whether each function is even, odd, or neither. Show your reasoning.

  • (a) f(x)=x3+2xf(x) = x^3 + 2x
  • (b) g(x)=x2−cos⁡xg(x) = x^2 - \cos x
  • (c) h(x)=x2+sin⁡xh(x) = x^2 + \sin x
Solution

(a) f(−x)=−x3−2x=−(x3+2x)=−f(x)f(-x) = -x^3 - 2x = -(x^3 + 2x) = -f(x). Odd (odd + odd).

(b) g(−x)=(−x)2−cos⁡(−x)=x2−cos⁡x=g(x)g(-x) = (-x)^2 - \cos(-x) = x^2 - \cos x = g(x). Even (even − even).

(c) h(−x)=x2−sin⁡xh(-x) = x^2 - \sin x, which is neither h(x)h(x) nor −h(x)-h(x). Neither (even + odd). For example, h ⁣(π2)=π24+1≈3.47h\!\left(\tfrac{\pi}{2}\right) = \tfrac{\pi^2}{4} + 1 \approx 3.47 but h ⁣(−π2)=π24−1≈1.47h\!\left(-\tfrac{\pi}{2}\right) = \tfrac{\pi^2}{4} - 1 \approx 1.47.

7. (Core) Let h(x)=sin⁡x+cos⁡xh(x) = \sin x + \cos x, with xx in radians.

  • (a) Make a table of values at multiples of π4\tfrac{\pi}{4} from 00 to 2π2\pi. Give exact values.
  • (b) State the zeros in [0,2π][0, 2\pi], the period, and the largest value in your table.
Solution

(a) Use the special values sin⁡π4=cos⁡π4=22\sin\tfrac{\pi}{4} = \cos\tfrac{\pi}{4} = \tfrac{\sqrt{2}}{2}:

xx00π4\frac{\pi}{4}π2\frac{\pi}{2}3π4\frac{3\pi}{4}π\pi5π4\frac{5\pi}{4}3π2\frac{3\pi}{2}7π4\frac{7\pi}{4}2π2\pi
h(x)h(x)112\sqrt{2}1100−1-1−2-\sqrt{2}−1-10011

(b) The zeros are x=3π4x = \tfrac{3\pi}{4} and x=7π4x = \tfrac{7\pi}{4}, where sin⁡x\sin x and cos⁡x\cos x are opposites. Both pieces have period 2π2\pi, so hh has period 2π2\pi. The largest value in the table is 2≈1.41\sqrt{2} \approx 1.41 at x=π4x = \tfrac{\pi}{4}.

(In fact this sum is a sinusoid: sin⁡x+cos⁡x=2sin⁡(x+π4)\sin x + \cos x = \sqrt{2}\sin\left(x + \tfrac{\pi}{4}\right), so 2\sqrt{2} really is its maximum. Adding two waves with the same period always gives a sinusoid; adding waves with different periods, as in Example 3, usually doesn’t.)

8. (Challenge) Let f(x)=2x+2−xf(x) = 2^x + 2^{-x}.

  • (a) Show that ff is even.
  • (b) Make a table of values for x=−2,−1,0,1,2x = -2, -1, 0, 1, 2.
  • (c) Show that f(x)≥2f(x) \ge 2 for every xx. (Hint: expand (2x/2−2−x/2)2≥0\left(2^{x/2} - 2^{-x/2}\right)^2 \ge 0.)
Solution

(a) f(−x)=2−x+2x=f(x)f(-x) = 2^{-x} + 2^{x} = f(x), so ff is even. (It’s the sum of 2x2^x and its mirror image 2−x2^{-x}.)

(b)

xx−2-2−1-1001122
f(x)f(x)4.254.252.52.5222.52.54.254.25

(c) A square is never negative, and 2x/2⋅2−x/2=20=12^{x/2} \cdot 2^{-x/2} = 2^0 = 1, so

(2x/2−2−x/2)2≥02x−2(2x/2)(2−x/2)+2−x≥02x−2+2−x≥02x+2−x≥2\begin{aligned} \left(2^{x/2} - 2^{-x/2}\right)^2 &\ge 0 \\ 2^{x} - 2\left(2^{x/2}\right)\left(2^{-x/2}\right) + 2^{-x} &\ge 0 \\ 2^{x} - 2 + 2^{-x} &\ge 0 \\ 2^{x} + 2^{-x} &\ge 2 \end{aligned}

So the minimum value of ff is 22, reached at x=0x = 0, matching the table.

9. (Challenge) ff and gg are both increasing for all real xx.

  • (a) Explain why f+gf + g must be increasing.
  • (b) Give an example showing that f−gf - g does not have to be increasing.
Solution

(a) Take any a<ba \lt b. Because both functions increase, f(a)<f(b)f(a) \lt f(b) and g(a)<g(b)g(a) \lt g(b). Adding these inequalities gives f(a)+g(a)<f(b)+g(b)f(a) + g(a) \lt f(b) + g(b), which says (f+g)(a)<(f+g)(b)(f + g)(a) \lt (f + g)(b). So f+gf + g is increasing.

(b) Let f(x)=xf(x) = x and g(x)=2xg(x) = 2x. Both are increasing, but (f−g)(x)=x−2x=−x(f - g)(x) = x - 2x = -x is decreasing. (You can’t subtract inequalities the way you can add them.)