I am aware this post is similar to my previous one,but I am still a bit confused about the problem and would appreciate some help!
Can somebody help me correct my attempts at proving the following result? Much appreciated.
Theorem. Suppose $X$ is a nonempty finite set. Let $n$ be the least natural number such that there is a one-to-one function $f: X \rightarrow $ {$1,2,3,...,n$}. With the number of elements in $X$ being |$X$|$=n$, prove that $f$ must be onto.
My Attempt:
Suppose for contradiction that $f$ is not onto,then there exist some elements in the codomain {$1,2,3,...,n$} such that no elements of the domain map to them. Let $1 \le i \le n$ be the largest element of the codomain such that $i \notin ran(f)$.
[case $i=n$]. If $i=n$, then by definition $n \notin ran(f)$.Since n is the least natural number that ensures $f$ to be one-to-one, it must be the case that $n \in ran(f)$ providing the contradiction sought.
[case $i<n$]. the book gives the hint :
if $i<n$,let $a \in X$ be such that $f(a)=n$.Define a one-to-one function $g : X\rightarrow$ {$1,2,...,n-1$}.
With $i<n$ then by definition $i \notin ran(f)$ but,there is an element $a \in X$ such that $f(a)=n$ or more succintly that $n \in ran(f)$.
Is this reasoning correct : Since $i \notin ran(f)$,then there is no element in the domain $X$ that maps to it.Therefore one can remove this element from the codomain of $f$ without changing the one-to-one nature of the function. Now let $g:X \rightarrow ${$1,2,3,...,n-1$} defined by $g(a)=n-1=i$ and $g(x)=f(x)$ for all other $x \in X$. Since n-1 is the least natural number for which a one-to-one function can be constructed from $X$,this contradicts the initial assumption that $n$ is the appropriate least natural number.As a consequence we reject the assumption of $f$ being not onto in the case where $1 \lt n$ as well.
this feels wrong somewhere...
Thank you