By Steven Rash

2014-04-01 23:09:33 8 Comments

Does there exist a function $f: \mathbb{R} \to \mathbb{R}$ that takes each value in $\mathbb{R}$ three times? If not, how could I prove that such a function does not exist?


@Sobi 2015-12-07 18:43:46

$\text{cotan}(\frac{3\pi}{1+e^{-x}})$ will do. Here is the plot of the function:

enter image description here

@The Chaz 2.0 2015-12-07 18:56:20

Right - couldn't we just take three lines, if we are able to restrict the domain?

@Sobi 2015-12-07 19:29:06

Please note that I changed the function, and the domain the entire $\mathbb{R}$ now.

@Jack D'Aurizio 2014-08-12 18:51:35

I am exporting the answer I gave to a closed question.

$$f(x)=2\left\lfloor\frac{x}{3\pi}\right\rfloor-\cos\left(3\pi\left\{\frac{x}{3\pi}\right\}\right)\tag{1}$$ is a differentiable function that attains any real value in exaclty three points, whose graphics is the following one:

$\hskip2in$enter image description here

If in $(1)$ you replace "$3$" with the positive odd integer $2m+1$, you get a function that attains any real value in exactly $2m+1$ points. You can also take:

$$f(x) = T_{2m+1}\left(x-2\left\lceil\frac{x-1}{2}\right\rceil\right)+2\left\lceil\frac{x-1}{2}\right\rceil,$$

where $T_{2m+1}$ is the $(2m+1)$-th Chebyshev polynomial of the first kind. This is a $C^1(\mathbb{R})$ function, too.

@Jonas Meyer 2014-08-12 22:28:50

I noticed that you posted a comment about it not being a duplicate, but so far I am the only one who has voted to reopen.

@Jack D'Aurizio 2014-08-12 22:40:29

I'm gonna vote too.

@user228168 2015-05-16 12:50:14

@JackD'Aurizio : Could you please see this wolfram plot , I think it shows that the first function is discontinuous .....…

@Henning Makholm 2014-04-01 23:30:30

Here's a continuous solution:

$$ f(x) = \begin{cases} 4x-3\lfloor x\rfloor & \text{when $\lfloor x\rfloor$ is even} \\ 3\lfloor x\rfloor + 3 - 2x & \text{when $\lfloor x \rfloor$ is odd} \end{cases} $$

This takes on the values $0,4,2,6,4,8,6,10,8,\ldots$ at integer $x$ and interpolates linearly between them.

$f(x)$ from $x = 0$ to $10$

Any even number $2m$ is hit at $f(2m)$ (a local minimum), $f(2m-\frac32)$ (the middle of an increasing line segment), and $f(2m-3)$ (a local maximum). All other numbers are hit by a point in an increasing line segment, then a decreasing one, and finally another increasing one.

A smoother function with the same overall shape would be $g(x)=ax+\sin x$, except the coefficient $a$ has to be just right in order to get the local maxima and minima to coincide, and I'm too lazy to figure out what it should be.

@P Vanchinathan 2014-04-02 00:25:14

@Henning Makholm: Just looking at the graph the first half of the first segment does not seem to attain every height 3 times (visually). That is, values $y<2$. Perhaps you mean the graph extends to negative region too?

@Henning Makholm 2014-04-02 00:30:02

@PVanchinathan: The function is $\mathbb R\to\mathbb R$; the graph (contributed by Omnomnomnom) shows it only for $x$ between $0$ and $10$, but it is to be understood that it extends indefinitely below and above that interval.

@P Vanchinathan 2014-04-02 01:11:24

Sorry if I sounded like asking something too obvious. I am curious to know the answer to the same question if we are looking for functions on bounded open interval.Seems like metric or order plays a role. I am not able to see it clearly.

@Henning Makholm 2014-04-02 09:52:20

@PVanchinathan: From/to an open interval, just compose this function with your favorite homeomorphism between $\mathbb R$ and the open interval -- arctan, erf, tanh, whatever.

@P Vanchinathan 2014-04-02 16:43:36

Continuity is ok. As we are composing with a bijection, the number of inverse images remains the same. Nice example. By the way what is erf?

@Henning Makholm 2014-04-02 17:05:17

@PVanchinathan: The error function.

@user119228 2014-04-01 23:33:40

Continuity works :

$$ f(x) = \left\{ \begin{array}{ll} 3(x-k)+k & 0\le x-k\le \frac{1}3 \\ −3(x−k)+2+k & \frac{1}{3}\le x-k\le \frac{2}3 \\3(x−k)−2+k &\frac{2}{3}\le x-k\le 1 \end{array} \right. $$

In fact one can prove the following statement : There exists a continuous function that takes all the values ​​of its image exactly $n$ times if and only if $n$ is odd.

@Henning Makholm 2014-04-01 23:43:29

Nice general result. The example here generalizes easily to show the "if" direction, but is there a sleek way to show "only if"?

@bof 2014-04-01 23:22:31

If you can construct a bijection $\varphi:[0,1)\to(0,1)$, then you can construct bijections $f:(-\infty,0)\to(-\infty,\infty),\ g:[0,1)\to(-\infty,\infty)$, and $h:[1,\infty)\to(-\infty,\infty)$, and take their union.

Namely, let $f(x)=\log(-x),\ g(x)=\tan(\pi(\varphi(x)-\frac12)),\ h(x)=g(\frac2{\pi}\arctan(x-1))$.

@Samuel Yusim 2014-04-01 23:34:45

Here's a continuous, non-piecewise function that does it, and it's very simple too. Consider $$f(x) = \sin(x) + \frac{2x}{3\pi} \text{.}$$

@Henning Makholm 2014-04-01 23:40:44

No, $\frac{2}{3\pi}$ is not the right coefficient. Your $f(x)$ has five roots, approximately $\{-4.7, -4.3, 0, 4.3, 4.7\}$.

@Samuel Yusim 2014-04-01 23:53:34

You're right. There's gonna be some disgusting math in getting the slope of that $x$ term. I figured I'd just solve $\sin(\frac{3\pi}{2}) + a\frac{3\pi}{2} = 0$ and the slope would be $a$, but it's really not that easy.

@Mario Carneiro 2015-12-07 19:30:20

See You want the $a$ in $f(x)=\sin x+ax$ to be the unique solution of $\sqrt{1-a^2}=\pi+\cos^{-1}a$ with the usual branch for $\cos^{-1}$, roughly $a\approx0.217234$. This is equivalent to demanding that the unique local minimum of $f(x)$ in the region $[0,2\pi]$ has value $0$. (Also it is more impressive if you say your solution is analytic rather than just continuous, like the other solutions.)

@Alex Becker 2014-04-01 23:18:47

Yes, in fact there is a very general way to construct functions like this. For example, essentially the same proof works for any $n$ instead of just $3$.

It suffices to note that $\mathbb R$ and $\mathbb R\times \{0,1,2\}$ have the same cardinality. To see this, note that we have an obvious injection $\mathbb R\to \mathbb R\times \{0,1,2\}$, and we can define an injection the other way by $$f(x,y)=\begin{cases} \arctan x\ &\text{if } y = 0\\ \arctan x + \pi &\text{if } y = 1\\ \arctan x + 2\pi &\text{if } y = 2 \end{cases}$$ thus by Bernstein-Schroeder there exists some bijection $g:\mathbb R\to \mathbb R\times \{0,1,2\}$. Now let $h(x)$ be the first component of $g(x)$.

@Alex Becker 2014-04-01 23:26:32

@AymanHourieh I do indeed.

Related Questions

Sponsored Content

4 Answered Questions

[SOLVED] $f: \mathbb{R} \to \mathbb{R}$ that takes each value in $\mathbb{R}$ twice

0 Answered Questions

0 Answered Questions

Function takes reals exactly twice

  • 2017-04-14 07:24:39
  • Himanshu
  • 72 View
  • 0 Score
  • 0 Answer
  • Tags:   real-analysis

3 Answered Questions

2 Answered Questions

[SOLVED] Construct a function that takes any value even number of times.

  • 2015-08-12 10:25:35
  • Pasha Mishchenko
  • 290 View
  • 6 Score
  • 2 Answer
  • Tags:   real-analysis

1 Answered Questions

Sponsored Content