# How to define a function

ASSume That $\gamma>0$ is GIVEN, I want to define a function $f:[a, b]\to [c, d]$ which satisfies the following conditions:

1. $f$ be a diffeomorphism and $f'(x)>0$ for all $x\in [a, b]$
2. $f'(a)=f'(b)=\gamma$

Is there any function with these conditions?

-
When you pose problems like this, it's always useful to check whether the simpliest functions fit: constant, linear, affine, triginometric, exponential... As @TooOldForMath showed, an affine one is ok. – TZakrevskiy Feb 4 '14 at 13:02
@TZakrevskiy: i think it is not trivial. constant $\gamma>0$ is given! not for a $\gamma>0$ – mac Feb 4 '14 at 13:09
@TZakrevskiy: You're Right.I hurried in asking my question. – mac Feb 4 '14 at 13:26

This solution is by far not the easiest one; we will use Bezier curves (see wiki).

Suppose that $(d-c)>\gamma (b-a)$.

We will build a cubic Bezier curve with $P_0= (a,c)$ - you starting point, $P_3 = (b,d)$ - you finish point, and $P_1= (b,c+\gamma(b-a))$ - the direction of derivative in the initial point, similarly, $P_2=(a, d-\gamma(b-a))$ - the direction in the finish point.

The bezier curve then writes in the plane $\Bbb R^2$:

$$x(t) =a\cdot (1-t)^3 + b\cdot 3t(1-t)^2+ a\cdot 3t^2(1-t)+b\cdot t^3,$$ $$y(t) =c\cdot (1-t)^3 + (c+\gamma(b-a))\cdot 3t(1-t)^2+ (d-\gamma(b-a))\cdot 3t^2(1-t)+d\cdot t^3.$$

It's easy to show that $t\to x(t)$ and $t\to t$ are strictly monotone (just study the derivative), therefore, the inverse application $x\to t(x)$ is well defined (even more - it's $C^1$).

Let's look at the derivative of $y$ when $x=a$ (i.e. $t=0$):

$$\frac{dy}{dt}\big|_{t=0} = \frac{dy}{dx}\big|_{x=a}\cdot\frac{dx}{dt}\big|_{t=0}.$$ We obtain $$-3c+3(c+\gamma(b-a)) = \frac{dy}{dx}\big|_{x=a} \cdot 3(b-a),$$ which gives$$\frac{dy}{dx}\big|_{x=a}=\gamma.$$ The proof for $\frac{dy}{dx}\big|_{x=b}=\gamma$ is done similarly.

By strict monotonicty of $x$ and $y$ we conclude that the application $y(x)$ is indeed $[a,b]\to[c,d]$ and satisfies the conditions that you imposed.

The case $(d-c)<\gamma (b-a)$ requires slightly modified vectors $P_1$ and $P_2$:

$$P_1=(a+(d-c)/\gamma,d),\quad P_2=(b-(d-c)/\gamma,c).$$

The case $\gamma = \frac{d-c}{b-a}$ is trivial.

Intuition behind the choice of $P_1$: we want a derivative $\gamma$, so we start from $(a,c)$ and go with the same constant derivative $\gamma$ until we hit the boundary of our box $[a,b]\times [c,d]$. Similarly for $P_2$, we just go in another direction.

-
Thank you very very much. It's so interesting. Is the function in your example increasing? – mac Feb 4 '14 at 15:54
@mac, yes, it's strictly monotone. However, the derivative has a singularity in $t=1/2$ because $x'(0.5)=0$. Therefore, $y'((a+b)/2)=+\infty$. So, you'll need to modify $x(t)$ slightly to avoid this problem. – TZakrevskiy Feb 4 '14 at 16:27
@mac for example, look at http://www.wolframalpha.com/input/?i=ParametricPlot[3+t+%281-t%29^2%2Bt^3%2C+3%‌​2F2+t+%281-t%29^2%2B3%2F2+t^2+%281-t%29%2Bt^3+%2C{t%2C0.4%2C0.6}]. It's an illustration for $a=c=0$, $b=d=1$, $\gamma =1/2$. – TZakrevskiy Feb 4 '14 at 16:28
You don't need to use a parametric Bezier curve ($x$ and $y$ as functions of a parameter $t$). Just fabricate a Bezier curve that gives $y$ as a function of $x$, using more-or-less the same techniques. Simpler. – bubba Feb 8 '14 at 9:17
@bubba you are right. I know that your version would be simpler, and, then again, I never said that my solution was simple=) – TZakrevskiy Feb 8 '14 at 11:32

$$f(x)=\frac{x-a}{b-a}(d-c)+c$$

Edit: To find a suitable $f$ for arbitrary $\gamma>0$, you can try to find the derivative first and then integrate. Look for example at

$$g(x)=\alpha\sin\left(\frac{x-a}{b-a}\pi\right)+\gamma$$

Then $g(a)=g(b)=\gamma$ and $g(x)>0$. Integrating $g$ gives

$$f(x)=-\alpha\frac{b-a}{\pi}\cos\left(\frac{x-a}{b-a}\pi\right)+\gamma x+\beta$$

$f$ is increasing, since $f^\prime(x)=g(x)>0$. Now choose $\alpha, \beta$ such that $f(a)=c$ and $f(b)=d$.

-
My question is stated with the precondition that $\gamma>0$ is already given – mac Feb 4 '14 at 13:16
@mac Yea, now it is. – Your Ad Here Feb 4 '14 at 13:19
TooOldForMath: :) sorry. Do you have any Idea in this case? – mac Feb 4 '14 at 13:20
@mac: Maybe try to find the derivative first and then integrate. E.g. $g(x)=\alpha \sin\left(\frac{x-a}{b-a} \pi\right)+\gamma$. Then $g(a)=g(b)=\gamma$. Integrating gives you a family of candidates for $f$ with two parameters (note these are increasing since $g(x)>0$ for $x\in(a,b)$): $\alpha$ and an additive constant, adapt these such that the range becomes $[c,d]$. – Your Ad Here Feb 4 '14 at 13:37
TooOldForMath:I think $sin$ is not a good candiate. because $f'(x)>0$ so it should be a n increasing function. – mac Feb 4 '14 at 13:42

A different approach. Construct $\phi\colon[a,b]\to\mathbb{R}$ continuous such that

1. $\phi(x)>0$ for all $x\in[a,b]$
2. $\phi(a)=\phi(b)=\gamma$
3. $\int_a^b\phi(t)\,dt=b-a$

Then $f(x)=\int_a^x\phi(t)\,dt$ satisfies all your requirements.

How do we construct $\phi$?

The function $$\phi(x)=\gamma+\frac{6(1-\gamma)}{(b-a)^2}(x-a)(b-x)$$ satisfies 2. and 3. It also satisfies 1. if $\gamma<3$. The corresponding $f$ will be a cubic polynomial.

In the general case it is easy to construct a piecewise linear $\phi$. Small numbers $\epsilon,\delta>0$ can be chosen so that if the graph of $\phi$ is the line segments joining the points $(a,\gamma)$, $(a+\delta,\epsilon)$, $(b-\delta,\epsilon)$ and $(b,\gamma)$, condition 3. is also satisfied.

-
Aguirre: Thanks alot.Very nice. – mac Feb 4 '14 at 16:19