Need some help to check whether my understanding of a subject is right or not.
$1$. Example of injective function.
$\mathcal{f}$: $\mathbb{N}$ $\longrightarrow$ $\mathbb{N}$
$x$ $\longmapsto$ $2x$
A = {$1,2,3,4$}, B = {$2,4,5,7$}, (A $\cap$ B) = {$2,4$}
$\mathcal{f}$(A) = {$2,4,6,8$}, $\space$ $\mathcal{f}$(B) = {$4,8,10,14$}
$\mathcal{f}$(A $\cap$ B) = $\mathcal{f}$(A) $\cap$ $\mathcal{f}$(B) = {$4,8$} $\Longrightarrow$ $\mathcal{f}$ is injective
$2$. Example of a function that is not injective
$\mathcal{f}$: $\mathbb{R}$ $\longrightarrow$ $\mathbb{R}$
$x$ $\longmapsto$ $x^2$
A = {$2,4,6,8$}, B = {$-4,-8,-12,-16$}, (A $\cap$ B) = $\lbrace$ $\emptyset$ $\rbrace$
$\mathcal{f}$(A) = {$4,16,36,64$}, $\space$ $\mathcal{f}$(B) = {$16,64,144,256$}
$\mathcal{f}$(A) $\cap$ $\mathcal{f}$(B) = {$16,64$} $\neq$ $\mathcal{f}$(A $\cap$ B) = $\lbrace$ $\emptyset$ $\rbrace$ $\Longrightarrow$ $\mathcal{f}$ is not injective
Are there any mistakes in these writings?
Yes, there is a mistake, and a big one: you cannot fix two sets $A$ and $B$ and claim that$$f(A\cap B)=f(A)\cap f(B)\implies\ f\text{ injective.}$$That equality holds for those two specific set, but that fact, by itslef, is not enough to assure that $f$ is injective.
The rest looks correct.