Proof that a function is (not) bijective if f:A->A is an injective function. I need help for a task I am trying to solve. Let $A$ be a not empty set and $f:A\rightarrow A$ is an injective function, but not a surjective function.

Let $g: A\rightarrow A$ be a function with $g(f(x))=x\forall x\in A$. Show that $g$ is not bijective.

I believe that I already solved that one. Since $f$ is injective but not surjective, there is at least one element $y_1$ in the set of destination $A$, that is not the image of at least one element of its domain. Since the domain and the set of destination is $A$, there is also at least one element $x_1$ in the domain, that $f$ does not map to $y$. Therefore $g: A\rightarrow A$ is not surjective, since the element $x_1$ of the set of destination $A$ is not an image of the domain $A$, $g(f(x_1))$ does not exist. Since $g$ is not surjective $\Rightarrow g$  is not bijective.

Show that there is an unambiguous bijective function $h: f[A]\rightarrow A$ with $h(f(x))=x\forall  x\in A$.

Well I don't have any idea how to solve this task. The domain is not $A$ but $f[A]$ now, but I don't see how this change should prevent the function from being not surjective like in the first point, since the set of destination $A$ has more elements then $f[A]$ which would cause the problem of an element left alone. Also I am not quite sure how to prove that this is the "unambiguous" function.
 A: *

*The first proof is wrong: When you say "[...] there is also at least one element $x$ in the domain that $f$ does not map to $y$", that's a repetition of the fact  that $f$ is not surjective. Also, to go from there to "$g$ is not surjective" is also incorrect. First of all, because $g$ is indeed surjective ($g(f(x))=x$ for all $x\in A$ implies that every $x$ is in the image of $g$), second $g(f(x))$ does exists, independetly from hypothesis on $g,f$ or anything. What $g$ fails to be is injective: Assume $g$ is injective, then from $g(f(x))=x$ we deduce $g(f(g(x)))=g(x)$ for all $x$, so using injectivity $f(g(x))=x$ and $f$ would be invertible, contrary to not being surjective.


*About this, notice that if you restrict the codomain of $f$ to $f[A]$, then $f$ remains injective, but it also becames surjective, hence a bijection. Next, you need to prove that the inverse of a map is unique: Think about the condition $f(f^{-1}(x))=x$, if $f$ is injective, how many values can $f^{-1}(x)$ take so that the previous equation holds?
A: Hint: $f:A\to[A]$ is bijective, so it has an inverse function. Use $h=f^{-1}$.
