# Problem with solving $u_x+xu_y=1$ using method of characteristics

I got an exercise in my PDE class which I'm struggling to solve.

Solve following eq using the method of characteristics $$u_x(x,y)+xu_y(x,y) = 1 \qquad (x,y) \in \mathbb{R}^2$$ $$u(3,y) = y^2 \qquad y \in \mathbb{R}$$

My approach was :
To find characteristics solve $$(x'(t),y'(t)) = (1,x(t))$$
So I got $$\quad x(t) = t+x_o; \quad y(t) = \frac{1}{2}t^2+x_0t+y_0$$
Now we want our characteristics to start at a curve where we know the value of $$u$$, hence start at $$\Gamma = \{ (3,s) : s \in \mathbb{R} \}$$.
We get $$\quad x_0 = 3 ; \quad y_0 = s$$

Now $$u'(x(t),y(t)) = u_x(x(t),y(t)) + x(t)u_y(x(t),y(t)) = 1$$ hence $$u(x(t),y(t)) = t+ u_0$$ where $$u_0 = s^2$$
So we get $$u((t+3),(\frac{1}{2}t^2+3t+s)) = s^2 +t$$

I couldn't find an easy way to calculate the equation for $$u$$. This is the point where I started wondering, if everything was alright.

My approach to solve this would be using polynomial division but I think thats not the point of the exercise.

Your solution $$u\left( {t + 3,\;t^2 /2 + 3t + s} \right) = s^2 + t$$ is correct.
You just have to complete it by putting $$\left\{ \matrix{ x = t + 3 \hfill \cr y = {{t^{\,2} } \over 2} + 3t + s = {1 \over 2}t\left( {t + 6} \right) + s = {1 \over 2}\left( {x - 3} \right)\left( {x + 3} \right) + s \hfill \cr} \right.$$ and invert it (the trick is to convert $$t$$ in $$x$$, without passing through the square root ..) to obtain $$\left\{ \matrix{ t = x - 3 \hfill \cr s = y - {1 \over 2}\left( {x - 3} \right)\left( {x + 3} \right) = y - {1 \over 2}x^{\,2} + {9 \over 2} \hfill \cr} \right.$$ and thus $$s^{\,2} + t = \left( {y - {1 \over 2}x^{\,2} + {9 \over 2}} \right)^{\,2} + \left( {x - 3} \right) = u\left( {x,y} \right)$$

You can easily countercheck that you get $$\left\{ \matrix{ u_{\,x} = 1 + x^{\,3} - 2xy - 9x = 1 + x\left( {x^{\,2} - 2y - 9} \right) \hfill \cr u_{\,y} = - \left( {x^{\,2} - 2y - 9} \right) \hfill \cr} \right.$$ which respect the given conditions $$\left\{ \matrix{ u_{\,x} + x\,u_{\,y} = 1 \hfill \cr u(3,y) = y^{\,2} \hfill \cr} \right.$$

First, we can drop $$x_0$$ as it doesn't entail the graph of the curves to change, then apply the initial conditions.

$$\quad x(t) = t; \quad y(t) = \frac{1}{2}t^2+y_0; \quad u(t)=t+u_0$$

$$y= \frac{1}{2}x^2+y_0; \quad u=x+u_0$$

Now $$u(3,y)=y^2$$, so is $$3+u_0=\left(\frac{1}{2}3^2+y_0\right)^2$$, bringing us the desired relation between $$y_0$$ and $$u_0$$... to get rid of them!

$$y_0=y-\frac{1}{2}x^2; \quad u_0=\left(\frac{1}{2}3^2+y_0\right)^2-3$$

$$u=x+\left(\frac{1}{2}3^2-\frac{1}{2}x^2+y\right)^2-3$$

It's inhomogeneous so we need two parts: the homogeneous solution and a particular solution.

For the homogeneous part, we use $$v$$ as the variable. With characteristics you are solving $$\frac{dy}{dx} = \frac{x}{1}$$, i.e. $$y = \frac{1}{2}x^2 + C$$. That's because $$v$$ must be constant on these characteristic curves $$(1,x)$$.

Now this implies that $$v$$ relies only on the value of $$C$$. Hence $$v(x,y) = f(C)$$. Since $$C = y - \frac{1}{2}x^2$$, so we get $$v(x,y) = f\left(y - \frac{1}{2}x^2\right).$$ Now with $$v(3,y) = y^2$$, we get $$f(y-4.5) = y^2$$. Substituting $$t = y-4.5$$ we arrive at $$f(t) = (t+4.5)^2.$$ Hence we have $$v(x,y) = \left(\left(y - \frac{1}{2}x^2\right) + \frac{9}{2}\right)^2.$$

For the particular solution, $$v_0(x,y) = x$$ fits the bill.

Hence the solution is $$u(x,y) = v_0(x,y) + v(x,y) = x + \left(\left(y - \frac{1}{2}x^2\right) + \frac{9}{2}\right)^2.$$