Dealing with the logarithm of absolute value when solving $u_t+xu_x=1$ by method of characteristics I was trying to come up with a solution to the PDE IVP problem $u_t + x u_x =1$, $u(x,0) = f(x)$. Here's how I went about it:
We can the following relations by applying the Method of Characteristics:


*

*$\frac{du}{dt} = 1$, $\frac{du}{dx} = \frac{1}{x}$, $\frac{dt}{dx} = \frac{1}{x}$. So we get: $u=t+C_1$, $u=\ln\lvert x\rvert+C_2$, $t=\ln\lvert x\lvert + C_3\implies t-\ln\lvert x\lvert = C_3$.


Since $C_2$ depends on $C_3$, we get the following: $G(C_3) := C_2(C_3) = G(t-\ln\lvert x\lvert)$, $u(x, 0)= f(x) = \ln\lvert x\lvert+G(-\ln\lvert x\lvert)$ so $G(-\ln\lvert x\lvert)= f(\frac{1}{e^{-\ln\lvert x\lvert)}})-\ln\lvert x\lvert$.
Thus $u(x,t) = 2\ln\lvert x\lvert + f(e^{\ln\lvert x\lvert-t})+t$.
I'm concerned, however, because $f(x)\ne f(\lvert x \lvert)$ for $x\in \mathbb{R}$.
 A: The underlying problem is  that the formula $\int \frac1x \,dx =  \ln |x| +C$ is not quite correct. The correct general form of   the antiderivatives of $1/x$ is
$$\begin{cases} \ln x + C_1,\quad & x>0 \\ \ln (-x) + C_2,\quad & x<0\end{cases}$$ 
There's no reason for $C_1$ and $C_2$ to be the same constant. 
I'll explain how this is relevant, but first let's look at the problem geometrically. When solving a PDE using characteristics, it is highly recommended to sketch the characteristics. In this case, they satisfy $dx/dt = x$, so the curves are exponentials: $x = Ce^t $. This is a better form than the one with logarithm: for one thing, it includes the solution $x\equiv 0$ which you lost. Some characteristics go to the left ($C<0$), some go to the right ($C>0$), one stays in place ($C=0$). 
The implicit form of characteristics is $xe^{-t}=C$, and therefore the general   solution of the homogeneous PDE $u_t+xu_x=0$  is $$u(x,t) = G(xe^{-t})$$ 
At this point, I'd just add a particular solution $u(x,t) = t$ (easily guessed), and equate the initial condition to obtain the final answer for the nonhomogeneous equation,
$$u(x,t) = t+f(xe^{-t})$$ 

So, why didn't $t-\ln |x|=C$ work? Because this equation describes not just one curve, but two disjoint curves. The sloppy integration of $1/x$ declares two constants to be the same, for no good reason; and as a result, you declared two different characteristic curves to be the same. 
