Trouble Finding $f \circ g \; \text{ and } \; g\circ f$ for this function? 
$f(x) =
\begin{cases}
2x+3,  & \text{if  x $\lt$ 3} \\[2ex]
x^2, & \text{if $x \ge 3$ }
\end{cases}$  $,\qquad$ $g(x) =
\begin{cases}
7-2x,  & \text{if  x $\le$ 2 } \\[2ex]
x+1, & \text{if $x \gt 2$ }
\end{cases}$                     

Finding $f \circ g \; \text{ and } \; g\circ f$ for this function?
The first step to solve this is to show the definitions
$\left( f\circ g \right)(x) = f(g(x)) =\begin{cases}
2(7-2x)+3,  & \text{if  x $\lt$ 3} \\[2ex]
(x+1)^2, & \text{if $x \ge 3$ }
\end{cases}$
$\left( g\circ f \right)(x) = g(f(x)) =\begin{cases}
7-2(2x+3),  & \text{if  x $\le$ 2 } \\[2ex]
(x)^2+1, & \text{if $x \gt 2$ }
\end{cases}  $
However I do not think this is correct way of going through this. I think that when $x<3 \text{ and } x\ge 3 $   have something to do with this problem but I just do not know what it is. Any insight on how I went wrong would be very superb.     
 A: A neat way to do these types of questions would be through graphs.
It is given that $$f(x) =
\begin{cases}
2x+3,  & \text{if  $x \lt$ 3} \\[2ex]
x^2, & \text{if $x \ge 3$ }
\end{cases}$$
$$g(x) =
\begin{cases}
7-2x,  & \text{if  $x \le$ 2 } \\[2ex]
x+1, & \text{if $x \gt 2$ }
\end{cases}$$
To simplify the question lets first plot a graph of the given functions

Now lets begin with $\left( f\circ g \right)(x)$
So, we have 
$$\left( f\circ g \right)(x) = f(g(x)) =\begin{cases}
2g(x)+3,  & \text{if  $g(x) \lt$ 3} \\[2ex]
(g(x))^2, & \text{if $g(x) \ge 3$ }
\end{cases}$$
Now from the graph itself we see that $g(x) \ge 3$, so it saves us the work of checking the other case.So, we get 
$$\left( f\circ g \right)(x) = f(g(x))=(g(x))^2, \text{if $g(x) \ge 3$ }= \begin{cases}
(7-2x)^2,  & \text{if  $x\le$ 2} \\[2ex]
(x+1)^2, & \text{if $x \gt 2$ }
\end{cases}
$$
Lastly come to the case of $\left( g\circ f \right)(x)$, this one is a bit longer.
$$\left( g\circ f \right)(x) = g(f(x)) =\begin{cases}
7-2f(x),  & \text{if  $f(x) \le$ 2 } \\[2ex]
f(x)+1, & \text{if $f(x) \gt 2$ }
\end{cases}$$
From the graph we can see that $f(x) \le 2$ for $x \le -\dfrac{1}{2}$ and $f(x)\gt 2$ for $x \gt -\dfrac{1}{2}$. So we can redefine $\left( g\circ f \right)(x)$ as follows
$$\left( g\circ f \right)(x) = g(f(x)) =\begin{cases}
7-2f(x),  & \text{if  $x \le -\dfrac{1}{2}$} \\[2ex]
f(x)+1, & \text{if $x \gt -\dfrac{1}{2}$}
\end{cases}$$
Now we break the defining of $\left( g\circ f \right)(x)$ as per the definition of $f(x)$ to further berak down the intervals of $x$.
So, at last we get
$$\left( g\circ f \right)(x) = g(f(x)) =\begin{cases}
7-2(2x+3),  & \text{if  $x \le -\dfrac{1}{2}$} \\[2ex]
(2x+3)+1, & \text{if $-\dfrac{1}{2} \lt x \lt 3$} \\[3ex]
x^2+1, & \text{if $x \ge 3$}
\end{cases}=\begin{cases}
1-4x,  & \text{if  $x \le -\dfrac{1}{2}$} \\[2ex]
2x+4, & \text{if $-\dfrac{1}{2} \lt x \lt 3$} \\[3ex]
x^2+1, & \text{if $x \ge 3$}
\end{cases}$$
