If $ g \circ f (x) $ is injective, does that mean that $f(x)$ and $g(x)$ are also injective? I saw the following proof here.

Proof:
Let $f(a) = f(b)$.
Then $g(f(a)) = g(f(b)) \implies g\circ f(a) = g \circ f(b)$
But we know that $g \circ f$ is injective. 
Hence, $a = b$
We have shown that if $f(a) = f(b)$ then $ a = b \implies $ $f(x)$ is injective. 

In this when we show that $g(f(a)) = g(f(b))$, doesn't it mean that $g(x$) is also injective. If not, why?
 A: Take a look at $f(x)= e^x$ and $g(x)= |x|$ (both from $\mathbb{R}\to \mathbb{R}$). Since $e^x>0$ for all $x$ we have $$g(f(x))=|e^x| =e^x$$
so $g\circ f$ is injective, but $g$ is not.
A: 
In this when we show that $g(f(a)) = g(f(b))$, doesn't it mean that
  $g(x)$ is also injective.

To answer this, let's look at what it means for a function $g: A \rightarrow B$ to be injective. Injectivity says that for all elements $a$ and $b$ in set $A$, if $g(x)=g(y)$ then $x = y$. Or, equivalently that if $x \neq y$ then $g(x) \neq g(y)$. The key is the $\neq$ sign—different values in the domain get mapped to different values in the image.
Here, we're just showing that if $f(a) = f(b)$ then $g(f(a)) = g(f(b))$, which is always true no matter whether or not $g$ is injective. If two elements are equal, like $x = 2$, then no matter whether $g$ is injective, surjective, etc., it's always the case that $g(x) = g(2)$. That's just what it means to when we apply an operation to both sides, like how if $x+5 = 7$ then $x + 5 - 5 = 7 - 5$, which is equivalent to $f(x) = x-5$ and hence $x+5 = 7 \Rightarrow f(x+5) = f(7)$.
