Doubt based on composition of functions

27 Views Asked by At

I have a question regarding composition of functions, which goes as follows:

Let two functions are defined as

$$g(x)=\begin{cases} x^2, &-1\leq x<2 \\ x+2, & 2\leq x\leq 3\\ \end{cases}$$

and $$f(x) = \begin{cases} x+1, & x \leq 1 \\ 2x+1, & 1<x\leq 2\\ \end{cases}$$ The question is to find $gof$

The answer is stated to be :-

$gof = \begin{cases} (x+1)^2, &-2\leq x \leq 1\\ \end{cases}$

Clearly, they only use the 1st definition for $g(x)$ and the first definition for $f(x)$

$1$st question: But, I noted something else, that is, if $x =1, \implies f(x) = 2$ using 1st definition $\implies g(x) = 4 $ using the 2nd definition of $g(x)$. Coincidentally, here for $x= 1$ the value of $g(f(x))$ is the same for both the cases, that is, $4$. But there may be cases where this isnt the case right? Can we just condense it into a single definition if the value are equal for some values of the function?

$2$nd question: I tried to approach this question as follows, first by writing , $$g(f(x)) = \begin{cases} (f(x))^2, &-1\leq x<2 \\ f(x)+2, & 2\leq x\leq 3\\ \end{cases}$$

And then I began checking for which values of $x$, $f(x)$ can be in these ranges, but that was quite a lengthy method as I first assumed a range of $x$, then took that corresponding result of $f(x)$ and plugged it into domain of $g(x)$ to check if the values of $x$ I get from here overlap and give me a real interval. But is this the correct method to do this?

If not, how do I approach these questions, I feel like I'm stuck, and methods/in dephth help would be nice.