Linear Homogenous Differential Equation with a discontinuous coefficient I am given a differential equation
$$
y'' + (sgn(x))y = 0
$$
Solved piecewise, I get 
$$
y_1 =
\begin{cases} 
\ A Cos(x), x \ge 0\\
\ B e^{-x} , x < 0
\end{cases}
$$
$$
y_2 = 
\begin{cases}
C Sin(x), x \ge 0\\
D e^{x}, x < 0 
\end{cases}
$$
However, ${y_2}$ is not continuous at zero, and in addition to this, the problem gives me a graphical depiction of $y_1$ and $y_2$ and it appears to be that 
$$
y_2 = 
\begin{cases}
C Sin(x), x \ge 0\\
D xe^{-x}, x< 0
\end{cases}
$$
Any and all help would be appreciated.
 A: This problem makes use of the sign function, which is defined as:
$$sgn(x) = \left\{\begin{array}{ll}
~~~1 & \mbox{if}~ x \gt 0\\
-1 & \mbox{if}~ x \lt 0\\
~~~0 & \mbox{if}~ x = 0
\end{array}
\right.$$
We are given a DEQ and initial conditions and asked to find two linearly independent soltuions, such that, $a)$ each satisfies the equation at every point $x \ne 0$ and, $b)$, each has a continuous derivative at $x = 0$. The DEQ and ICS are:
$$y'' + sgn(x) y = 0, \\ y_1(0) = y_2'(0) = 1, y_2(0) = y_1'(0) = 0$$
You have the correct approach by breaking it up into two cases. 
If $x \ge 0, y'' + y = 0$ has general solution:
$$y(x) = a \cos x + b \sin x$$
If $x \lt 0, y'' - y = 0$ has general solution:
$$y(x) = c e^{x} + d e^{-x}$$
We can generally write:
$$y(x) = \left\{\begin{array}{ll}
a \cos x + b \sin x & \mbox{if}~ x \ge 0\\
c e^{x} + d e^{-x} & \mbox{if}~ x \lt 0
\end{array}
\right.$$
The derivative of this is:
$$y'(x) = \left\{\begin{array}{ll}
-a \sin x + b \cos x & \mbox{if}~ x \ge 0\\
c e^{x} - d e^{-x} & \mbox{if}~ x \lt 0
\end{array}
\right.$$
Now, as you have discovered, care has to be taken to properly glue these solutions together to meet the ICs and to be continuous for both $y_1(x)$ and $y_2(x)$.
For $y_1(x), y_1(0) = 1, y_1'(0) = 0$, we have:
$$y_1(0) = \left\{\begin{array}{ll}
a  & \mbox{if}~ x \ge 0\\
c  + d  & \mbox{if}~ x \lt 0
\end{array}
\right. = 1 \implies a = 1, c + d = 1$$
$$y_1'(0) = \left\{\begin{array}{ll}
 b  & \mbox{if}~ x \ge 0\\
c  - d  & \mbox{if}~ x \lt 0
\end{array}
\right. = 0 \implies b = 0, c-d = 0 \implies c = d$$
Subbing in $c = d$ into the first, gives $c = d = \dfrac{1}{2}$.
This gives us:
$$y_1(x) = \left\{\begin{array}{ll}
 \cos x  & \mbox{if}~ x \ge 0\\
\dfrac{1}{2} (e^{x}+ e^{-x}) & \mbox{if}~ x \lt 0
\end{array}
\right.$$
Repeat this process for $y_2(x)$ and see if you can get it to work.
The plots for $y_1(x)$, blue, and $y_2(x)$, orange are:

Notice that we have met linear independence and both conditions, $a)$ and $b)$, as required. 
