# solving differential equation second order

Can anyone please explain me step by step how to solve this differential equation: \begin{align*} y'' + w^2 y &= 0 \\ y(a) &= A \\ y'(a) &= B \end{align*}

• could you say a bit more about the variables? – nathan.j.mcdougall Dec 16 '14 at 19:38
• it are all constants, and it's a equation of simple harmonic motion, as my book says – Peter Dec 16 '14 at 19:40
• I'm assuming that $y$ isn't a constant if it is differentiable... And with respect to what? $x$? – nathan.j.mcdougall Dec 16 '14 at 19:41
• That was not me, I will vote it up to prove it. Probably someone did it because you didn't lay out your question in LaTeX which makes it harder to read. – nathan.j.mcdougall Dec 16 '14 at 19:42
• yes I know that, I was talking to others in general. I do appreciate that you are trying to help – Peter Dec 16 '14 at 19:43

OK, here's a step-by-step guide to solving the equation

$y'' + w^2y = 0 \tag{1}$

with the initial conditions

$y(a) = A, \; \; y'(a) = B, \tag{2}$

under the assumption $0 \ne w \in \Bbb R$; when $w = 0$, we have a different, and simpler, situation.

The first step is to make an intelligent guess as to what the general form of the solution might be; this is often the most difficult thing to do. In this case, it helps to notice that (1) implies

$y'' = -w^2y; \tag{3}$

so we ask ourselves, what kind of functions $y(x)$ have the property that their derivatives are given by multiplication by a constant, which in this case is $-w^2$? The ready answer is, of course, exponential functions of the form $y(x) = e^{\mu x}$; so we take that as our first guess. And then . . .

We move on to our second step, which is to check and see how our provisional solution works out. To do this, we substitute $y(x) = e^{\mu x}$ into (1); since

$y''(x) = \mu^2 e^{\mu x}, \tag{4}$

we find that (1) now takes the form

$\mu^2 e^{\mu x}+ w^2 e^{\mu x} = 0, \tag{5}$

and since $e^{\mu x} \ne 0$ for all $x \in \Bbb R$, we may divide (5) through by $e^{\mu x}$ to obtain

$\mu^2 + w^2 = 0; \tag{6}$

we have thus converted our provisional solution $y(x) = e^{\mu x}$ to a polynomial (specifically, a quadratic) equation for $\mu$; certainly a more tractable problem. It remains to be seen, however, whether the progress we have made is along a road which ultimately leads to a solution to (1). But with courage in the face of uncertainty, we proceed to our

third step, and this one is easy! We solve (6) for $\mu$, obtaining

$\mu = \pm iw. \tag{7}$

Fourth step: we check to see if $y(x) = e^{\pm iwx}$ are in fact solutions to (1). With $y(x) = e^{iwx}$ we have

$y'(x) = iw e^{iwz} = iwy(x), \tag{8}$

$y''(x) = -w^2 e^{iwx} = -w^2 y(x); \tag{9}$

we thus see that $y(x) = e^{iwx}$ satisfies (3) and hence (1). In a similar manner we see that $y(x) = e^{-iwx}$ is also a solution to (1), (3).

Step the fifth: at this point, we need to draw upon the somewhat deeper theoretical fact that there are at most two linearly independent solutions to (1), (3); this fact is usually proved in more advanced courses, and taken on faith in the introductory ones, as we shall do here. Accepting this state of affairs, we note that the functions $e^{\pm i w x}$ are in fact linearly independent over $\Bbb C$, for if there were $0 \ne m_+, m_- \in \Bbb C$ with

$m_+ e^{i w x} + m_- e^{-iwx} = 0 \tag{10}$

then we would have

$m_+ e^{2i w x} + m_- = 0, \tag{11}$

or

$e^{2iwx} = \dfrac{-m_-}{m_+}, \tag{12}$

a constant; clearly an impossible situation. The linear independence of $e^{\pm iwx}$ in turn implies that any solution to (1), (3) is a linear combination of these two solutions, for if $f(x)$ is a third solution, the functions $f(x), e^{iwx}, e^{-iwx}$ are linearly dependent and this means we can write

$m_f f(x) + m_+ e^{iwx} + m_- e^{-iwx} = 0 \tag{13}$

for some $m_f, m_+, m_- \in \Bbb C$ not all zero (note that cannot have $m_f = 0$ by the linear independence of $e^{\pm iwx}$; (3) is precluded); (13) shows that $f(x)$ is a linear combination of the $e^{\pm iwx}$. Using this little bit of theory we see that any solution of (1) may be written in the form

$y(x) = m_+ e^{iwx} + m_- e^{-iwx}. \tag{14}$

Realizing (14) holds is the essence of the fifth step. Having this at hand, we turn to

Step the sixth: using (14) and the initial conditions (2), we solve for the coefficients $m_\pm$; from (14) we have

$y'(x) = iwm_+ e^{iwx} - iwm_- e^{-iwx}, \tag{15}$

and thus, via (2), we arrive at the following linear system for the coefficients $m_\pm$:

$m_+ e^{iwa} + m_- e^{-iwa} = y(a) = A, \tag{16}$

$iwm_+ e^{iwa} - iwm_- e^{-iwa} = y'(a) = B; \tag{17}$

it is then easy to see that

$2iwm_+ e^{iwa} = iwA + B, \tag{18}$

or

$m_+ = \dfrac{iwA + B}{2iw e^{iwa}}, \tag{19}$

and

$2iwm_- e^{iwa} = iwA - B, \tag{20}$

or

$m_- = \dfrac{iwA - B}{2iw e^{-iwa}}. \tag{21}$

We note that when $A, B \in \Bbb R$, then

$\bar m_+ = \dfrac{-iwA + B}{-2iw e^{-iwa}} = \dfrac{iwA - B}{2iw e^{-iwa}} = m_-, \tag{22}$

so we may write

$y(x) = m_+ e^{iwx} + \overline{m_+ e^{iwx}}; \tag{23}$

in this case, then, $y(x)$ is real; similar remarks apply to $y'(x)$; it, too, is real when $A, B \in \Bbb R$.

It is a matter of straightforward algebra, using the formulas (19) and (21) for $m_\pm$, and the Euler formula $e^{i\theta} = \cos \theta + i \sin \theta$, to express $y(x)$ as a linear combination of $\cos(x - a)$ and $\sin(x - a)$.

And so there it is, a step-by-step guide to solving (1), as per request.

Finally, it is worth noting that the substitution $y(x) = e^{\mu x}$ works for any linear ordinary differential equation with contstant coefficients, viz.

$\sum_0^n c_i\dfrac{d^i y}{dx^i} = 0, \tag{24}$

and yields a polynomial equation for $\mu$:

$\sum_0^n c_i\mu^i = 0; \tag{25}$

each root of (25) then becomes a solution $y(x) = e^{\mu x}$ of (24); that is not the entire tale, but it is a big part of it!

Hope this helps! Cheers!

And as ever,

Fiat Lux!!!

Work via assumed solution. Second order constant coefficient ODE's can be solved this way. $$y''+w^2y=0$$ LET: $y=e^{st}$ (Laplace transform). Also, since $w$ is a constant,$w^2$ is a constant. Therefore: $$y''+w^2\cdot y=0 \rightarrow s^2e^{st}+w^2e^{st}=0$$ Factor the $e^{st}$. $$e^{st}*\left(s^2+w^2\right)=0$$ Since we are interested in finite-time solutions to this ODE, we can drop the $e^{st}=0$ solution. $$s^2+w^2=0 \rightarrow s=\sqrt{-w^2}=\pm wi$$ Therefore, the complete solution is taken from either of the two solutions of the laplace equation. Let's take the positive one. $$y=e^{wi\cdot t}$$ Use the Euler identity to produce the sinusoidal version: $$y=\cos(wt)+i\sin(wt)$$

• $s^2 + w^2 = 0 \Rightarrow s = \pm iw$, not $s = \pm i\sqrt{w}$! Cheers! – Robert Lewis Dec 17 '14 at 8:18
• @RobertLewis, thanks! :) – FundThmCalculus Dec 17 '14 at 13:22
• You are more than welcome! – Robert Lewis Dec 17 '14 at 16:46