Find f ◦ g and g ◦ f Define $f : \mathbb{R} \to \mathbb{R}$ and $g : \mathbb{R} \to \mathbb{R}$ by $f(x) = x^2 + 1$ and $g(x) = x + 2$. Find $f \circ g$
and $g\circ f$.
I understand that $f \circ g$ is $f(g(x))$ and $g \circ f$ is $g(f(x))$ but am not sure where $f : \mathbb{R} \to\mathbb{R}$ and $g : \mathbb{R} \to \mathbb{R}$ is involved or if they are just defining that $f(x)$ and $g(x)$ are in the real number system
(Discrete Mathematics)
 A: This notation $f: \mathbb{R}\rightarrow \mathbb{R}$ simply defines the domain and the codomain. 
The domain is easy enough since it is the set of all valid inputs to the function. Now, the codomain can be a bit trickier but imagine the codomain is the "target" of your domain (it is different from the range). Thus when you put an $x$ into your function such that $x\in\mathbb{R}$ ($x$ is in the set of all real numbers) you are aiming for an output value in $\mathbb{R}$ (the set of all real numbers). However, because the function manipulates your input along the way, it's not always the case that you can hit every target within the codomain (hence the need to define a range which is a subset of the codomain).  
So this notation directly translated simply means "$f$ is a funtion from the domain $\mathbb{R}$ to the codomain $\mathbb{R}$" or simply "$f$ is a funtion from $\mathbb{R}$ to $\mathbb{R}$".
Don't worry too much about this notation for this particular problem. Your inference that $f(x)$ and $g(x)$ exist in the real numbers system is entirely correct. As you move on in Discrete Mathematics knowing this particular notation will be invaluable and you will start to see how this notation helps one to define and understand relations between sets at a much deeper level.
A: They are just defining the functions $f$ and $g$ as maps from the Reals to the Reals.  That's all.  Take a real number transform it using the rule $f$ and the result is still a real number.  
In discrete math, you start to realized that particular functions can have particular mappings.  You learn of the domain and range and here, you are defining the function in such a way that you can see what the domain and range are.  Depending on the map, it could simply be the codomain instead of the range.  In this case the range would be a subset of the codomain.  So for example, if you had a function 
$$f:\mathbb{R}\rightarrow\mathbb{R}; f(x)=x^2$$
you are mapping real numbers to real numbers.  But notice that the image of $f$, does not map to all the reals.  Thus the codomain would be $\mathbb{R}$ but the range would be the interval $[0,\infty)$.  Thus you wuold have to be careful on which sets your functions are mapping to and from.  That makes a big difference.
