# Convex Functions: Find $f,g$ Satisfying f(x)=g(x) iff x is an Integer

• MHB
• evinda
In summary: Suppose wlog that $x < y$.Then $g$ is convex because:If $x$ and $y$ are between the same consecutive integers, then the graph between them is a straight line, which counts as convex.Otherwise they are on different line segments and $y$ is on a line segment with a higher slope since the second derivative of $f$ is positive everywhere. Consequently the line that connects them is above all line segments in between.
evinda
Gold Member
MHB
Hello! (Wave)

I want to find two convex functions $f,g: \mathbb{R} \to \mathbb{R}$ such that $f(x)=g(x)$ iff $x$ is an integer.I have thought of the following two functions $f(x)=e^x$, $g(x)=1$.

Then at the $\Rightarrow$ direction, we would have $f(x)=g(x) \Rightarrow e^x=1 \Rightarrow x=0 \in \mathbb{Z}$.

Right?

At the other direction, we cannot pick $0$, we have to pick an arbitrary integer. Right? If so, then it does not hold that $f(x)=g(x)$...

So do we have to pick other $f,g$ ? (Thinking)

evinda said:
Hello!

I want to find two convex functions $f,g: \mathbb{R} \to \mathbb{R}$ such that $f(x)=g(x)$ iff $x$ is an integer.I have thought of the following two functions $f(x)=e^x$, $g(x)=1$.

Then at the $\Rightarrow$ direction, we would have $f(x)=g(x) \Rightarrow e^x=1 \Rightarrow x=0 \in \mathbb{Z}$.

Right?

At the other direction, we cannot pick $0$, we have to pick an arbitrary integer. Right? If so, then it does not hold that $f(x)=g(x)$...

So do we have to pick other $f,g$ ?

Hey evinda! (Happy)

Indeed, we will have to pick other $f,g$.
I'm assuming that $f$ and $g$ have to be different functions. Do they?
Either way, it means that $f$ and $g$ have to be the same at every integer $x$.

Can we find a function $g$ that is suitable if for instance $f(x)=e^x$? (Thinking)

Klaas van Aarsen said:
Hey evinda! (Happy)

Indeed, we will have to pick other $f,g$.
I'm assuming that $f$ and $g$ have to be different functions. Do they?

I assume so, too.

Klaas van Aarsen said:
Either way, it means that $f$ and $g$ have to be the same at every integer $x$.

Can we find a function $g$ that is suitable if for instance $f(x)=e^x$? (Thinking)

(Thinking) Do we have to pick a function containing $\ln{x}$ ? I haven't thought of a suitable function so far...

evinda said:
I assume so, too.

Do we have to pick a function containing $\ln{x}$ ? I haven't thought of a suitable function so far...

How about a piecewise function that consists of line segments? (Thinking)

Klaas van Aarsen said:
How about a piecewise function that consists of line segments? (Thinking)

So you mean that we pick a function that equals $e^x$ for $x \geq 0$ and $e^{-x}$ for $x<0$ ? (Thinking)

evinda said:
So you mean that we pick a function that equals $e^x$ for $x \geq 0$ and $e^{-x}$ for $x<0$ ? (Thinking)

I was thinking of a function that equals $e^x$ if $x$ is an integer, and otherwise linearly interpolates between the nearest integers. (Thinking)

Klaas van Aarsen said:
I was thinking of a function that equals $e^x$ if $x$ is an integer, and otherwise linearly interpolates between the nearest integers. (Thinking)

You mean that we pick this $g(x)$ ?

$$g(x)=\begin{cases}e^x & \text{ if } x\in \mathbb{Z} \\ e^{\lfloor x\rfloor}+(x-\lfloor x\rfloor)\frac{e^{\lceil x\rceil}-e^{\lfloor x\rfloor}}{\lceil x\rceil-\lfloor x\rfloor} & \text{ if } x\notin \mathbb{Z}\end{cases}$$

evinda said:
You mean that we pick this $g(x)$ ?

$$g(x)=\begin{cases}e^x & \text{ if } x\in \mathbb{Z} \\ e^{\lfloor x\rfloor}+(x-\lfloor x\rfloor)\frac{e^{\lceil x\rceil}-e^{\lfloor x\rfloor}}{\lceil x\rceil-\lfloor x\rfloor} & \text{ if } x\notin \mathbb{Z}\end{cases}$$

Yep. That would work, wouldn't it? (Thinking)

Klaas van Aarsen said:
Yep. That would work, wouldn't it? (Thinking)

Why is $g$ convex?

Also both directions are trivial, aren't they?

The $\Leftarrow$ direction is implied by definition and if $f(x)=g(x)$ we have to have that $x \in \mathbb{Z}$ since otherwise the equality wouldn't hold. Right? (Thinking)

evinda said:
Why is $g$ convex?

Also both directions are trivial, aren't they?

The $\Leftarrow$ direction is implied by definition and if $f(x)=g(x)$ we have to have that $x \in \mathbb{Z}$ since otherwise the equality wouldn't hold. Right? (Thinking)

Right!

Suppose wlog that $x < y$.
$g$ is convex because:
• If $x$ and $y$ are between the same consecutive integers, then the graph between them is a straight line, which counts as convex.
• Otherwise they are on different line segments and $y$ is on a line segment with a higher slope since the second derivative of $f$ is positive everywhere. Consequently the line that connects them is above all line segments in between.
(Thinking)

## 1. What is a convex function?

A convex function is a function where the line segment connecting any two points on the graph of the function lies above or on the graph. In other words, the function is always "curving up" and does not have any "dips" or "valleys". This can also be described as a function where the second derivative is always positive.

## 2. Can you give an example of a convex function?

One example of a convex function is f(x) = x^2. The graph of this function is a parabola, which is always curving upwards and does not have any dips or valleys.

## 3. How do you determine if a function is convex?

To determine if a function is convex, you can take the second derivative of the function. If the second derivative is always positive, then the function is convex. Additionally, you can also plot the graph of the function and visually determine if it is convex.

## 4. What do you mean by "iff x is an Integer" in the problem statement?

In the context of this problem, "iff" stands for "if and only if". This means that the functions f(x) and g(x) will only be equal when x is an integer. In other words, the functions will only have the same output for integer values of x.

## 5. Can you provide an example of two functions that satisfy the given condition?

One example of two functions that satisfy f(x) = g(x) iff x is an Integer is f(x) = x and g(x) = floor(x), where floor(x) is the greatest integer less than or equal to x. This means that for any integer value of x, f(x) and g(x) will have the same output (since x is already an integer), but for non-integer values, the outputs will be different.

• Topology and Analysis
Replies
24
Views
2K
• Topology and Analysis
Replies
4
Views
264
• Topology and Analysis
Replies
23
Views
2K
• Topology and Analysis
Replies
3
Views
503
• Topology and Analysis
Replies
5
Views
1K
• Topology and Analysis
Replies
1
Views
544
• Topology and Analysis
Replies
2
Views
1K
• Topology and Analysis
Replies
5
Views
894
• Topology and Analysis
Replies
8
Views
1K
• Topology and Analysis
Replies
1
Views
1K