I have been studying PDEs using Peter Olver's textbook. I have learnt how to solve equations such as $u_t + 2u_x = \sin(x)$ subject to an initial condition such as $u(0,x) = \sin x$. Letting $\epsilon = x - 2t$ and $u(t,x) = v(t,\epsilon)$, I then plug this into the transport equation.
However, I am not sure how to define a characteristic to solve the following equation
$$u_t + xu_x + u = 0, \qquad u(x_0, 0) = \cos(x_0)$$
because it has a variable 'speed' term $x$ and it is also not homogenous because of the term $u$.
A solution would be very helpful so I can see how to approach these problems.