Maximum value of the integral $\int_0^1e^{|t-x|}dt$ for $0 \leq x \leq 1$ Define $$f(x)=\int_0^1e^{|t-x|}dt$$
I have to find the maximum value of $f(x)$ when $0 \leq x \leq 1$.
To remove the modulus, I wrote $$f(x)=\int_0^xe^{x-t}dt + \int_x^1e^{t-x}dt$$
$$f(x)=e^x\int_0^xe^{-t}dt + e^{-x}\int_x^1e^tdt$$
And then $$f'(x)=e^x\int_0^xe^{-t}dt + 2 - e^{-x}\int_x^1e^tdt$$
This does not seem to help me much as I still cannot get any values of $x$ for which $f'(x)=0$.
Can you help me with how to proceed from here? Or maybe a different method?
 A: Hints: 


*

*Note that the function $g:\mathbb{R}\to \mathbb{R}$ given by 
$$ g(x)~:=~{\rm sgn}(x) (e^{|x|}-1) ~=~-g(-x) $$
belongs to $C^1(\mathbb{R})$, and the derivative
$$ g^{\prime}(x)~=~e^{|x|} $$
is related to OP's integrand.

*So OP's function $f:\mathbb{R}\to \mathbb{R}$ also belongs to $C^1(\mathbb{R})$,
$$ f(x)~:=~\int_0^1 \! dt~ g^{\prime}(t-x)
~=~ \left[g(t-x)\right]^{t=1}_{t=0}
~=~ -\left[g(x-t)\right]^{t=1}_{t=0}$$ 
$$~=~ -\left[{\rm sgn}(x-t) (e^{|x-t|}-1)\right]^{t=1}_{t=0}. $$

*The derivative 
$$ f^{\prime}(x) ~=~ -\left[g^{\prime}(x-t)\right]^{t=1}_{t=0}
~=~ -\left[e^{|x-t|}\right]^{t=1}_{t=0} $$
is zero iff $x=\frac{1}{2}$.

*So the potential candidates for the maximum points are at $x=\frac{1}{2}$ and at the end-points $x=0$ and $x=1$. We leave it to the reader to determine which.
A: First, by letting $u=1-t$, you will find that $f(x)=f(1-x)$, so $f$ is symmetric in $x=1/2$.
Now let $0<x\leq 1/2$. Then (let $u=x-t$)
$$
\int_0^x e^{|t-x|}\,dt=\int_0^x e^{|t-0|}\,dt.
$$
On the other hand
$$
\int_x^1 e^{|t-x|}\,dt < \int_x^1 e^{|t-0|}\,dt
$$
since $|t-x|<|t-0|$ on that interval. Thus
$$
\int_0^1e^{|t-x|}\,dt<\int_0^1e^{|t-0|}\,dt
$$
for all $0<x\leq 1/2$.
It follows that the maximum is attained at $x=0$ (and $x=1$ because of the symmetry), and it is
$$
\int_0^1 e^{|t-0|}\,dt = e-1.
$$
A: Here is a non-technical answer, just based on visualizing the function. It might not satisfy everyone, but I find that sometimes it helps to think this way first and use it to guide your understanding of how you would compose a more formal answer.
You are integrating a symmetric V-shaped function, where the vertex of the V is at $t=x$. You are free to move that vertex left or right to anywhere with $x\in[0,1]$. Because of the V-shape, it's clear that the largest area is obtained with the vertex at either end.
Note that these thoughts might remind me that I'm not necessarily looking for some place with $f'(x)=0$. I can see now that the answer involves $x$ at the edge of the domain, not an $x$ with $f'(x)=0$.
