Solving a Cauchy Problem using Method of Characteristics I came across a partial differential equation (IVP PDE) that I would like to solve:

$$\{u_y+\cos(ky)u_x=ax^2 | u(x,0)=0\}$$

This should be a quasilinear PDE, and is in the format of a Cauchy Problem, in the form of:

$$au_x+bu_y=c$$
Such that a, b, and c are constants.

In my particular case, I have:

$$
\left\{ 
\begin{array}{c}
a=\cos(ky) \\ 
b=1 \\ 
c=ax^2
\end{array}
\right. 
$$
Using the Lagrange-Carpit Equations: $$\frac{dx}{\cos(ky)}=\frac{dy}{1}=\frac{du}{ax^2}$$
Rearranging gives: $$\frac{dx}{dy}=\cos(ky)$$
$$dy=\frac{du}{ax^2}$$
I then canclulated $dx-dy$:
$$du=(ax^2\cos(ky)+1)dy-dx$$
Integrate to obtain $u(x,y,a,k)$:
$$u(x,y,a,k)=\frac{1}{k}ax^2\sin(ky)+y-x+C_1$$
I applied the initial condition of $u(x,0)=0$ and made $x=0$, which gave $C_1=0$.
The question is thus finalised.

This however does not look correct. Am I doing the right thing?
I would also like to see what the characteristic curves look like, what are these? Are they essentially the terms $a, b, c$ I obtained above? Or rather, I simply differentiate those three variables in terms of $s$. Essentially calculating $\frac{dy}{ds}$, $\frac{dx}{ds}$ and $\frac{dz}{ds}$.
 A: The integration you performed is not correct as $x$ has dependence on $y$ (in fact, the first equation tell us how they are related).
Nevertheless, we can integrate the equations. Further, we get an explicit expression for $u$. I take as starting point these equations:
$$\frac{dx}{\cos(ky)}=\frac{dy}{1}=\frac{du}{ax^2}$$
From them:
$dx=dy\cos(ky)$ and $\dfrac{ax^2dx}{\cos(ky)}=du$ From the first one,
$x+c_1=\dfrac{1}{k}\sin(ky)$ or $c_1=\dfrac{1}{k}\sin(ky)-x$
From here, we can write the cosine as function of $x$ to integrate the second one:
$\sqrt{1-k^2(x+c_1)^2}=\cos(ky)$
Substituting into the second one
$\dfrac{ax^2dx}{\sqrt{1-k^2(x+c_1)^2}}=du$
And integrating:
$$u+c_2=\dfrac{a\left((2k^2c_1^2+1)\arcsin(k(x+c_1))+k(3c_1-x)\sqrt{1-k^2(x+c_1)^2}\right)}{2k^3}$$
Eliminating $c_1$
$$u+c_2=\dfrac{a\left(\left(2k^2\left(\dfrac{1}{k}\sin(ky)-x\right)^2+1\right)y+\left(\dfrac{3}{k}\sin(ky)-4x\right)\cos(ky)\right)}{2k^2}$$
At last, considering that $c_2=f(c_1)$ with $f$ a single argument differentiable function, the general solution is:
$$u(x,y)=\dfrac{a\left(\left(2k^2\left(\dfrac{1}{k}\sin(ky)-x\right)^2+1\right)y+\left(\dfrac{3}{k}\sin(ky)-4x\right)\cos(ky)\right)}{2k^2}-f\left(\dfrac{1}{k}\sin(ky)-x\right)$$
Now, the boundary conditions $u(x,0)=0$ impose some restriction for $f$:
$$u(x,0)=\dfrac{-2ax}{k^2}-f(-x)=0$$
So $f(x)=\dfrac{2ax}{k^2}$ and
$$u(x,y)=\dfrac{a\left(\left(2k^2\left(\dfrac{1}{k}\sin(ky)-x\right)^2+1\right)y+\left(\dfrac{3}{k}\sin(ky)-4x\right)\cos(ky)\right)}{2k^2}-\dfrac{2a}{k^2}\left(\dfrac{1}{k}\sin(ky)-x\right)$$
$$u(x,y)=\dfrac{a}{2k^2}\left(\left(2k^2\left(\dfrac{1}{k}\sin(ky)-x\right)^2+1\right)y+\left(\dfrac{3}{k}\sin(ky)-4x\right)\cos(ky)-\left(\dfrac{1}{k}\sin(ky)-x\right)4\right)$$
A: This is not just a quasilinear PDE - it is in fact simply linear, as it is of the form
$$a(x,y)\partial_x u(x,y)+b(x,y)\partial_yu(x,y)=c(x,y)$$
In particular,
$$\begin{cases}
\cos( ky) \partial _{x} u( x,y) +\partial _{y} u( x,y) =ax^{2}\\
u( r,0) =0
\end{cases}$$
So the method of characteristics is fairly routine here. We have a triple of what are technically speaking partial differential equations, but can be solved as ordinary differential equations.
$$\begin{cases}
\partial _{s} x( r,s) =\cos( k\cdotp y( r,s)) & x( r,0) =r\\
\partial _{s} y( r,s) =1 & y( r,0) =0\\
\partial _{x} z( r,s) =a\cdotp x( r,s)^{2} & z( r,0) =0
\end{cases}$$
Fortunately, these equations can be decoupled. One can notice immediately that $y=s$, giving
$$\partial_sx(r,s)=\cos(ks)\implies x(r,s)=\frac{1}{k}\sin(ks)+f_1(r)$$
And our initial condition gives
$$x(r,s)=\frac{1}{k}\sin(ks)+r.$$
Hence,
$$\partial_s z(r,s)=a\left(\frac{\sin^2(ks)}{k^2}+\frac{2r\sin(ks)}{k}+r^2\right)$$
Which we can integrate directly as
$$z(r,s)=a\left(\frac{1}{k^2}\left(\frac{s}{2}-\frac{\sin(2ks)}{4k}\right)-\frac{2r\cos(ks)}{k^2}+sr^2\right)+f_3(r)$$
Since our initial condition is $z(r,0)=0$ we plug $s=0$ in:
$$a\left(\frac{1}{k^2}\left(\frac{0}{2}-\frac{\sin(2k\cdot 0)}{4k}\right)-\frac{2r\cos(k\cdot 0)}{k^2}+0\cdot r^2\right)+f_3(r)=0$$
Giving
$$f_3(r)=\frac{2ar}{k^2}$$
This gives us the implicit relations
$$\begin{cases}
x=\frac{\sin( ks)}{k} +r\\
y=s\\
z=a\left(\frac{1}{k^{2}}\left(\frac{s}{2} -\frac{\sin( 2ks)}{4k}\right) -\frac{2r\cos( ks)}{k^{2}} +sr^{2}\right) +\frac{2ar}{k^{2}}
\end{cases}$$
The second line is rather fortunate and allows us to say
$$s(x,y)=y$$
Which gives
$$r(x,y)=x-\frac{\sin(ky)}{k}$$
Finally,
$$u(x,y)=z(r(x,y),s(x,y))$$
So,
$$u(x,y)=\frac{a}{4k^3}\left(4k^3x^2y-8\sin(ky)(k^2xy+1)-8kx\cos(ky)+4k(2x+y)+3\sin(2ky)-2ky\cos(2ky)\right)$$
You can check the solution with Mathematica, Maple, etc to confirm it is correct.
BONUS: Here is a plot of the solution for $a=1,k=1$ in the range $x,y\in[-10,10]$.

