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
It depends on your definition of "finite of cardinality $n$", and on what results you already have.
Often, "finite of cardinality $n$" means "bijectable with $n\in\omega$." If so, your argument may not be exactly right since it does not explicitly show that there is a bijection from $f(X)$ to some $m\in\omega$ with either $m=n$ or $m\in n$ (depending on what results you may have that imply the existence of such bijections). The intuition is right, but the execution may not be enough.
Here is one possibility to formalize this intuition. Fix a bijection $g\colon n\to X$ (this amounts to giving a specific ordering to $X$). Now, for each $y\in f(X)$, let $A_y = \{ m\in n\mid f(g(m))=y\}$ (that is, $A_y$ is the set of preimages of $y$, viewed in terms of the ordering we gave $X$). Define $h\colon f(Y)\to n$ by $h(y) = \min(A_y)$.
Note that $h$ is well-defined, since $A_y\neq\emptyset$ (as $y\in f(X)$); also, $h$ is one-to-one, because $y\neq y'$ implies $A_y\cap A_{y'}=\emptyset$ (since $f$ and $h$ are functions).
Thus, $h$ is a bijection between $Y$ and a subset of $n$; this certainly shows that $Y$ is finite, since a subset of a finite set is necessarily finite (there can be no bijection from a subset of a finite set to a proper subset of itself).
You may already have shown that a subset of $n\in\omega$ is necessarily of cardinality $m$ for some $m\leq n$; if not, then you can construct the bijection inductively easily enough.
Finally, if $f$ is one-to-one, then $f\circ h$ is one-to-one and onto $f(X)$, hence a bijection, showing that $f(X)$ is bijectable with $n$, hence of cardinality $n$.