I was relatively confused trying to produce a proof of this theorem, however, I have provided my attempt. I would greatly appreciate it if people can help steer me to the correct proof, or provide a simple fix to my proof if it is near correct.
Proposition: If $X$ is a finite set of cardinality $n$, and $f: X \rightarrow Y$ is a function, then $f(X)$ is a finite set of cardinality less than or equal to $n$. If in addition $f$ is one-to-one then $f(X)$ has cardinality exactly $n$.
My Attempt at a Proof: Suppose $X$ is a finite set with cardinality $n$ and $f: X\rightarrow Y$ is a function. It follows that $X$ has $n$ elements, namely $x_1, x_2, ..., x_n$. Since $f$ is a function it follows that $f(X)$ maps every element of $X$ to exactly one element of $Y$. Thus $f(X)$ contains the elements $f(x_1), f(x_2), ..., f(x_n)$. However, we do not know that each $f(x_i)$ , $0 < i < n$ is unique. Thus we can conclude that $f(X)$ has cardinality less than or equal to $n$. Furthermore suppose $f$ is one-to-one. It then follows the elements $f(x_i)$, $0 < i < n$ are each unique. Thus we can conclude that $f(X)$ contains exactly $n$ elements, and hence has cardinality exactly equal to $n$
Thank you very much in advance for any help.
EDIT: (1) Someone asked what the source of my confusion was, I felt that this wasn't really formal and rather I was just attempting to express my intuitive ideas; (2) My definition of $X$ is a finite set of cardinality $n$ is that there exists a bijection from $X$ to $\{i\in \mathbb{N} : 1\leq i \leq n\}$; (3) I see some people have answered me with proof structures or long hints, thank you very much however I just got to my computer and have some other things to do so I haven't got to fixing my proof yet or thoroughly reading your posts I will do it soon however, thank you all very much