# 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 \,.$$

-

$\newcommand{\+}{^{\dagger}} \newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle} \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack} \newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,} \newcommand{\dd}{{\rm d}} \newcommand{\down}{\downarrow} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\expo}[1]{\,{\rm e}^{#1}\,} \newcommand{\fermi}{\,{\rm f}} \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,} \newcommand{\half}{{1 \over 2}} \newcommand{\ic}{{\rm i}} \newcommand{\iff}{\Longleftrightarrow} \newcommand{\imp}{\Longrightarrow} \newcommand{\isdiv}{\,\left.\right\vert\,} \newcommand{\ket}[1]{\left\vert #1\right\rangle} \newcommand{\ol}[1]{\overline{#1}} \newcommand{\pars}[1]{\left(\, #1 \,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\pp}{{\cal P}} \newcommand{\root}[2][]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,} \newcommand{\sech}{\,{\rm sech}} \newcommand{\sgn}{\,{\rm sgn}} \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}} \newcommand{\ul}[1]{\underline{#1}} \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert} \newcommand{\wt}[1]{\widetilde{#1}}$ $\ds{{\rm u}''\pars{x} + {\rm u}\pars{x} = \verts{\cos\pars{x}}:\ {\large ?}}$

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.

-