# Defining a function (Discrete Math)

Tags:
1. Oct 15, 2015

### transmini

I have multiple problems in the current homework set that say something along the lines of "try to define a function f: S -> S by the rule f(n) = n^2 for each n in S. Then it asks a couple questions such as "is the function well defined" or "is it one-to-one/onto"

I'm just confused on what its actually wanting me to do. Could someone give like an example of what they mean? Because I would've though the rule that gave WAS the function.

2. Oct 15, 2015

### DeldotB

Well, its basically saying:
Define a function (mappping) f where $f:S\rightarrow S$ where $n\rightarrow n^2$ for all n in S. Then show that a function defined in this way is either injective(one-to-one) or surjective(onto).
A function is well defined if $f:A\rightarrow B$, for each $a \in A$ there exists a unique $b \in B$ such that $f(a)=b$

3. Oct 15, 2015

### DeldotB

An example, let S=$\mathbb{R}$.
Ask yourself: Is $f:\mathbb{R}\rightarrow \mathbb{R}$,$n\rightarrow n^2$ one-to-one? (Is there a unique b in B such that f(a)=b, for a unique a in A)?

Well, $-2 \in \mathbb{R}$ and we see that f(-2)=4
at the same time, $2 \in \mathbb{R}$ and we see that f(2)=4

Thus, f(2)=f(-2) so in this case, f is not one-to-one on this domain $\mathbb{R}$

You could easily show that f defined in this way is also not onto. So you could say f is not bijective (one-to-one and onto) and f is well defined.

4. Oct 15, 2015

### transmini

Okay so I'm still a little lost as to what to write for this. Here's another problem out of the book, not the actual problem, but it's similar.

Define ƒ : ℤ → ℤ by the rule ƒ(n) = 4n - 5 for all integers n.
(i) Is ƒ one-to-one? Prove or give a counterexample.
(ii) Is ƒ onto? Prove or give a counterexample

I'm not sure how to even get started unless it literally wants me to just answer i and ii.

5. Oct 15, 2015

### DeldotB

Well, think about it graphically: 4n-5 is a line. Does a line in the ($\mathbb{Z},\mathbb{Z}$) plane have only one "x" value per "y" value? (i.e injective)
Does every "y" value have an "x" value? (i.e onto)? (I say x,y analogous to the cartesian plane to draw you a mental picture)

6. Oct 15, 2015

### transmini

I meant as far as the "Define a function" part goes. I should be able to show the others, I think...

7. Oct 15, 2015

### DeldotB

By saying "define a function" your book is saying "consider a function" -its just wording.
Basically if a say define a function: f(x)=x^2, im saying look at this function and answer the following questions about it.

8. Oct 15, 2015

### transmini

Oh....well that's pretty bad wording then haha. But I was confused about that since they already gave a function. Thanks for the help!

9. Oct 16, 2015

### Staff: Mentor

Thread moved, as it is more of a generic question than an actual homework question.
@transmini, when you post in the Homework section, you must use the homework template.

10. Oct 16, 2015

### Fredrik

Staff Emeritus
When a book asks "is the function well-defined?", what they usually mean is "Does the above actually define a function?" In the case of the original question, the answer depends on whether it's clear from the context what multiplication operation is involved in the definition of the notation n^2.

It's usually obvious if a statement defines a function or not. When it's not, there's often an equivalence relation involved. Suppose that ~ is an equivalence relation on some set X. Then each element of X belongs to exactly one equivalence class. The equivalence class that contains x is denoted by [x]. The set of all equivalence classes is denoted by X/~. We can try to define a function f with domain X/~ by specifying what we want f([x]) to be for each equivalence class [x], but if that specification is an expression that involves x rather than [x], then it might be hard to tell if the statement defines a function or not. You would have to try replacing the x in that expression with a variable that represents an arbitrary element of [x], and see if you can prove that the new expression represents the same thing as the old one.

In set theory, a function isn't a rule. It's useful to think of it as a rule, but it's really a set, like everything else. There are several slightly different ways to define the term "function" in set theory. This one is appropriate for the problems you're working with:

Definition 1: A triple $(X,Y,G)$ such that $G\subseteq X\times Y$ is said to be a function from X into Y if

(a) For all x in X, there's a y in Y such that (x,y) is in G.
(b) For all y,z in Y, if (x,y)=(x,z) then y=z.

If f=(X,Y,G) is a function in the sense of definition 1, then X is called the domain of f, Y is called the codomain of f, and G is called the graph of f.

This one is also nice:

Definition 2: A set f of ordered pairs is said to be a function the following statement holds for all (x,y), (w,z) in f: If x=w then y=z.

The domain of f is then defined as the set of all x such that there's a y such that (x,y) is in f. (A more complicated statement is needed to make it clear that the definition of "domain" doesn't violate any set theory axioms, but this definition is accurate enough for our purposes).

What definition 2 calls a function is what definition 1 calls the graph of a function. The terms "codomain" and "surjective" are kind of pointless if you're using definition 2. That's why I think definition 1 is more appropriate for you.

Last edited: Oct 17, 2015