# ODE $d^2y/dx^2 + y/a^2 = u(x)$

Does the following ODE:

$$d^2y/dx^2 + y/a^2 = u(x)$$

have a solution? where $u(x)$ is the step function and a is constant.

#### Solutions Collecting From Web of "ODE $d^2y/dx^2 + y/a^2 = u(x)$"

Your source term, $u(x)$, is a piecewise continous function in $x \in \mathbb{R}$ and is therefore integrable. Since the particular solution of your ODE can be computed as (check it*):

$$y_p(x) = \frac{1}{y_1} \iint u \, y_1 \, \mathrm{d}x^2 = y_1 \int \frac{1}{y^2_1}\left[ \underbrace{\int u y_1 \, \mathrm{d}x}_{=Y_1u(x)} \right] \, \mathrm{d}x, \tag{1}$$ where $y_1$ is one of the two fundamental solutions of the homogenous part of the ODE and $Y_1$ a primitive, I would say that this integral exists, since $u \, y_1$ is an integrable function over $x$.

SPOILER:

The solution is given by:

$$\color{blue}{y(x) = A_1 \sin{x/a} + A_2 \cos{x/a} + y_p(x) } \tag{2}$$

Furthermore, note that none of this is necessary since the non-homogeneous term is a constant given by $u(x) = 1$ if $x>0$ and $u(x) = 0$ otherwise. If we suppose that $y_p(x) = C$ and substitute back in the ODE, we would have:

$$\color{blue}{C = \left\{ \begin{array}{ll} 0 & \text{if } x < 0 \\ a^2 & \text{if } x > 0 \end{array} \right.}$$ or, equivalently, $\color{blue}{y_p(x) = a^2 u(x)}$.

Edit:

This solution is obtained via the method of variation of parameters (you can see here an example) as follows:

• Let $y_1(x) = \sin{x/a}$ and $y_2(x) = \cos{x/a}$ be the solutions of the homogenous part of the equation $\mathcal{L}[y_h] = y”_h+ y_h/a^2 = 0$.

• Assume the complete solution is of the form $y(x) = A(x) y_1$, thus $y” = A” y_1 + 2 A’y’_1 + A y_1”$ and hence, substituting back in the ODE $\mathcal{L}[y] = u(x)$ we have, after dividing by $y_1 \neq 0$:
$$A” + A’ \frac{2 y_1′}{y_1} + A \frac{1}{y_1}\underbrace{(y_1” + y_1/a^2 )}_{= \mathcal{L}[y_1] = 0} = \frac{u}{y_1}$$

• Note that we have a first order linear differential equation for $A’$ which we can solve using an integrating factor (see here), $I(x) = \exp{\int 2y’_1 \, \mathrm{d}x /y_1}$:
$$\frac{\mathrm{d}}{\mathrm{d}x} \left(y_1^2 \, A’ \right) = u y_1,$$
so:
$$A’ = \frac{1}{y_1^2} \int u\, y_1 \, \mathrm{d}x + \frac{A_2}{y_1^2}, \tag{3}$$ with $A_2$ a constant of integration. This yields to:
$$A = \int{ \left[ \frac{1}{y_1^2} \int u\, y_1 \, \mathrm{d}x \right] }\, \mathrm{d}x + A_2 \int \frac{\mathrm{d}x}{y_1^2} + A_1,$$ with $A_1$ the other constant of integration. This yields to the final solution, $y(x)$, given by eq. (2) after further substitution and simplification.

Note that this method always works for linear ODEs for which you know at least one of the homogenous solutions, no matter their coefficients are constant or not. It’s a nice exercise to show what the general solution of the ODE $y”(x) + p(x) y'(x) + q(x) y(x) = f(x)$ would be if we know that $y_1(x)$ and $y_2(x)$ satisfiy the homogenous ODE (it’s a slightly different from what we have done here).

Hope this helps!