Function $g(x)$ that is an Integer if and only if $x$ and $f(x)$ are Integers

459 Views Asked by At

Let $g(x)$ be a continuous function that is an integer if and only if $x$ and $f(x)$ ($f(x)$ can be any function) are both integers. What is one definition of $g(x)$ that does not include trigonometric functions ($\sin$, $\cos$, $\tan$, or any of the many variants), $\max$ or $\min$? $g(x)$ should also be efficiently computable given that $f(x)$ is efficiently computable as well.

2

There are 2 best solutions below

8
On BEST ANSWER

I’m not sure if it’s possible for any function $f(x)$, but if $f(x)$ is continuous:

Let $h(x) = \frac{( x - \lfloor x \rfloor ) + ( \lceil x \rceil - x ) }{2} - \frac{\left| ( x - \lfloor x \rfloor ) - ( \lceil x \rceil - x ) \right|}{2}$. If you graph this, you’ll see that it’s continuous, and equals zero if and only if $x$ is an integer. Also note that $\frac{1}{2} \geq h(x) \geq 0$.

Then if $f(x)$ is continuous, $h(f(x))$ is continuous and equal to zero if and only if $f(x)$ is an integer.

Then let $g(x) = \frac{ h(x) + h(f(x))}{2} + \frac{\left| h(x) - h(f(x)) \right|}{2}$, which is continuous, and is zero if and only if both $h(x)$ and $h(f(x))$ are zero (since $h$ is non-negative), and is always less than one, hence is an integer if and only if both $x$ and $f(x)$ are integers.

3
On

Let $A$ be all integers $a$ where $f(a)$ is an integer.

You want $h(x)$ to be an integer if and only if $x \in A$.

Either $A$ is empty, $A$ is non-empty and finite, $A$ is infinite but has a least element (but not a greatest), $A$ is infinite but has a greatest element (but not a least), $A$ is infinite but has no least or greatest element.

If $A$ is finite label the elements as $a_0, a_1, a_2, .... ,a_n$ so that $a_i < a_j \iff i < j$. If $A$ is infinite but has a least element label the elements as $a_0, a_1, a_2, .... $ so that $a_i < a_j \iff i < j$. If $A$ is infinite but has a greatest element label the elements as $.....a_{-2},a_{-1}, a_0$ so that $a_i < a_j \iff i< j$. If $A$ is infinite and unbounded above or below pick an arbitrary element to be $a_0$ and label the elements as $.....a_{-2},a_{-1}, a_0,a_1,a_2,.....$ so that $a_i < a_j \iff i < j$.

If $A$ is empty then $h(x)$ is never an integer. Let $h(x) = \frac 13$.

If $A$ has a least element $a_0$. If $x \le a_0$ let $x= \frac 1{a_0 -x + 1} -1$. Thus $h(a_0) = 0$ and for all $x < a_0$, $-1 < f(x) < 0$ so $h(x)$ will never be an integer for $x < a_0$. And $h(x)$ will be continuous on $(-\infty, a_0]$

If $A$ has a greatest element $a_n$. If $x \ge a_n$ let $x = n+ \frac 1{x-a_n +1}-1$. Thus $h(a_n) = n$ and for all $x> a_n$, $n <f(x) < n+1$ so $h(x)$ will never be an integer for $x > a_n$. And $h(x)$ will be continuous on $[a_n, \infty)$

For any $x: a_i \le x \le a_{i+1}$ let $h(x) = a_i + (x-a_i)\frac 1{a_{i+1}-a_i}$. So $h(a_i) =i$ and $h(a_{i+1}) = i+1$ and for all $x: a_i<x < a_{i+1}$ we have $i < f(x) < i+1$. And $h(x)$ is continuous on $[a_i, a_{i+1}]$.

This function is continuous and is an integer only when $x$ and $f(x)$ is an integer.