If f is surjective and g is injective, what is $f\circ g$ and $g\circ f$? Say I have $f=x^2$ (surjective) and $g=e^x$ (injective), what would $f\circ g$ and $g\circ f$ be? (injective or surjective?)
Both $f$ and $g : \mathbb{R} \to \mathbb{R}$.
I've graphed these out using Maple but I don't know how to write the proof, please help me!
 A: Examples to keep in mind for questions like this:


*

*Take $X = \{1\}$, $Y = \{a,b\}$, $Z =\{\bullet\}$. Let $f\colon X\to Y$ be given by $f(1)=a$, and $g\colon Y\to Z$ given by $g(a)=g(b)=\bullet$.
Then $g\circ f\colon X\to Z$ is bijective; note that $f$ is injective but not surjective, and that $g$ is surjective but not injective. So, injectivity of the composite function cannot tell you anything about injectivity of the last function applied; and surjectivity of the composite function cannot tell you anything about surjectivity of the first function applied.

*As above, but now take $Y = \{a,b\}$, $Z=\{\bullet\}$, and $W=\{1,2\}$. Let $g\colon Y\to Z$ be given by $g(a)=g(b) = \bullet$, and $h\colon Z\to W$ be given by $h(\bullet) = 1$. Then $h\circ g\colon Y\to W$ maps both $a$ and $b$ to $1$. Note that $g$ is surjective, $h$ is injective, but $h\circ g$ is neither. So: surjective followed by injective could be neither.
Playing around with similar examples will show you that injective followed by surjective may also be neither. For instance, modify the first example above a bit, say $Y = \{a,b,c\}$, $Z = \{\bullet,\dagger\}$, $f\colon X\to Y$ given by $f(1)=a$, $f(2)=b$ (injective), and $g\colon Y\to Z$ given by $g(a)=g(b)=\bullet$, $g(c)=\dagger$ (surjective). Is $g\circ f$ injective? Is it surjective?
A: When you write $x$ in $f(x)=x^2$, it is a "dummy variable" in that you can put in anything in the proper range (here presumably the real numbers).  So $f(g(x))=(g(x))^2$.  Then you can expand the right side by inserting what you know about $g(x)$.  Getting $g(f(x))$ is similar.  Then for the injective/surjective part you could look at this question
A: You should specify the domains and codomains of your functions.
I guess that 
$f:\mathbb{R}\rightarrow\mathbb{R}_{\geq 0}$ and $g:\mathbb{R}\rightarrow\mathbb{R}$, but there are some other natural definitions you could make.
You can write down the compositions explicitly:
$f\circ g:\mathbb{R}\rightarrow\mathbb{R}_{\geq 0}$ has $x\mapsto (e^x)^2=e^{2x}$.
This is injective (since $x\mapsto e^x$ is injective) and not surjective, since 0 is not in the image.
$g\circ f:\mathbb{R}\rightarrow\mathbb{R}$ $x\mapsto e^{x^2}$ is neither injective, nor surjective.
