Let $f, g : R → R$
$$f(x) = \begin{cases} x + 3 &\text{if } x ≥ 0,\\ x^2 &\text{if } x < 0 \end{cases}$$
$$g(x) = \begin{cases} 2x + 1 &\text{if } x ≥ 3,\\ x &\text{if } x < 3 \end{cases}$$
They asked us to calculate : g ◦ f and f ◦ g. I did this, but i don't know how to write the intervals. Like i got
$$g ◦ f = \begin{cases} 2x + 7 \\ x^2 \\ 2x^2+1 \end{cases}$$
and likewise
$$f ◦ g = \begin{cases} 2x+4\\ x+3\\ x^2 \end{cases}$$
but i don't know what conditions each of these results should be for x. like is x ≥ 0 or what? and how do i figure this out, is there a rule?
You want to intersect the intervals.
For $f$ you have $(-\infty ,0)$ and $[0,\infty)$
For $g$ you have $(-\infty,3)$ and $[3,\infty)$
So, for the compositions, you want to look at each of the intervals $(-\infty,0)$,$[0,3)$, and $[3,\infty)$.