Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Say I have $f=x^2$ (surjective) and $g=e^x$ (injective), what would $f\circ g$ and $g\circ f$ be? (injective or subjective?)

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!

share|cite|improve this question
Is $f$ surjective? What is the codomain? – lhf Mar 21 '11 at 14:18
What did you want to prove? – AD. Mar 21 '11 at 15:25
Yes, f is surjective (horizontal line test). I want to know what kind of function f∘g and g∘f would be. – meiryo Mar 21 '11 at 22:19
Are you sure you want $f:\mathbb{R} \to \mathbb{R}$ and not $f: \mathbb{R} \to [0,\infty)$? It is surjective onto the latter but not onto the former. – t.b. Mar 21 '11 at 23:01
Yes, the horizontal line test works for $[0,\infty)$ but how about the horizontal lines below the $x$-axis? By the way: I'm not seeing that you're answering me in a comment unless you add @Theo somewhere. – t.b. Mar 21 '11 at 23:40
up vote 8 down vote accepted

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?

share|cite|improve this answer
Great help, thanks. What does the dot mean? – meiryo Mar 21 '11 at 22:17
@meiryo: Nothing. It's just an element of a set. – Arturo Magidin Mar 22 '11 at 1:39

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

share|cite|improve this answer

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.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.