# An example where $g \circ f$ is surjective but $f$ is not surjective, where $f,g:\mathbb{R}\to\mathbb{R}$.

$g \circ f$ is surjective but $f$ is not surjective. With $f,g$ from $\mathbb{R} \to \mathbb{R}$

There is a similar question If $g \circ f$ is surjective, show that $f$ does not have to be surjective? but it does not my answer my question since it does not require having $f,g$ from $\mathbb{R} \to \mathbb{R}$

I tried many functions but can't find any functions to satisfy the conditions. I am not sure which two functions can be used in this which also have the domain $\mathbb{R}$, for example $log x$ would work in for subjectivity but it does not match the domain.

• The example in the question you linked is wrong. It has $g(f(x))=|x|$ but the idea is in the right direction. – Ross Millikan Nov 14 '17 at 5:50

Define $g(x)=\tan x$ for $x\ne k\pi+\pi/2$, and $g(k\pi+\pi/2)=0$, $k=1,2,...$, and $f(x)=\tan^{-1}(x)$, so $f$ maps $\bf{R}$ onto $(-\pi/2,\pi/2)$, $f$ is not surjective but $g\circ f$ is.

• Another example: $f(x)= \exp \{x\}$, $g(x)=\log \{x\}$ for $x>0$, arbitrary for other x. This is simpler but g is not continuous. – Kabo Murphy Nov 14 '17 at 5:50

Let $f$ be a bijection that takes all of $\Bbb R$ to the positive reals, then let $g$ be its inverse. Then $g \circ f$ is the identity, so is surjective.

Alternately, let $$f(x)=\begin {cases} x &x\not \in \Bbb N\\x+1 & x \in \Bbb N \end {cases}$$ If you think $0 \in \Bbb N$ this covers all of $\Bbb R$ except $0$ so is not surjective onto $\Bbb R$. Again. let $g$ be the inverse. $$g(x)=\begin {cases} x& x+1 \not \in \Bbb N\\x-1 & x+1 \in \Bbb N \end {cases}$$ Again $g \circ f$ is the identity and is surjective on $\Bbb R$. It is a bit of a cheat. $f$ is surjective onto $\Bbb R\setminus \{0\}$. It depends on what set you take for the range of $f$ whether it is surjective. Another (silly) example is $f(x)=x, g(x)=x$ but $f$ is from $\Bbb R$ to $\Bbb R \cup \{cat\}$ so it is not surjective.

A discrete example:

$f: \mathbb{Z} \rightarrow \mathbb{Z}.$

$f(k) = 0$ for $k=0,-1,-2,-3, ...$(neg. integers).

$f(k) = k$ for $k=1,2,3,..$ (pos. integers).

$g: \mathbb{Z} \rightarrow \mathbb{Z}.$

$g(l) = l,$ for $l=-1,-2,-3,.......$(neg. integers.)

$g(m)$ for $m =0,1,2,3.....$is specified below.

$g\circ f(k) = 0$ for $k=0;$

$g\circ f(k):$

$1\mapsto 1$, $2 \mapsto -1$, $3 \mapsto 2,$ $4 \mapsto -2, .....$, etc.