function compositions Let a be a positive number, let $$f : [2,\infty)\rightarrow R,\quad f (x) = a − x$$ and let $$g: (−\infty, 1] \rightarrow R,\quad g(x) = x^2 + a$$ Find all values of a for which both $f\circ g$ and $g\circ f$ exist.
 A: Let's first look at $g\circ f$. Then we need to find when the range of $f$ falls in the domain of $g$. Ergo: If $a\leq3, \quad a-x\leq1$
Secondly, let's take a look at $f\circ g$. Then we'll find that if we let $x^2=0, \quad 2\leq a$.
Combining the two we find that both are defined if $$2\leq a\leq3$$
Try to understand how this works, and work it out yourself, without looking back on this answer.
A: This is probably your first time here, so I'd start of by mentioning that you should be showing your attempt at solving your problem, since this isn't a "Homework-Solving" site. 
Now, by definition, it goes as is :
For $f\circ g = f(g(x))$ : 
$ A_1 = \{ x \in D_g  $  | $ g(x) \in D_f \}$ = $\{ x \in (−\infty, 1] $ | $ g(x) \in[2,\infty) \} \Rightarrow \{ x \in (−\infty, 1]$ | $ x^2 + a \geq 2 $ } $\Rightarrow x^2  \geq 2-a \space ,\space  x \leq1 \Rightarrow a \geq 2 $
Understand how that works and solve it yourself for $g\circ f = g(f(x))$ and then combine the solutions to find the final domain of $a$.
