Solve $u_x+u_y=e^{x+2y}$ with $u(x,0)=0$ 
Solve $u_x+u_y=e^{x+2y}$ with $u(x,0)=0$

I have $dy/dx=1$ so $y=x+c$
then $v'(x)=u'(x,x+c)=e^{x+2(x+c)}$
I use separation of variables $\int dv=e^{2c}\int e^3x dx$
I get $v(x)=u(x,x+c)=\frac{1}{3}e^{3x}\cdot e^{2c}$
$u(x,y)=\frac{1}{3}e^{3x}\cdot e^{2y-2x}=\frac{1}{3}e^{x}e^{2y}$
But this doesn't satisfy the initial condition, $u(x,0)=\frac{1}{3}e^x=0$
implies $e^x=0$
What have I done wrong?
 A: You can use the method of characteristics. You have the system \begin{align*} x'(s) &= 1 \\ y'(s) &= 1 \\ z'(s) &= e^{x(s) + 2y(s)}\end{align*}
with initial data $x(0) = x_0$, $y(0) = 0$, and $z(0) = 0$. Thus $x(s) = s+x_0$ and $y(s) = s$ so that $z'(s) = e^{3s  + x_0}$ and thus (accounting for the fact $z(0) = 0$) $$z(s) = \frac 13 e^{3s + x_0} - \frac 13 e^{x_0} = \frac 13 e^{x_0} ( e^{3y} - 1).$$
A point $(x,y)$ along the characteristic curve satisfies $x = s + x_0$ and $y = s$ so that $x_0 = x - y$ and $$u(x,y) = z(s) = \frac 13 e^{x-y}(e^{3y}-1)= \frac 13 e^{x+2y} - \frac 13 e^{x-y}.$$
A: $$u_x+u_y=e^{x+2y} \tag 1$$
Of course it is easy to solve the problem thanks to the method of characteristics. But you can also solve it (in this case) with separation of variables.
In fact what you done wrong is to apply the separation of variables directly to the PDE, which is non-homogeneous, before reducing it to an homogeneous PDE.
First find a convenient particular solution. That is what you did. You found :
$$u_p(x,y)=\frac{1}{3}e^{x}e^{2y}$$
Then change of function $u=v+u_p$ :
$$u(x,y)=v(x,y)+\frac{1}{3}e^{x}e^{2y}$$
The PDE is transformed into :
$$v_x+v_y=0 \tag 2$$
The separation of variables with $v(x,y)=X(x)Y(y)$ leads to
$$X'Y+Y'X=0 \quad\implies\quad \frac{X'}{X}=-\frac{Y'}{Y}=\lambda=\text{constant}$$
$$X(x)=c_1e^{\lambda x}\quad\text{and}\quad Y(y)=c_2e^{-\lambda y}$$
$$v(x,y)=c \: e^{\lambda x}e^{-\lambda y}$$
$$u(x,y)=c \: e^{\lambda x}e^{-\lambda y}+\frac{1}{3}e^{x}e^{2y} \tag 3$$
Condition :
$$u(x,0)=0=c \: e^{\lambda x}e^{0}+\frac{1}{3}e^{x}e^{0} \quad\implies\quad \lambda=1\quad\text{and}\quad c=-\frac13$$
Puting them into Eq.3 leads to the solution :
$$u(x,y)=-\frac13 \: e^{ x-y}+\frac{1}{3}e^{x+2y}$$
