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.

  • $\begingroup$ Do you know how to solve higher order linear ordinary differential equations? $\endgroup$
    – M. Vinay
    Commented Jun 18, 2014 at 9:30
  • $\begingroup$ I am trying to learn .. baby steps $\endgroup$
    – square_one
    Commented Jun 18, 2014 at 9:40

2 Answers 2


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.



If you know how to solve higher order linear ODE, then you can just note that the PDE you have contains only derivatives with respect to $x$, so it is essentially a linear homogeneous ODE, with auxiliary equation $m^2 + 1 = 0 \Rightarrow m = \pm i$, for which the solution is $c_1\cos(x) + c_2\sin(x)$. As we actually have a PDE (with the only other independent variable being $y$), $c_1$ and $c_2$ should be functions of $y$ rather than pure constants.

If you want a "from scratch" solution, here goes...

Let $\partial_x = \dfrac{\partial}{\partial x}$. Then the given PDE is $\partial_x^2z + z = 0$, or $(\partial_x^2 + 1)z = 0$. This can be written as $(\partial_x + i)(\partial_x - i)z = 0$ (the validity of this factorization of the operator can be verified by actually carrying out the differentiations and verifying that this becomes the original equation - you will see that it is only a convenient notation). Thus we have to solve

$$(\partial_x + i)(\partial_x - i)z = 0$$

Let $(\partial_x - i)z = w$. Then the equation becomes

$(\partial_x + i)w = 0\Rightarrow\\ \partial_x w = -iw \Rightarrow\\ \dfrac{1}{w} \partial_xw = -i \Rightarrow\\ \partial_x (\log w) = -i \Rightarrow\\ \log w = -ix + C(y) \Rightarrow\\ w = c_1(y) e^{-ix} \qquad (\text{where we have written $e^{C(y)}$ as $c_1(y)$}) $

Now, as $(\partial_x - i)z = w$, we have

$ \partial_x z - iz = c_1(y)e^{-ix} = c_1 e^{-ix} \Rightarrow\\ \dfrac{\partial z}{\partial x} - iz = c_1 e^{-ix} $

This is a first order linear equation that can be solved using the integrating factor $e^{\int (-i)\, dx} = e^{-ix}$. Therefore:

$z\times \text{IF} = \displaystyle \int \text{RHS}\times \text{IF} \,dx \Rightarrow\\ z e^{-ix} = \displaystyle \int c_1 e^{-2ix} \,dx \Rightarrow\\ z e^{-ix} = c_1 \dfrac{e^{-2ix}}{-2i} + c_2 a = C_1 e^{-2ix} + C_2 \Rightarrow\\ z = C_1 e^{-ix} + C_2 e^{ix} \Rightarrow\\ z = C_1(\cos x - i \sin x) + C_2(\cos x + i \sin x) \Rightarrow\\ z = (C_1 + C_2) \cos x - i(C_1 - C_2) \sin x \Rightarrow\\ z = A \cos x + B \sin x $

Now as the equation is actually a PDE, $A$ and $B$ are functions of $y$, say $A = f(y)$ and $B = g(y)$. Thus

$$\boxed{z = f(y)\cos x + g(y) \sin x}$$

  • $\begingroup$ You should say here that $C_1$ and $C_2$ are complex conjugate (functions of $y$) and therefore $C_1 + C_2$ is real and $C_1 - C_2$ purely imaginary, so $A$ and $B$ are real (functions of $y$). $\endgroup$
    – Dmoreno
    Commented Jun 18, 2014 at 14:27
  • $\begingroup$ Not necessarily. $A$ and $B$ might be complex constants too (depending on the given conditions). Or complex valued functions of $y$, as the case may be. The conditions given in the OP result in a real solution. $\endgroup$
    – M. Vinay
    Commented Jun 18, 2014 at 15:12
  • $\begingroup$ Of course. I was confused with the solution of a real-coefficients ODE when the solutions of the characteristic equation are complex. Sorry! $\endgroup$
    – Dmoreno
    Commented Jun 18, 2014 at 15:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .