Find solution $\phi$ that satifies the differential equations and has a specific form I am looking at the following exercise:

Let $I=(0,1)$. Find the solution $\phi$ that has  a continuous derivative in $\mathbb{R}$ and satisfies :

$$y''=0 \text{ in } I \\y''+k^2y=0 \text{ apart from } I, \text{ where } k&gt;0$$

and furthermore $\phi$ has the form:

$\phi(x)=\left\{\begin{matrix}
e^{ikx}+Ae^{-ikx} &amp;, x \leq 0 \\ 
Be^{ikx} &amp; , x \geq 1
\end{matrix}\right.$

That's what I have tried:

$$y''=0 \text{ in } I$$
$$\Rightarrow y'=c_1 \Rightarrow y(x)=c_1 x+c_2, x \in I, c_1, c_2 \in \mathbb{R}$$

Since $\phi$ satisfies $y''=0$ in $I$ it holds that $\phi(x)=c_1 x+ c_2, x \in I$.

$\phi$ has a continuous derivative in $\mathbb{R}$. So we have the following:

$$\lim_{x \to 1^{-}} \phi(x)=\lim_{x \to 1^{+}} \phi(x) \Rightarrow \lim_{x \to 1^{-}} (c_1 x+c_2)=\lim_{x \to 1^{+}} B e^{ikx} \Rightarrow c_1+c_2=Be^{ik} \\ \Rightarrow B=e^{-ik} (c_1+c_2) $$

$$\lim_{x \to 0^{-}} \phi(x)=\lim_{x \to 0^{+}} \phi(x) \Rightarrow \lim_{x \to 0^{-}} (e^{ikx}+Ae^{-ikx})=\lim_{x \to 0^{+}} (c_1x+c_2) \Rightarrow 1+A=c_2 $$

$$\lim_{x \to 0^{-}} \phi'(x)=\lim_{x \to 0^{+}} \phi'(x) \Rightarrow \lim_{x \to 0^{-}} (ik e^{ikx}-Aik e^{-ikx})= \lim_{x \to 0^{+}} c_1 \Rightarrow c_1=ik-Aik=(1-A) ik$$

$$\lim_{x \to 1^{-}} \phi'(x)=\lim_{x \to 1^+} \phi'(x) \Rightarrow \lim_{x \to 1^{-}} c_1=\lim_{x \to 1^+} Bik e^{ikx} \Rightarrow c_1=Bik $$

So we get:

$$Bik=(1-A) ik \Rightarrow B=1-A$$

$$B=e^{-ik} (Bik+1+A) \Rightarrow 1-A=e^{-ik} ((1-A)ik+1+A) \\ \Rightarrow 1-A=e^{-ik} ik-Aik e^{-ik}+1+A \Rightarrow A(2-ike^{-ik})=-e^{-ik} ik \Rightarrow A=\frac{-e^{-ik} ik}{2-ike^{-ik}} \\ \Rightarrow A=\frac{k^2 e^{-2ik}-2ik e^{-ik}}{4+k^2 e^{-2ik}}$$

$$B=1-A=1-\frac{k^2 e^{-2ik}-2ik e^{-ik}}{4+k^2 e^{-2ik}}=\frac{4+2ike^{-ik}}{4+k^2 e^{-2ik}}$$

Thus:

$\phi(x)=\left\{\begin{matrix}
e^{ikx}+ \frac{k^2 e^{-2ik}-2ik e^{-ik}}{4+k^2 e^{-2ik}}e^{-ikx} &amp;, x \leq 0 \\ 
\frac{4+2ike^{-ik}}{4+k^2 e^{-2ik}}e^{ikx} &amp; , x \geq 1 \\
\left(\frac{4+2ike^{-ik}}{4+k^2 e^{-2ik}} \right)ikx+ \frac{2-2ik e^{-ikx}}{2-ik e^{-ik}}
\end{matrix}\right.$

Could you tell me if it is right or if I have done something wrong?
can this work:
$y=\left\{\begin{matrix}
a\cos(kx - b) &amp; x \leq 0 \\ 
(c\cos d - a\cos b)x + a\cos b&amp;  0 \le x \le 1 \\
c\cos(kx - k + d) &amp; 1 &lt; x
\end{matrix}\right.$ 

where $a,b,c$ and $d$ are arbitrary constants.
can this work:
$y=\left\{\begin{matrix}
a\cos(kx - b) &amp; x \leq 0 \\ 
(c\cos d - a\cos b)x + a\cos b&amp;  0 \le x \le 1 \\
c\cos(kx - k + d) &amp; 1 &lt; x
\end{matrix}\right.$ 

where $a,b,c$ and $d$ are arbitrary constants.