(Revisted) Invertibility is necessary and sufficient for bijectivity... Let $f:X\rightarrow Y$ be non-surjective (not onto), and let $g:Y\rightarrow Z$ be non-injective (not $1-1$). Now, construct the composition $g\circ f$ such that it's a bijection.

My approach was this: Let $f$ be $x^2$, and let $g$ be $x^2$, thus $g\circ f$ is $x^4$, which has an inverse, namely $\sqrt[4]{x}$, and since invertability is necessary and sufficient for bijectivity, then the desired construction is complete.

Here is my second approach: Let $f$ be defined as $f(x)=\sqrt{x}$, where $f:\mathbb{R_{\geq 0}}\rightarrow \mathbb{R}$, and let $g$ be defined as $g(x)=x^2$, where $g:\mathbb{R}\rightarrow \mathbb{R_{\geq 0}}$, so $(g\circ f)(x)=x$, which clearly is invertible and therefore bijective, and thus the desired construction has been completed; quod erat demonstrandum. Right?
 A: Your second approach looks good!
Here is a very simple example. Let $X = Z = \{1\}$ and $Y = \{1,2\}$. Let $f(1) = 1$ and $g(1) = g(2) = 1$. When trying to think of injectivity/surjectivity examples, I've always found it's easier to work with small finite sets.
Here is an example illustrating why, when discussing injectivity and surjectivity, you have to think carefully about domain and range.


*

*$f:\mathbb{R} \rightarrow \mathbb{R}$ defined by $f(x) = x^2$. It's
not surjective (it misses $-1$), and it's not injective, since $f(1)
   = f(-1)$.

*$g:\mathbb{R} \rightarrow \mathbb{R}_{\geq 0}$ defined by $g(x) =
   x^2$. It's not injective, since $g(-1) = g(1)$. (Note that these
values are actually in the range of $g$, so this is well defined.) But
$g$ is surjective! Its range is all positive reals, and every
positive real has a square root.

*$h:\mathbb{R}_{\geq 0} \rightarrow \mathbb{R}$ defined by $h(x) =
   x^2$. It's now injective, since every positive real has a unique
positive root, but not surjective, since we have included $-1$ to the
range.

*$j:\mathbb{R}_{\geq 0} \rightarrow \mathbb{R}_{\geq 0}$ defined by
$j(x) = x^2$. This function is now both injective and surjective.
Now observe that every possibility of failure/success of injectivity/surjectivity is exhibited in this list of four functions, but all four were defined using the same formula. All that distinguishing these functions is the domain and range.
A: Assuming you have $\operatorname{f},\operatorname{g}: \mathbb{R} \to \mathbb{R}$, your example does not work. 
You have $\operatorname{f}(x) = x^2$ and $\operatorname{g}(x) = x^2$. It follows that the composite function $\operatorname{g}\circ\operatorname{f}$ is given by $(\operatorname{g}\circ\operatorname{f})(x) = (x^2)^2 \equiv x^4$. This function is not bijective since $x^4 \ge 0$ for all $x$. A function must take all values, i.e. be surjective, in order to be bijective.
Note that $x \mapsto x^4$ is not injective. We have $(-1)^4 = 1$ and $(+1)^4 = 1$. Two values, $x = \pm1$ are sent to the same value. Furthermore, notice that invertibility is not equivalent to bijectivity. The function $\operatorname{h} : \mathbb{R} \to \mathbb{R}$ given by $\operatorname{h}(x) = \operatorname{e}^x$ is invertible, $\operatorname{h}^{-1}(x) = \ln x$, but it is not bijective. What value of $x$ gives $\operatorname{e}^x = -1$? It is not surjective and so not bijective. However, $\operatorname{h} : \mathbb{R} \to \mathbb{R}^+$ is bijective.  Ivertibilty makes a function bijective onto its image.
A: Try this: $X=Z=\mathbb N_0$, $Y=\mathbb Z$, $f(x)=x$, $g(x)=|x|$.
A: Consider $f\colon \mathbb{R}\to\mathbb{R}$ defined by $f(x)=\arctan x$. Now define
$$
g(x)=
\begin{cases}
\tan x & \text{if $x\notin X$}\\
0 & \text{if $x\in X$}
\end{cases}
$$
where $X$ is the set of numbers of the form $(2k+1)\pi/2$ for all integers $k$.
Of course $f$ is not surjective and $g$ is not injective, but $g\circ f$ is the identity, which of course is bijective.

Your argument is flawed: you're using $g=f$; $f$, as a map from $\mathbb{R}$ to $\mathbb{R}$ is not injective.

If $X$, $Y$ and $Z$ are arbitrary, you can take $X=\{0\}$, $Y=\{1,2\}$ and $Z=\{3\}$; define $f(0)=1$, $g(1)=3=g(2)$. The composition $g\circ f$ is the unique map from $X$ to $Z$ which, of course, is bijective.
