Associated Topics || Dr. Math Home || Search Dr. Math

### Composition of Functions

```
Date: 07/23/99 at 03:00:47
From: Melanie Pichelmann
Subject: Algebraic operations

How do I solve: f(x) = x+2 and g(x) = 3x-1, then f(g(x)) = ?

I tried to solve it like this: x+2(3x-1) but I got the wrong answer
and I need to know the method.
```

```
Date: 07/23/99 at 08:57:09
From: Doctor Peterson
Subject: Re: Algebraic operations

Hi, Melanie.

When we write a function like f(x) = x+2, that means that whatever
value you are given for x is to be substituted for x in the
expression. Rather than solve your own problem, I'll work out g(f(x))
instead. It means we have to substitute f(x) for x:

g(f(x)) = 3 * f(x) - 1 = 3(x+2) - 1

You could also think of it this way:

g(f(x)) = g(x+2) = 3(x+2) - 1

Either way, we can then simplify it to

g(f(x)) = 3x + 5

such as 2, what will we get?

g(f(2)) = 3*2 + 5 = 11

If we just plug x = 2 into the functions one at a time, we should get

f(2) = 2 + 2 = 4
g(4) = 3*4 - 1 = 11

Composition of functions can be thought of as plumbing: the x first
goes into the f machine, and what comes out goes into the g machine:

+---+             +---+
2 --->| f |----> 4 ---->| g |---> 11
+---+             +---+

+---+             +---+
x --->| f |---> x+2 --->| g |---> 3x+5
+---+             +---+

I hope that clarifies what's going on. Now you can connect f to the
output of g and find the answer for f(g(x)).

- Doctor Peterson, The Math Forum
http://mathforum.org/dr.math/
```
Associated Topics:
High School Functions

Search the Dr. Math Library:

 Find items containing (put spaces between keywords):   Click only once for faster results: [ Choose "whole words" when searching for a word like age.] all keywords, in any order at least one, that exact phrase parts of words whole words

Submit your own question to Dr. Math
Math Forum Home || Math Library || Quick Reference || Math Forum Search