If $X \sim$ unif$(0,1)$, what is the distribution of $U=\max \{X,1-X \}$? Let $X$ be uniformly distributed in $(0,1)$ and set $U=\max \{X, 1-X\}$. How can I find the distributiopn of $U$?
My first thought was to consider this a mixture distribution problem and use the CDF technique as follows:
$$F_U (u)= P\left( U \leq u \right)=P\left( U \leq u , U=X \right) +P\left(U \leq u, U=1-X \right)$$
and then proceed accordingly.
That approach turns out to be incorrect but I do not quite understand why. 
I would be grateful therefore if someone could firstly point out the gap in my syllogism above and then present an appropriate way to deal with this kind of problems.'
Thank you.
 A: $U$ is not a mixture of $X$ and $1-X$ because they are not independent.

One general way to deal with such problems, when a random variable $X$ is transformed according to some definite procedure into another random variable $U$, is to compute the cumulative distribution function (CDF) of $U$.  To illustrate, let's do that with this example.
The first step is to find the support of the new variable: what values can it take on? Because almost surely $X\in [0,1]$, we compute that $U\in [1/2,1]$.  An easy way to carry out this calculation is to plot the graph of $u = \max(x, 1-x)$ for $0\le x\le 1$ and inspect the range of heights it attains.

The range of this graph spans all $u$ values between $1/2$ and $1$: those are the ones for which the CDF must be calculated.
The second step is to compute the CDF for arguments in the support.  This usually proceeds in two stages.


*

*Substitute a function of $X$ in place of $U$. The CDF of $U$ for  $u\in[1/2,1]$ is, by definition,
$$F_U(u) = \Pr(U \le u) = \Pr(\max(X, 1-X)\le u).$$

*Evaluate the chance of the resulting event.  This usually requires some algebraic manipulation but often does not require any use of probability or Calculus.  Here
$$\{x \big| x\le u, 1-x\le u\} = \{x \big|1-u \le x\le u\} = [1-u, u].$$
Putting these two results together (plugging (2) into (1)) yields
$$F_U(u) = \Pr(X\in [1-u,u]) = F_X(u) - F_X(1-u) = u-(1-u) = 2u-1.$$
In some tricky cases (where $U$ has neither a continuous nor an entirely discrete distribution) it is important to evaluate the CDF at all real numbers.  (An example is worked out at Distribution function of maximum of n iid standard uniform random variables....) In the present case, because the values just computed for $F_U(u)$ range from $0$ at $u=1/2$ through $1$ at $u=1$ and any CDF must be a nondecreasing function, the remaining values of $F_U$ are completely determined: $F_U(u)=1$ for $u\gt 1$ and $F_U(u)=0$ for $u\lt 1/2$.
The job is done.  In many circumstances the resulting distribution might not be recognizable, but this one evidently is the CDF of a Uniform$(1/2,1)$ distribution.
A: $U=\max{\left(X,1-X\right)} \sim \mathcal{U}(0.5,1)$
Because if $X > 1-X$  (i.e. if $X > 0.5$), then $U \sim \mathcal{U}\left(0.5,1\right)$, and if $1-X > X$  (i.e. if $1-X > 0.5$), then $U \sim \mathcal{U}\left(0.5,1\right)$ also.
Plus, simulation:
X<-runif(100000)
U<-pmax(X,1-X)
hist(U)
