Solve $\displaystyle \frac{\partial^2 z}{\partial x^2}+z=0$, given that when $x=0$, $z=e^y$ and $\displaystyle \frac{\partial z}{\partial x}=1$.
My Attempt: Integrating w.r.t x twice (keeping y constant)
$\displaystyle \frac{\partial z}{\partial x}+xz=f(y)$
$\displaystyle z+\frac{x^2}{2}z=xf(y)+g(y)$
The problem has a hint given : start with $\displaystyle z=f(y)\sin x+g(y)\cos x$. Uisng this obviously helps.
But if I go the standard way, I get stuck.. Am I missing something here or do I just memorise this hint and hope for the best.
Notice that you cannot integrate the way you did since $z$ is the dependent variable of your problem and therefore cannot be treated as a simple constant, just like you did in the $xz$ term.
You may want to try solutions of the form (since the PDE does not depend on $y$):
$$z(x,y) = C e^{qx},$$ which after substituting back into the PDE yields:
$$q^2 + 1 = 0, $$ and therefore we have $q = \pm i$, so the set of solutions is hence described by:
$$z(x,y) = C_1(y) \sin{x} + C_2(y) \cos{x},$$ where $C_{1,2}$ are arbitrary functions of $y$, which remains to be fixed by some boundary conditions. I'm sure you can now solve for $C_1$ and $C_2$ with the given information.
Hope this helps.
Edit: notice that I just treated $y$ as a constant, because the PDE is independent from $y$, and can be solved like a classical ODE with constant coefficients. I said nothing regarding $C$, but it naturally becomes $y$-dependent through the boundary conditions. Also notice that this is not the general approach to solve PDEs but it's heavily faster in this cases.
Cheers!