Injection, making bijection I have injection $f \colon A \rightarrow B$ and I want to get bijection. Can I just resting codomain to $f(A)$?
I know that every function is surjective when it's codomain is restricted to it's image but I am not sure can I do what I did.
 A: Yes, you can do what you describe to get a bijection.
More generally, to break up functions to get injectivity/surjectivity/bijectivity, we have what I would describe as the "first isomorphism theorem for sets":

For any function of sets $f:A\to B$, define an equivalence relation on $A$ by
  $$a_1\sim a_2\;\text{ when }\;f(a_1)=f(a_2)$$
  Then $f$ factors through a surjection, a bijection, and an injection as follows:
  $$\large A\; \xrightarrow[\text{surjective}]{\;\large a\;\mapsto\;[a]\;}\;A/{\sim}\; \xrightarrow[\text{bijective}]{\;\large [a]\;\mapsto\;f(a)\;} \;f(A)\;\xrightarrow[\text{injective}]{\;\large f(a)\;\mapsto\;f(a)\;}\;B$$

In your case, where $f:A\longrightarrow B$ is already injective, the map $A\longrightarrow A/{\sim}$ described above is a bijection, so that the composite map $A\longrightarrow A/{\sim}\longrightarrow f(A)$ is a bijection.
A: If you identify a function $f$ with the triple $(A,G,B)$ where $G:=\{\langle a,f(a)\rangle\mid a\in A\}$ (the graph of $f$) then $(A,G,B)$ and $(A,G,f(A))$ are distinct functions if $f$ is not surjective.  
Function $(A,G,f(A))$ is a bijection if and only if function $(A,G,B)$ is an injection.
In e.g. the theory of categories functions are looked at as triples described. In e.g. the theory of sets functions are identified with their graphs.
