How to compose two functions?

Solution 1:

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$

Solution 2:

$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$