Compute the Hopf-Lax formula for a given PDE in Evans' book (pag. 135) there's the following example (already asked
in this site, but never answered):

Consider the initial-value problem
  \begin{cases}
u_t+\frac 12|Du|^2=0 & \text{in }\mathbb{R}^n \times (0,\infty) \\
\qquad \qquad \, \, \, \,  u = |x| & \text{on } \mathbb{R}^n \times \{t=0\} \tag{49}
\end{cases}
  The Hopf-Lax formula for the unique weak solution of $(49)$ is $$u(x,t)=\min_{y \in \mathbb{R}^n} \left\{\frac{|x-y|^2}{2t}+|y| \right\} \tag{50}$$
  Assume $|x| > t$. Then \begin{align}D_y \left(\frac{|x-y|^2}{2t} + |y| \right) = \frac{y-x}{t}+\frac{y}{|y|} & (y \not=0)\end{align}
  and this expression equals $0$ if $x=y+\frac{y}{|y|}t, y=(|x|-t)\frac{x}{|x|} \not=0$.
Thus $u(x,t)=|x|-\frac t2$ if $|x| > t$. If $|x| > t$, the minimum in $(50)$ is attained at $y=0$. Consequently $$u(x,t)=\begin{cases}|x|-\frac{t}{2} & \text{if }|x| > t \\ \qquad\frac{|x|^2}{2t} & \text{if }|x| \le t
\end{cases}$$

The thoery behind that formula is clear, but I really can't understand some steps.


*

*I can find $x=y+\frac{y}{|y|}t$ but how can I derive \begin{align} y=(|x|-t)\frac{x}{|x|} \end{align} I can't find it.

*How can I see a priori that I have to distinguish the cases $|x|\leq t$ and $|x| >t$ in order to find the minimum? 
 A: The expression for $y$ is only possible with the posed restrictions $|x|>t$ and $t>0$. So, the expresion for $x$ has to be read:
$$x=y+\frac{y}{|y|}t=
\begin{cases}
  y+t&\text{if}&y\geq 0 \land(x<-t\lor x>t)\\
  y-t&\text{if}&y<0\land(x<-t\lor x>t)
\end{cases}
$$
Considering that $x<-t\implies y<0$ and $x>t\implies y\geq0$, we can remove each one from its corresponding slot:
$$x=
\begin{cases}
  y+t&\text{if}&y\geq 0 \land x>t\\
  y-t&\text{if}&y<0\land x<-t
\end{cases}
$$
Now, as $x<-t\implies x<0$ and$x>t\implies x>0$, we can add the redundant condition to each slot
$$x=
\begin{cases}
  y+t&\text{if}&y\geq 0 \land x>t\land x>0\\
  y-t&\text{if}&y<0\land x<-t\land x<0
\end{cases}
$$
We see now a function that can be inverted as it is injective. We can isolate $y$ in the expressio for each branch:
$$y=
\begin{cases}
  x-t&\text{if}&y\geq 0 \land x>t\land x>0\\
  x+t&\text{if}&y<0\land x<-t\land x<0
\end{cases}
$$
remove the redundant conditions:
$$y=
\begin{cases}
  x-t&\text{if}&x>t\land x>0\\
  x+t&\text{if}&x<-t\land x<0
\end{cases}
$$
And sumarizing, with the restrictions implicitly granted:
$y=x-\dfrac{x}{|x|}t=(|x|-t)\dfrac{x}{|x|}$
