# How to compose two functions?

I have three functions:

$$f(x) = x+1 ,\; g(x) = x - 1 ,\; h(x) = 2x$$

I want to find $g\circ f$ such that $g(f(x))$, which equals $(x+1)-1=x$ but how?

I don't understand the steps.

Also, I want to find $h\circ f$ which equals $h(f(x)) = 2x-1$ but I dont know how to get that answer either.

Thanks

• Welcome to Math SE! When you have a minute, please take the tour of the site and look at how to format mathematics here on Math SE. Also, I suggest that you bookmark this very useful MathJax page for quick reference. Cheers!
– user409521
Mar 19, 2017 at 3:28
• It's worth mentioning that this is function composition, not multiplication. Mar 19, 2017 at 3:48
• It should also be mentioned that $h(f(x))=2x+2$. It is $g(h(x))$ which is equal to $2x-1$ Mar 19, 2017 at 4:28

The function $f$ will take an input and return an output equal to one more than the input.

$f(\underbrace{\color{red}{x}}) = \underbrace{\color{red}{x}}+1$

Similarly $f(\underbrace{\color{red}{55}})=\underbrace{\color{red}{55}}+1$ and $f(\underbrace{\color{red}{8x^2-3}})=\underbrace{\color{red}{8x^2-3}}+1$

The function $g$ will take an input and return an output equal to one less than the input.

$g(\underbrace{\color{blue}{x}})=\underbrace{\color{blue}{x}}-1$

So, we have $(g\circ f)(x)=g(\underbrace{\color{blue}{f(x)}}) = g(\underbrace{\color{blue}{x+1}})=(\underbrace{\color{blue}{x+1}})-1 = x+1-1=x$

Similar manipulation can be done for $h$

• I'm colour blind Mar 19, 2017 at 3:20
• @mrnovice added underbraces as well to add the emphasis that the color was intended to provide. The end result is to recognize that functions are machines that transform an input into an output in a designated way in terms of the input, regardless what the input looks like be it simply $x$ or something more complicated (e.g. another function). Mar 19, 2017 at 3:24
• Was actually joking(if it was true how would I know there was colour lol), but perhaps some innocent colour blind soul will be helped by the change some years from now, +1 Mar 19, 2017 at 3:24
• Red-blue colour blindness is very rare, by the way. (A red-blue colour-blind person could usually still see that the colour was different to black; just couldn't necessarily distinguish between the two. Perhaps someone completely achromatic might not be able to distinguish them, but that condition is even rarer.) Red/green is the most common. Mar 19, 2017 at 9:47
• While color-blindness that could not make this distinction is rare, uncooperative browsers are more common. The I.E. version I have at work (11, I think - IT keeps us well behind the times) does not display colored mathjax, despite showing other colored text. So the added underbraces are welcome. Mar 19, 2017 at 17:51

$g(f(x))$ means you substitute $f(x)$ in wherever you see $x$ in $g(x)$, therefore we get $g(f(x)) = (x+1)-x = x$

Performing the same for $h(f(x))$, we get $h(f(x)) = 2(x+1) = 2x + 2$

• Yes, and f(h(x)) = 2x +1 so that means h o f is not equal to f o h. Cheers, I know now. Mar 19, 2017 at 4:27