First, I suggest you review the following link: definition of a function, (mathematical).
- The entire entry is worth reviewing, as it includes additional information about functions and function notation, provides examples of functions, and defines "injective" (one-to-one), "surjective" (onto), and "bijective" (one-to-one and onto) functions.
Now:
(1) For the first example in your post, the relation is not by definition, a function, because it assigns three different values of $Y$ to one value in the domain, $X$, (or put differently, it maps $1 \in X$ to three distinct values in $Y$, which makes $f(1)$ not well-defined).
We can reverse the direction of the mapping to define $f_1: Y \to X,$ $f_1 = \{(a, 1), (b, 1)(c, 1)\}$, THEN $f_1$ is an ONTO function from $Y$ onto $X$, but is not be one-to-one, since the image under $f_1$ of each of the three distinct values in $Y$ identical: $f_1(a) = f_1(b) = f_1(c) = 1$.
(2) For the second example in your post:
There's no way to fix, in a similar manner, the second non-function; as it stands, it fails to be a function because the element $3 \in X$ has no image; that is, $f$ is not defined for $3 \in X$.
However, let's MAKE a function by defining $f_2$ so that $\exists f_(3):\quad$, e.g.$\quad f_2: X \to Y,\;$ $f_2 = \{(1, a), (2, b), (3, c), (4, d)\}$
Under this definition, $f_2$ is one-to-one and onto.
Recall, a function is generally defined as a relation which assigns a value from the range to EACH element in the domain on which it is defined, and it must map each element in the domain to one, and only one, element in the codomain/range.