I said:
$X,Y,Z \subseteq\mathbb{R}$ $$ g:X→Y, f:Y→Z\\ g(x)=\sqrt x,\quad f(x)=x^2 $$ so $f(g(x))=x$
Therefore $f(g(x))$ is one-to-one but $f(x)$ is not.
Is this the correct approach?
I said:
$X,Y,Z \subseteq\mathbb{R}$ $$ g:X→Y, f:Y→Z\\ g(x)=\sqrt x,\quad f(x)=x^2 $$ so $f(g(x))=x$
Therefore $f(g(x))$ is one-to-one but $f(x)$ is not.
Is this the correct approach?
On
For a more trivial example, let $g: \{1\} \to \{1,2\}$, $f: \{1,2\} \to \{1\}$. Then $fg$ can't help but be the identity function on $\{1\}$, but $g$ can't be surjective, and $f$ can't be injective. (As others have pointed out, your example doesn't work.)
On
I think my answer is mostly a comment as opposed to a full answer but I cannot comment yet, so here we go: Yes, the idea is similar, but the example you gave does not work since you have not specified the domain properly; like Arthur mentioned in the comments, you have to be very careful with your domain. If you take $X$ and $Y$ to be natural numbers though, you can have your first map $x$ to $2x$, and then second map to map $x$ to floor of $x/2$; and even though both maps map natural numbers to natural numbers, the second map is definitely not one-to-one.
On
No, if $X,Y,Z\in \mathbb R$ they are just real numbers. You must make sure that you don't confuse the relations $\in$, $\subset$ and $=$ with each other - they are definitely not the same and it's not clear which one of them you intended or if it's something entirely different you meant.
For $f$ not to be injective there would exist $u\ne v$ in the domain of $f$ such that $f(u)=f(v)$. If $u$ and $v$ are in the range of $g$ there would be $x$ and $y$ in the domain of $g$ such that $g(x) = u\ne v = g(y)$ which means that $x\ne y$ since function maps to single value. Given this we have that $f(g(x)) = f(g(y))$ for some $x\ne y$.
The only way around this is for either $u$ or $v$ to be outside the range of $g$ and that the restriction of $f$ to the range of $g$ to be injective.
To achieve this we can for example consider the function $f(x) = |x|$ and make sure the range of $g$ is just positive numbers. For example let $g(x) = 1+\tanh x$.
Your answer doesn't define what $X,Y,Z$ are. If $Y=[0,\infty)$, then $f$ is actually one-to-one, so currently, your answer is not OK.
It's close, however, and your idea is the right one.
However, I find that it's usually easier to find counterexamples like these on finite sets. So, you could set
$$X=\{x\}\\ Y=\{y_1,y_2\}\\ Z=\{z\}\\$$
and then define $$g(x)=y_1\\ f(y_1)=f(y_2)=z$$
and get an injective $f\circ g$ despite the fact that $f$ is not surjective.