The easiest way to solve any maths problem like this is to consider all the little cases, and then find the point that all these cases have in common.
So, for fog to exist, we require that

. The domain of f is easy - so, now we just need to find the range of g.
g is a parabola shifted up one unit - and so, the range of it is [a, infinity). This is a subset of [2, infinity) when

. So, for fog to exist, we can take

.
Now, for gof. This time, we need that

. f is a linear function, and is strictly decreasing. So, its range is going to be (-infinity, a-2]. Now, for this to be a subset of the domain of g, we once again consider the two intervals directly - in this case, the domain of g being (-infinity, 1]. So, we take a-2=1 ===> a=3, so we see that the range of f is a subset of g for

.
Finally, we take our two separate cases, and combine them to find the values of a that works for both. So, when is a both greater than 2 AND less than 3 (including those values)? Obviously, when

.