Evaluating $\int_0^1 \max (x, 1-x) dx$ I have a question related to definite integrals and series from this site here.
It is written that the definite integral of $\max(x,1-x)dx$ from $0$ to $1$ is equal to $\frac34$:
$$ \int_0^1 \max (x, 1-x) dx = \frac34$$
but I have question, there are two different cases (I don't consider when $x$ is between $0$ and $1$, because in this case it is undefined which one is maximum), but in the second case, if $x<0$, then it is clear that $1-x$ is  greater than $x$, so its integral is $x-x^2/2$, and after plugging values,we get $1/2$, and on the other hand, if $x>1$, then $x$ is maximum, its antiderivative is $x^2$ so we get $1/2$, so when is it equal to $3/4$? Please help me to understand this problem.
 A: Since $1-x\geq x$ when $x\leq1/2$ and $x\geq 1-x$ when $x>1/2$, we have
$$\max (x, 1-x)=\left\{
  \begin{array}{ll}
    1-x, & \hbox{if }x\leq1/2; \\
    x, & \hbox{if }x>1/2.
  \end{array}
\right.$$
Hence, 
$$\int_0^1 \max (x, 1-x) dx =\int_0^{1/2} \max (x, 1-x) dx +\int_{1/2}^1 \max (x, 1-x) dx$$
$$=\int_0^{1/2} (1-x)dx +\int_{1/2}^1 x dx=(x-\frac{x^2}{2})\Big|_0^{1/2}+\frac{x^2}{2}\Big|_{1/2}^1=\frac{3}{4}.$$
A: This integral, viewed as the area under the graph of a function, is just the area of a square minus the area of a triangle---that's what the graph of the function looks like.  So
$$
(\text{base}\times\text{height}) - \left(\frac12\times\text{base}\times\text{height}\right) = (1\times1)-\left(\frac12\times 1\times\frac12\right)=1-\frac14=\frac34.
$$
A: This isn't that different from Paul's answer, but I wanted an excuse to use Iverson brackets. Recall that the Iverson bracket $[p]$ is equal to $1$ if condition $p$ is true, and $0$ if $p$ is false. We also have the relation $[\lnot p]=1-[p]$.
We then have
$$\begin{align*}
\max(x,1-x)&=x[x\geq 1-x]+(1-x)(1-[x\geq1-x])\\
&=1-x+(2x-1)\left[x\geq\frac12\right]
\end{align*}$$
Thus,
$$\begin{align*}
\int_0^1 \max(x, 1-x)\mathrm dx&=\int_0^1 \left(1-x+(2x-1)\left[x\geq\frac12\right]\right)\mathrm dx\\
&=\int_0^1 (1-x) \mathrm dx+\int_0^1 (2x-1)\left[x\geq\frac12\right]\mathrm dx\\
&=\int_0^1 (1-x) \mathrm dx+\int_{\frac12}^1 (2x-1)\mathrm dx\\
&=\left.\left(x-\frac{x^2}{2}\right)\right|_0^1+\left.\left(x^2-x\right)\right|_{\frac12}^1=\frac12+\frac14=\frac34
\end{align*}$$
