2
$\begingroup$

I'm trying to solve this problem from my homework a few hours now, I know how to do composition for regular functions, but can't seem to understand the composition of piecewise functions.

I have checked other solutions here, but didn't get it.

Here is the problem: $$ f(x) = \begin{cases} x+1, & \text{if $x<0$} \\ 3x+4, & \text{if $x\ge0$} \end{cases} $$ $$ g(x) = \begin{cases} 3x+2, & \text{if $x<3$} \\ 5x-8, & \text{if $x\ge3$} \end{cases} $$ find $f(g(x))$ and $g(f(x))$? thanks :)

$\endgroup$
2
  • $\begingroup$ A general method for your reference. $\endgroup$
    – user371838
    Dec 29 '17 at 8:33
  • $\begingroup$ @Rohan thank you, i've tried to figure out this general method but didn't quite make it. $\endgroup$ Dec 29 '17 at 10:24
3
$\begingroup$

Here is step-by-step hints to do it:

  1. For the composition of $f(g(x))$, focus on $g(x)$ first, it has a range of $\mathbb R$ and since $f(x)$ has a domain of $\mathbb R$ too, everything is well.
  2. You see that $f(x)$ is a piecewise function with two parts for $x<0$ and $x\ge0$, so you need to solve these inequalities by substituting x with $g(x)$. Now you realize that the composite function has four pieces, with domains determined by solving: $$ \begin{cases} 3x+2<0\\ x<3 \end{cases} $$ $$ \begin{cases} 3x+2\ge0\\ x<3 \end{cases} $$ $$ \begin{cases} 5x-8<0\\ x\ge3 \end{cases} $$ $$ \begin{cases} 5x-8\ge0\\ x\ge3 \end{cases} $$
  3. Finally, put each piece of $g(x)$ into $f(x)$, simplify the expression, and write down the domains that you just found in step 2 for each piece. $$ f(g(x))= \begin{cases} (3x+2)+1, \ ...\\ 3(3x+2)+4, \ ...\\ (5x-8)+1, \ ...\\ 3(5x-8)+4, \ ...\\ \end{cases} $$

Then you have it! In the same way you can find $g(f(x))$ without much effort.

$\endgroup$
7
  • $\begingroup$ thank you for your quick and detailed answer, just one thing that I didn't understand is why in step 2 we check x<3 for 4 times? $\endgroup$ Dec 29 '17 at 10:19
  • $\begingroup$ Oh sorry, typo... How careless I am! Will edit that... $\endgroup$
    – Macrophage
    Dec 29 '17 at 10:24
  • $\begingroup$ thank you very much, I think i solved it. $\endgroup$ Dec 29 '17 at 10:27
  • $\begingroup$ No problem. It would be great if you manually accept my answer on this page. So short on reputation now :P $\endgroup$
    – Macrophage
    Dec 29 '17 at 10:30
  • $\begingroup$ Upvote from me! (also upvoted some other things) It is hard to start with not much reputation. $\endgroup$
    – user370967
    Dec 29 '17 at 10:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.