Solving $tu_t + u_x = x$, $u(t,0) = t^2$

Another approach consists in using Laplace transform.

Let $U(t,s)$ be the LT of $u(t,x)$. The eq. writes in Laplace domain $$ tU_t(t,s)+ [s U(t,s)- U(t,0)] = \frac{1}{s^2} $$ Rearranging terms, and denoting $y(t)=U(t,s)$, we obtain the first order differential equation with non constant coefficients $$ y' + \frac{s}{t} y = \frac{1}{s^2 t} + t $$

After multiplying on both sides by the integrating factor $\mu =e^{\int \frac{s}{t} dt} =t^s$, we obtain $$ t^s y' + st^{s-1} y = [t^s y]' = \frac{t^{s-1}}{s^2} + t^{s+1} $$ this gives after integration $$ t^s y = \frac{t^s}{s^3} + \frac{t^{s+2}}{s+2} + C $$ Finally the solution is $$ y(t) =U(t,s) =\frac{1}{s^3} + \frac{t^2}{s+2} $$ The constant is null because of the finite initial condition.

Back in space, we finally obtain $$ U(t,x)= \frac{x^2}{2}+t^2 e^{-2x} $$


The error here comes from solving the third equation "simultaneously". TDLR - The third equation should be understood as $x$ is an undetermined function (ie not fixed). (What you did was to assume that $x$ is fixed and did the integration directly.)

Details:

For the third equation, $$\frac{\mathrm{d}u(r,s)}{ds} = x$$ should be understood as $$\frac{\mathrm{d}u(r,s)}{ds} = x(r,s)$$ as we are looking at a system of ordinary differential equations here. In fact, to be understood as ODEs, this does not even make sense unless we treat $r$ as a constant.

The way in which I understand how the method of characteristic works is that it is basically a result of the multivariate chain rule. Since $u = u(t,x)$ is assumed to take such a form, we parameterize $t$ and $x$ by a common parameter (say $s$). This implies that $t(s)$ and $x(s)$ (that is, $t$ and $x$ both depends on a single variable, $s$). Looking back at our $u$ dependence explicitly, we have $$u = u(t(s),x(s)).$$

Now, we proceed to apply the multivariate chain rule as we differentiate $u$ with respect to $s$ as follows.

$$\frac{\mathrm{d}}{\mathrm{d}s}u(t(s),x(s)) = \frac{\partial u(x,s)}{\partial t}\frac{\mathrm{d}t(s)}{\mathrm{d}s} + \frac{\partial u(x,s)}{\partial x}\frac{\mathrm{d}x(s)}{\mathrm{d}s}.$$

In the equation above, I have explicitly written the "correct" dependence of each of the functions on their corresponding variables. Now, under such a method, we hope that the left-hand side of the PDE can be written as $\frac{\mathrm{d}}{\mathrm{d}s}u(t(s),x(s))$. This implies that we should have

$$\begin{aligned} \frac{\mathrm{d}t(s)}{\mathrm{d}s} &= t \\ \frac{\mathrm{d}x(s)}{\mathrm{d}s} &= 1 \end{aligned}$$

such that the left-hand side of the given PDE is now $$\frac{\mathrm{d}u(s)}{\mathrm{d}s} =\frac{\mathrm{d}u(x(s),t(s))}{\mathrm{d}s} = x(s). $$ The redundant equality above is to emphasize that we can view $u$ as a function of $s$, which is obtained by viewing $u$ as a function of $x$ and $t$, each as a function of $s$. From this equation above, it is clear that $$u = xs + c_3 $$ as you have suggested would not have been the solution (as that is not the correct way to solve this ODE).