4

Is there a function $f:{\mathbb N}\to{\mathbb N}$ that is neither injective nor surjective ?


I came up with $n\mapsto\sin n$ as not all outputs are mapped and some inputs have the same output, but then I realized $\sin n$ doesn't produce a natural number. I have to map the natural numbers to the natural numbers.

I also came up with other ones but they always seem to be total and injective or total and subjective.

Hedylove
  • 570
  • Do you mean a total function, maybe? – Bram28 Dec 11 '17 at 04:37
  • 1
    I think a total relation is one where every pair of elements is comparable. So to speak, for every $x,y$ either $(x,y)$ or $(y,x)$ belongs in the relation. He now wants a non-injective relation i.e. two elements with same second component but different first component, but also non-surjective i.e. there is some natural number that is not the second component of any element. That is what I think. – Sarvesh Ravichandran Iyer Dec 11 '17 at 04:42
  • I was suppose to look for a relation from the natural set to the natural set with the above condition. So technically a function. – Hedylove Dec 11 '17 at 04:43
  • I think @астонвіллаолофмэллбэрг may be right, and you misunderstood what the question was trying to ask (it's certainly far more interesting that way). – Noah Schweber Dec 11 '17 at 04:47
  • @астонвіллаолофмэллбэрг Well, there is no total relation that is non-surjective relation: for it to be total, it needs to be reflexive, and is therefore automatically surjective. – Bram28 Dec 11 '17 at 04:59
  • @Bram28 I had not thought about that! Hence,you are right. However, suppose we only insist the above for all $a \neq b$. Then, can you solve the question? – Sarvesh Ravichandran Iyer Dec 11 '17 at 05:02
  • @астонвіллаолофмэллбэрг Hmmm, how about the $<$ relation? – Bram28 Dec 11 '17 at 05:13
  • @Bram28 Yes, that's right! It's not injective, example both $1,2$ are less than $3$. Nothing is less than $1$, so it is not surjective, but then it is true that $a,b$ are always comparable if unequal. – Sarvesh Ravichandran Iyer Dec 11 '17 at 05:15

4 Answers4

47

When in doubt, don't do anything complicated: $$f(n)=17.$$ (Of course, you may have additional conditions you want satisfied, but you haven't mentioned them.)

Noah Schweber
  • 245,398
  • 24
    @JozemiteApps Yes it does. It takes in a natural number and spits out a natural number. What do you think the phrase means? – Noah Schweber Dec 11 '17 at 04:41
  • @JozemiteApps So you're just asking how to express this in the form $f: X\rightarrow Y: x\mapsto y$ (or similar)? I think that's something you can figure out on your own, if you think about it (what do you want the domain/codomain to be? can that work?). – Noah Schweber Dec 11 '17 at 04:46
  • 24
    @JozemiteApps What do you think the term surjective means? – DanielV Dec 11 '17 at 04:46
  • 2
    I just finally realized what you did. haha. For some reason I kept thinking I needed to include all codomains on the right side, but I just realized, I don't have to. They are implicitly already in the codomain set, just not mapped to at all. – Hedylove Dec 11 '17 at 04:50
  • I think you're misunderstanding codomains. The codomain of a function definitely has to contain all the outputs, but it can also contain more stuff: e.g. the function $f(x)=x^2$ makes sense as a function with domain $\mathbb{R}$ and codomain $\mathbb{R}_{\ge0}$, but it also makes sense as a function with domain $\mathbb{R}$ and codomain $\mathbb{R}$. So think about it: you want something that maps from $\mathbb{N}$ to $\mathbb{N}$. What domain and codomain do you want, then? Do they make sense for this function? – Noah Schweber Dec 11 '17 at 04:51
  • @JozemiteApps Yup! And they'd better not be since otherwise the function would be injective, which you don't want. (That said, I do think that there is a real chance that you've misinterpreted the question and астон вілла олоф мэллбэрг had the right interpretation, so I'd go back and make sure.) – Noah Schweber Dec 11 '17 at 04:51
  • 31
    Why not $f(n)=42$? – Niyoko Dec 11 '17 at 05:22
  • @NiyokoYuliawan I don't feel so bad thinking this to myself now. – Cloud Dec 11 '17 at 05:24
  • 7
    @NiyokoYuliawan: This question isn't that important. :) –  Dec 11 '17 at 09:02
  • 1
    @NoahSchweber in your last comment: "they'd better not be since otherwise the function would be injective" - I think you mean "surjective". Too bad after such a great explanation ! – Evargalo Dec 11 '17 at 13:02
  • 5
    That part was easy. Now we have to find out what's special about 17. – Peter - Reinstate Monica Dec 11 '17 at 16:30
  • 1
    @PeterA.Schneider It is 10 greater than a reasonable approximation of infinity. – Yakk Dec 11 '17 at 18:29
  • @Evargalo Oof, quite right! Shame on me, and it's far too late to edit. – Noah Schweber Dec 12 '17 at 00:26
  • @NiyokoYuliawan, Peter A. Schneider: Because https://mathoverflow.net/a/285937/27465 – Torsten Schoeneberg Dec 12 '17 at 00:47
  • @PeterA.Schneider Maybe David C. Kelly and M. Spivak can explain you about $17$, and yellow pigs (!) – Jonatan B. Bastos Dec 12 '17 at 02:03
  • @TorstenSchoeneberg Oh my, that's absolutely brilliant! It's not what my motivation used to have been, but it was now. – Noah Schweber Dec 12 '17 at 04:43
16

$$n\to\sin n\color{red}\pi$$ (Actually, this is equivalent to $n\to 0$ and thus in the same vein as Schweber's answer. I couldn't resist tacking on to the function in the question though.)

Parcly Taxel
  • 103,344
  • 2
    Also, more aligned with OP's initial attempt at solving problem. But I actually up-voted your answer because I learned something new - latex $\color{red}coloring$! – CopyPasteIt Dec 11 '17 at 19:40
13

How about $f(n) = n^2-n$?

Total, as $f(n)$ is defined for each $n$

Not injective, as $f(0)=f(1)$

Not surjective, as there is no $n$ such that $f(n)=1$

Bram28
  • 100,612
  • 6
  • 70
  • 118
3

There are lots of fine answers given already, but possibly you'll enjoy this one, too:

$$n\mapsto n(1+\cos n\pi)$$

CiaPan
  • 13,049