Suppose $x(t)$ is differentiable on $(0,T)$ and continuous on $[0,T]$. How to find the minimum and the minimal value of the integral $$\int\_0^T\|\dot x(t)+x(t)\|^2dt$$ such that $m\le x(t)\le M$ on $[0,T]$?



How to find the minimum of the integral?
Consider the quadratic functional $J\_T$ on the Hilbert space $H^1(0,T)$
$$J\_T(u):=\int\_0^T(\dot u+u)^2dt\ ,$$ 
and let $0<m< M$ be given. The complete picture for the minimization problem of $J\_T$ on $\{u\in H^1(0,T)\ :\ m\le u\le M\}$, as $T$ varies, is as follows:



> 
> * For $0\le T \le T\_0:=\log(M/m)$ the minimum value is $0$, and it is attained by exponentials $ce^{-t}$, with $me^T\le c\le M$
>  Geometrically, the zero set of $J\_T$ is a line meeting the convex constraint set in a
>  segment, that becomes a single point for $T=T\_0$.
> * For $T\_0\le T\le T\_1:=\text{arcosh}(M/n)$ there is a unique minimizer, which is a decreasing solution of the free Euler-Lagrange
>  equation $\ddot u=u$ with $u(0)=M$ and $u(T)=m$, namely
>  $$u\_T(t):={m\over\sinh T}\sinh t+ {M\over\sinh T}\sinh (T-t)$$ 
>  corresponding to the minimum value $$J\_T(u\_T)=2{(me^T-M)^2\over e^{2T}-1}.$$ Note that for $T=T\_1$ the minimizer is simply
>  $$u\_{T\_1}(t)=m\cosh(T\_1-t)$$
> * For $T\ge T\_1$ the unique minimizer is just $u\_{T\_1}$ prolonged to be constant for $T\_1\le t\le T$, namely $$u\_{T}(t)=m\cosh(T\_1-t)\_+$$
>  which is a $C^1$ function since $\cosh(T\_1-t)$ has a $0$ derivative at $t=T\_1$.
>  The corresponding minimum value for $J\_T$ then grows affinely:
>  $$J\_T(u\_T)=J\_{T\_1}(u\_{T\_1}) +m^2(T-T\_1).$$
> 
> 
> 


$$\*$$
**Details.**
More generally for $0\le \alpha\le \beta\le T$ denote  

$$J(u,[\alpha, \beta]):=\int\_\alpha^ \beta(\dot u+u)^2dt=\|\dot u\|^2\_{2,[\alpha,b]}+\| u\|^2\_{2,[\alpha,b]} +u(b)^2-u(\alpha)^2\ .$$


The situation being clear for $T\le T\_0$, we assume $T>T\_0$, that is case **C** in Carlo Beenakker's answer. So in the following $Me^{-T}<m$, and $J\_T(u)>0$ whenever $m\le u\le M$.


If $u\in H^1(0,T)$ satisfies $m\le u\le M$ in $[0,T]$, but $Me^{-t}\le u(t)$ does not hold for all $t$, then $$v(t):=\max( u(t), Me^{-t})$$ has $\dot v(t)+v(t)=0$ in the non empty open set $\{v\neq u\}$, and $\dot v(t)+v(t)= \dot u(t)+u(t)$ a.e. in $\{v= u\}$, so $J\_T(v)<J\_T(u)$. The same hold, analogously, for $v(t):=\min( u(t), me^{T-t})$.


Therefore, *any minimizer of the constrained problem must also satisfy for all $0\le t\le T$
$$Me^{-t}\le u(t)\le me^{T-t}$$
and in particular $u(0)=M$ and $u(T)=m$*.


Also, if $u\in H^1(0,T)$ verifies $m=u(T)\le u(t)\le u(0)=M$ and $u$ is not decreasing, by easy intermediate value arguments there are $0\le \alpha < \beta\le T$ such that $$u(\alpha)=u(\beta)=\min\_{\alpha\le t\le \beta}u(t)<\max\_{\alpha\le t\le \beta}u(t)\ .$$
Then, putting for $0\le t\le T$
$$
v(t):=\begin{cases}
u(\alpha),& \text {if }\ \alpha\le t\le b\\ \\
u(t), &\text {otherwise.} \\ 
 \end{cases}
$$
defines an element $v\in H^1(0,T)$, with $m\le v\le M$ such that $$J\_T(u)-J\_T(v)=J(u,[\alpha,\beta])-J(v,[\alpha,\beta])>0\ ,$$
thanks to the stated identity for $J(u,[\alpha,\beta])$. 


Therefore, *any minimizer of the constrained problem must be decreasing on $[0,T]$.*


Finally, if $u(T)=m\le u\le M=u(\beta)$ for some $0=\alpha<\beta\le T$, we can compare $u$ with
$$
v(t):=\begin{cases}
u(t+\beta),& \text {if} \; 0\le t\le T-\beta\\\\ 
m, &\text {if} \; T-\beta\le t\le T. \\ 
 \end{cases}
$$
Again $J\_T(u)>J\_T(v)$ follows from the above identity for $J(u,[\alpha,\beta])$, for
$$J\_T(u)-J\_T(v)=J(u,[\alpha,\beta])-J(m,[\alpha,\beta])>0.$$ 


Hence any minimizer of the constrained problem is decreasing and verifies $u(0)=M>u(t) \ge u(T)=m$ for $0< t\le T$. In particular, it solves the Euler-Lagrange equation $\ddot u-u=0$ in the interval $(0,\tau)$ (any small perturbation with compact support in $(0,\tau)$ leaves $u$ within the constraints). This gives:


$$u(t):= 
\begin{cases}
{m\over\sinh \tau}\sinh t+ {M\over\sinh \tau }\sinh (\tau-t),& \text {if} \; 0\le t\le-\tau\\ \\
m, &\text {if} \; \tau\le t\le T. \\
 \end{cases}$$


for some $0\le \tau\le \min(T, T\_1)$; the corresponding value of the functional is
$$J\_T(u)=2{(me^\tau-M)^2\over e^{2\tau}-1}+m^2(T-\tau).$$


To conclude, one has to minimize the above expression w.r.to the parameter $\tau\in [0,\min(T, T\_1)]$, finding the minimizer. In fact, it turns out it is decreasing w.r.to $\tau$, so that the minimum corresponds to $\tau=\min(T, T\_1),$ ending the computation: one has:


$${dJ\_T(u\_\tau)\over d\tau}=-{ \left( {me^{2\tau}-2Me^\tau + m \over e^{2\tau}-1 }\right)^2}\ .
$$


(Note that this proves independently the existence of the minimizer, so we could have used piecewise $C^1$ functions instead of $H^1$, where however existence is also clear by convexity and weak compactness.)


