Suppose that f is a function from A to B, where A and B are finite sets with |A| = |B|. Show that f is one-to-one if and only if it is onto.
First,i will prove that if function f is one-to-one then f is onto.
Premise
$1.f:A⇒B$
$2.|A|=|B|$
$3.x,y∈B,∀x∀y(f(x)=f(y)⇒(x=y))$
Proof by contradiction,
4.$c∈A,d∈B,∃d∀c(f(c)≠d)$
2,3,4 imples that there are at least a element belong to A that do not connect to B. Which contradict with 1.
So we proved if function f is one-to-one then f is onto.
After that,i will prove if f is onto then f is one to one.
Premise
$1.f:A⇒B$
$2.|A|=|B|$
$3.x∈A, y∈B, ∀y∃x(f(x)=y)$
Prove by contradiction,
4.$c,d∈B, ∃c∃d(f(c) =f(d) ∧ c≠d) $
2,3,4 also imple that there are at least a element belong to A that do not connect to B. Which contradict with 1.
Can we prove like that?
Your proof is sketchy. Saying $2,3,4$ provide a contradiction leaves the proof to the reader.
You don't need a proof by contradiction. We can show that $f$ is injective if and only if it is surjective by considering two cases:
$f$ is injective
$f$ is not injective
If $f$ is injective then $f$ maps each element of $A$ to a different point of $B$ so $f(A)$ consists of $|A|$ distinct points of $B$. Since $|B|=|A|$ there are only $|A|$ distinct points of $B$ so $f$ is surjective.
If $f$ is not injective then there exist points $a_1,a_2\in A$ such that $f(a_1)=f(a_2)$. Therefore $|f(A)|\lt |A|=|B|$ so $f$ is not surjective.