I am trying to use the method from my previous question to solve this PDE: $$ 3u_x + 2u_t = \cos x $$
with initial condition $u(x,0) = x^2$.
So I need to solve these:
\begin{align} \frac{dx}{ds} &= 3 &\implies x &= 3s + x_0 \\ \frac{dt}{ds} &= 2 &\implies t &= 2s + t_0\\ \frac{du}{ds} &= \cos x \end{align}
To integrate the last one, I use the chain rule backwards since $x$ is a function of $s$:
\begin{align} u &= \sin x \frac{ds}{dx} + u_0 \\ &= \frac{1}{3} \sin x + u_0 \end{align}
Which appears to differentiate again properly, but continuing along these lines (AWLOG $t_0 = 0 \implies x_0 = x - \frac{3t}{2}$, and take $u = \frac{1}{3} \sin x + u_0 = \frac{1}{3} \sin x + u(x - \frac{3t}{2}, 0) = \frac{1}{3}\sin x + {\left(x - \frac{3t}{2}\right)}^2$.
But the given answer is actually:
$$ u = {\left(x - \frac{3t}{2}\right)}^2 - \frac{1}{3}\sin{\left(x - \frac{3t}{2}\right)} + \frac{1}{3} \sin x$$
What have I done wrong here?
$$3u_x+2u_t=\cos(x)$$ HINT :
The equations characteristics are : $$\frac{dx}{3}=\frac{dt}{2}=\frac{du}{\cos(x)}$$
First characteristic :
$\frac{dx}{3}=\frac{du}{\cos(x)} \quad\to\quad 3du-\cos(x)dx=0 \quad\to\quad u-\frac{1}{3}\sin(x)=c_1$
Second characteristic :
$\frac{dx}{3}-\frac{dt}{2}=0 \quad\to\quad 2x-3t=c_2$
General solution on implicite form, with any derivable function $\Phi$ of two variables :
$$\Phi\left(u-\frac{1}{3}\sin(x)\:,\:2x-3t\right)=0$$
With any derivable function $F$, this is equivalent to : $\quad u-\frac{1}{3}\sin(x)=F(2x-3t)$ $$u(x,t)=\frac{1}{3}\sin(x)+F(2x-3t)$$
The boundary condition $u(x,0)=x^2$ implies : $x^2=\frac{1}{3}\sin(x)+F(2x)$ . This defines the function $F(X)= -\frac{1}{3}\sin(\frac{X}{2})+\frac{X^2}{4}$ $$u(x,t)=\frac{1}{3}\sin(x)-\frac{1}{3}\sin\left(\frac{2x-3t}{2}\right)+\left(\frac{2x-3t}{2}\right)^2$$
With comparison with what you did, you certainly will see where is the discrepancy. The same for the second example. If there is still some difficulty, please ask again you are welcome.
In addition, after comments :
The comparison shows the next discrepancies :
$u(x,0)=\frac{1}{3}\sin(x)+u_0\quad$ is true on the characteristic curve, but not elswhere for $x\neq 0\quad $. The correct expression is : $$u(x-\frac{3t}{2}\:,\:0)=\frac{1}{3}\sin(x-\frac{3t}{2})+u_0$$ with $\quad u(x-\frac{3t}{2}\:,\:0)=\left(x-\frac{3t}{2}\right)^2$ $$u_0=\left(x-\frac{3t}{2}\right)^2-\frac{1}{3}\sin(x-\frac{3t}{2})$$ $$u(x,t)=\frac{1}{3}\sin(x) + \left(x-\frac{3t}{2}\right)^2 -\frac{1}{3}\sin\left(x-\frac{3t}{2}\right)$$
Reponse to the question in comments :
The method used in my above answer is equivalent to the method that you use. For more details, see for example : https://www.math.ualberta.ca/~xinweiyu/436.A1.12f/PDE_Meth_Characteristics.pdf
Copy of the theorem (with change of notations for consistancy) :
Equation (2.40) means that $\Psi_1$ and $\Psi_2$ are related through arbitrary function, for example : $\Psi_1=F(\Psi_2)$ or $\Psi_2=G(\Psi_1)$.