Injective and surjective functions

In summary: I'm too tired to think of a good analogy.In summary, the function g is surjective from N to Z, but not injective.
  • #1
Ciaran
72
0
Hello,

I've been reading about injectivity from Z to N and surjectivity from N to Z and was wondering whether there was some kind of algorithm that could generate these specific types of functions?
 
Physics news on Phys.org
  • #2
Ciaran said:
Hello,

I've been reading about injectivity from Z to N and surjectivity from N to Z and was wondering whether there was some kind of algorithm that could generate these specific types of functions?

Sure.

How about $\mathbb Z \to \mathbb N$ given by $n \mapsto \begin{cases}
-2n-1 & \text{if $n < 0$} \\
2n & \text{if $n \ge 0$}
\end{cases}$
Is it injective?
How about surjective?
 
  • #3
Hello!

Thanks for the reply- the function is injective but not surjective. What about surjective from N to Z and is there some algorithm for generating a function satisfying such conditions?
 
Last edited:
  • #4
Ciaran said:
Hello!

Thanks for the reply- the function is injective but not surjective. What about surjective from N to Z and is there some algorithm for generating a function satisfying such conditions?

Yes, it is injective... but isn't it also surjective? Doesn't every element in $\mathbb N$ have an original in $\mathbb Z$?
 
  • #5
Oh I see, I was asking for 2 separate functions- I was asked by my instructor to find a solely injective function from Z to N and a solely surjective function from N to Z. I was struggling so wondered if there was some way of generating one such that I didn't just have to think of a function then see if it fits either category?
 
  • #6
Ciaran said:
Oh I see, I was asking for 2 separate functions- I was asked by my instructor to find a solely injective function from Z to N and a solely surjective function from N to Z. I was struggling so wondered if there was some way of generating one such that I didn't just have to think of a function then see if it fits either category?

Ah. I suspect the intention is to make you familiar with what injectivity and surjectivity actually mean.
When you grasp the concept, there should be no need for any generating algorithm.
I suggest to draw what it means and then come up with a matching function.
Or otherwise try a couple of functions, see what they do, categorize them, and think up what you need to cover any missing category.
 
  • #7
It's the conditions that are proving to be tricky to me- for the surjective function, does it mean my function can only generate integer values ?
 
  • #8
I'm pretty sure g(x)= x! and f(x)=x^2 are injective and surjective, respectively
 
  • #9
Ciaran said:
It's the conditions that are proving to be tricky to me- for the surjective function, does it mean my function can only generate integer values ?

Not precisely.
The fact that we're limiting ourselves to functions from Z to N, respectively N to Z, implies that the function can only generate integer values.
As yet that is unrelated to whether it is surjective or not.
Ciaran said:
I'm pretty sure g(x)= x! and f(x)=x^2 are injective and surjective, respectively

Sorry, but no.
For starters, I assume you are talking about functions from Z to N.
If so, then g is then undefined for negative values, meaning it is not a function from Z to N (depending on the definition of function you're using).

Another problem with g is the g(x)=1 has 2 originals, and is therefore not injective (see below).

And the problem with f is that f(x)=3 has no originals, and is therefore not surjective.

To be clear, injective means that every element in the codomain has at most 1 original.
And surjective means that every element in the codomain has at least 1 original.
 
  • #10
Ahhh, what about f(x) = x/2 if x is even, (1-x)/2 if x is odd. And g(x)=2x+1 for positive x, -2x for negative x?
 
  • #11
Ciaran said:
Ahhh, what about f(x) = x/2 if x is even, (1-x)/2 if x is odd. And g(x)=2x+1 for positive x, -2x for negative x?

Are we talking about functions from Z to N?
Because if so, then f is not a function, since an even negative x is not mapped to N.

As for g, did you mean it to be injective or surjective?
Or put otherwise, what do you think about it being either injective or surjective?
 
  • #12
My apologies, I have only now just noticed you replied! f(x) was meant to be surjective from N to Z and g(x) was meant to be injective from Z to N
 
  • #13
Ciaran said:
Ahhh, what about f(x) = x/2 if x is even, (1-x)/2 if x is odd. And g(x)=2x+1 for positive x, -2x for negative x?

Ciaran said:
My apologies, I have only now just noticed you replied! f(x) was meant to be surjective from N to Z and g(x) was meant to be injective from Z to N

What is N exactly? Does it include 0 or not?

Assuming that N is { 1, 2, 3, ... }, f is indeed surjective. Is f also injective?

As for g, what is the image of 0? You didn't specify.
It has consequences for whether g is injective or not.
 

FAQ: Injective and surjective functions

What is an injective function?

An injective function is a type of function where each element in the domain has a unique corresponding element in the range. This means that no two elements in the domain can map to the same element in the range. It is also known as a one-to-one function.

How can you tell if a function is injective?

To determine if a function is injective, you can use the horizontal line test. This test involves drawing a horizontal line through the graph of the function. If the line intersects the graph at more than one point, then the function is not injective. If the line only intersects the graph at one point, then the function is injective.

What is a surjective function?

A surjective function is a type of function where every element in the range has at least one corresponding element in the domain. This means that no element in the range is left out or unused. It is also known as an onto function.

How can you determine if a function is surjective?

To determine if a function is surjective, you can use the vertical line test. This test involves drawing a vertical line through the graph of the function. If the line intersects the graph at more than one point, then the function is not surjective. If the line intersects the graph at every point in the range, then the function is surjective.

Can a function be both injective and surjective?

Yes, a function can be both injective and surjective. This type of function is called a bijective function. It means that each element in the domain has a unique corresponding element in the range and every element in the range has at least one corresponding element in the domain.

Back
Top