# Solve by direct integration

$$\frac{\partial^2 z}{\partial x^2}+z=0$$, given that at $$x=0, z=e^y$$ and $$\frac{\partial z}{\partial x}=1$$

I am doing it in following way:

Integrating w.r.t x twice

$$\implies \frac{\partial z}{\partial x} +zx=f(y)$$, where f(y) is an arbitrary function ...(1)

$$\implies z +\frac {zx^2}{2}=xf(y)+g(y)$$, where g(y) is an arbitrary function ...(2)

Putting $$x=0, z=e^y$$ and $$\frac{\partial z}{\partial x}=1$$ in (1) and (2)

$$\implies e^y=g(y)$$ and $$f(y)=1$$

$$\implies z(1+\frac {x^2}{2})=x+e^y$$

But the answer to this question is given as $$z=sinx+e^ycosx$$.

Can someone tell me how to solve this PDE by direct integration only?

• $z$ is supposed to be a function of $x$. The integral of $z$ w.r.t. $x$ is not $zx$. Commented Dec 15, 2019 at 5:15

Just pretend that $$y$$ is a constant and solve the equation as if $$z$$ is a function of $$x$$ alone. Then the solution is $$A \cos x+B\sin x$$ where $$A$$ and $$B$$ are constants. Now if you consider $$y$$ as a variable then you have to replace $$A$$ and $$B$$ by functions of $$y$$. The initial conditions easily give you $$A=e^{y}$$ and $$B=1$$ so the solution is $$e^{y} \cos x+\sin x$$.
• The general solution of the ODE $y''+y=0$ is $y=A\cos x+B\sin x$. I am assuming that you know this already since this is only an ODE and only one variable calculus is involved. @ShivaneeGupta Commented Dec 15, 2019 at 5:31