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:


*

*$f$ be a diffeomorphism and $f'(x)>0$ for all $x\in [a, b]$

*$f'(a)=f'(b)=\gamma$


Is there any function with these conditions?
 A: $$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$.
A: 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.
A: A different approach. Construct $\phi\colon[a,b]\to\mathbb{R}$ continuous such that


*

*$\phi(x)>0$ for all $x\in[a,b]$

*$\phi(a)=\phi(b)=\gamma$

*$\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.
