# differential equation $u''(x)+u(x) =|\cos(x)|$

I am stuck solving the diff-eq. $u''(x)+u(x) =|\cos(x)|$.

How do I find the general solution to this?

The homogeneous part is no problem, but how do I deal with the absolute value of the cosine?

-

You can re-write it in the following form: $$u''(x)+u(x)=\left\{ \begin{array}{rc}\cos x& -\frac{\pi}{2}+2\pi k\leq x<\frac{\pi}{2}+2\pi k\\-\cos x& \frac{\pi}{2}+2\pi k\leq x<\frac{3\pi}{2}+2\pi k \end{array}\right.$$ And find the solution according to the segement.

-
Shouldn't the OP combine the finial answers as one answer? –  Babak S. Nov 1 '12 at 13:56
It depends on whether it is possible: the resulted function could be not-differentiable on the segment edges. –  Dennis Gulko Nov 2 '12 at 9:55

You need to solve the following equation for particular solutions

$$u''(x)+u(x) = \cos(x) \,\quad \cos(x)\geq 0 \,,$$

and

$$u''(x)+u(x) = -\cos(x) \,\quad \cos(x)< 0 \,.$$

-


Let $\ds{\xi\pars{x} \equiv {\rm u}'\pars{x} + \ic{\rm u}\pars{x}}$ such that $\ds{{\rm u}\pars{x} = \Im\xi\pars{x}}$ and

$\ds{{\rm u}''\pars{x} + {\rm u}\pars{x} = \xi'\pars{x} - \ic\xi\pars{x} =\verts{\cos\pars{x}}}$

Then, $$\expo{-\ic x}\verts{\cos\pars{x}} =\expo{-\ic x}\xi'\pars{x} - \ic\expo{-\ic x}\xi\pars{x} =\totald{\bracks{\expo{-\ic x}\xi\pars{x}}}{x}$$

$$\expo{-\ic x}\xi\pars{x}=\int\expo{-\ic x}\verts{\cos\pars{x}}\,\dd x + A \quad\mbox{where}\quad A\ \mbox{is a constant}\quad\mbox{and}\quad A \in {\mathbb C}$$

$$\xi\pars{x}=\expo{\ic x}\int\expo{-\ic x}\verts{\cos\pars{x}}\,\dd x + A\expo{\ic x}$$

$${\rm u}\pars{x}= \Im\pars{\expo{\ic x}\int\expo{-\ic x}\verts{\cos\pars{x}}\,\dd x + A\expo{\ic x}}$$ The constant $\ds{A}$ is determined by the boundary conditions.

-