This question is example 1 page 139 Evans PDE book 2nd edition.
Consider the initial value problem:
\begin{cases} u_t+\left(\frac{u^2}{2} \right)_x =0 & \text{in }\mathbb{R}\times(0,\infty) \\ \qquad \qquad \, \, u=g & \text{on } \mathbb{R} \times\{t=0\} \end{cases}
with $$g(x)=\begin{cases} 1 & \text{if }x \leq 0 \\ 1-x & \text{if }0 \le x \le 1 \\ 0 & \text{if }x \geq 1 \end{cases}$$
Now using method of characteristic, we get the IVP: $\frac{dX}{dt}=u(X(t),t)$ $X(0)=x_0$ and we can show that $u$ is constant along the curve $X(t) = x_0 + g(x_0)t$. Given fixed $(x,t)$, the solution is $u(x_0)$, where $x_0$ is a function of $(x,t)$. In that example, all the steps are skipped and we arrive at the following solution for $t \leq 1$
$$u(x,t)=\begin{cases} 1 & \text{if }x \leq t \text{ , } t \leq 1 \\ \frac{1-x}{1-t} & \text{if }t \le x \le 1 \text{ , } t \leq 1 \\ 0 & \text{if }x \geq 1 \text{ , } t \leq 1 \end{cases}$$
Can someone help me fill in the blank here, as how to find $x_0$ as a function of $(x,t)$ and arrive at the function $u$ below?