Wave equation solution does not satisfy the boundary conditions I tried to derive a solution to the following wave equation with one non-homogeneous boundary condition:
$$c^2{\partial ^2u(t,x) \over \partial x^2}={\partial ^2u(t,x) \over \partial t^2} \tag1$$
$$ u(0,x)=0\tag2$$
$$ {\partial u(t,x) \over \partial t}\Bigg|_{t=0}=0 \tag3$$
$$ u(t, 0)=q(t) = A \sin (w_ot)\tag4$$
$$ u(t, L)=0 \tag5$$
$$ t \geq 0 \tag6$$
$$ L \geq x \geq 0 \tag7$$
The derivation process is based on @doraemonpaul answer to this question. By using the Laplace transformations on equation $(1)$ along with the boundary conditions $(2)$ and $(3)$, I wrote the following equation:
$$
{\partial ^2U(s,x) \over \partial x^2} - \bigg({s\over c}\bigg)^2U(s,x)=0  \tag8
$$
The general solution to the above second order differential equation is:
$$
U(s,x) = \alpha (s) \sinh \bigg({s\over c}x\bigg) + \beta (s) \cosh \bigg({s\over c}x\bigg) \tag9
$$
By using the hyperbolic trigonometry identities:
$$ \sinh\bigg({s\over c}x \bigg) = { e^{{s\over c}x} - e^{{- {s\over c} }x} \over 2} \tag{10}$$
$$ \cosh\bigg({s\over c}x \bigg) = { e^{{s\over c}x} + e^{{- {s\over c} }x} \over 2} \tag{11}$$
I rewrote equation $(9)$ as:
$$
U(s,x) = {{\beta (s) + \alpha (s)} \over 2}{ e^{{s\over c}x}} + 
         {{\beta (s) - \alpha (s)} \over 2}{ e^{-{s\over c}x}}\tag {12}
$$
Than, by using the substitutions:
$$ F(s) = {{\beta (s) + \alpha (s)} \over 2} \tag{13}$$
$$ G(s) = {{\beta (s) - \alpha (s)} \over 2} \tag{14}$$
I rewrote equation $(12)$ as:
$$
U(s,x) = F(s){ e^{{s\over c}x}} + 
         G(s){ e^{-{s\over c}x}}\tag {15}
$$
Now, by using the inverse Laplace transformations on equation $(15)$, I obtained the first form of the wave function:
$$
u(t,x) = H\bigg(t+ {x\over c}\bigg)f\bigg(t+ {x\over c}\bigg) + H\bigg(t- {x\over c}\bigg)g\bigg(t- {x\over c}\bigg) \tag{16}
$$
where $H$ is the Heaviside step function. By inserting the boundary condition $(4)$ into equation $(16)$, I obtained the following expression:
$$
q(t) = H(t)f(t) + H(t)g(t) \tag{17}
$$
If $t$ is greater than zero, then $H(t)$ is equal to one. That means that:
$$
q(t) = f(t) + g(t) \implies g(t) = q(t)-f(t) \tag{18}
$$
By time shifting $t$ to $t-x/c$, I rewrote the above equation as:
$$g\bigg(t - {x\over c}\bigg) = q\bigg(t - {x\over c}\bigg)-f\bigg(t - {x\over c}\bigg) \tag{19}$$
I inserted expression $(19)$ into equation $(16)$ and obtained the second form of the wave function which does not contain the function $g$:
$$
u(t,x) = H\bigg(t+ {x\over c}\bigg)f\bigg(t+ {x\over c}\bigg) + H\bigg(t- {x\over c}\bigg) \Bigg(q\bigg(t - {x\over c}\bigg)-f\bigg(t - {x\over c}\bigg)\Bigg) \tag{20}
$$
Next, I inserted the boundary condition $(5)$ into equation $(20)$ and obtained:
$$ 
H\bigg(t+ {L\over c}\bigg)f\bigg(t+ {L\over c}\bigg) + H\bigg(t- {L\over c}\bigg) \Bigg(q\bigg(t - {L\over c}\bigg)-f\bigg(t - {L\over c}\bigg)\Bigg) = 0 \tag{21}
$$
By time shifting $t$ to $t+L/c$, I rewrote the above equation as:
$$ 
H\bigg(t+ {2L\over c}\bigg)f\bigg(t+ {2L\over c}\bigg) + H(t) \bigg(q(t)-f(t)\bigg) = 0 \tag{22}
$$
If $t$ is greater than zero, I can rewrite equation $(22)$ as:
$$ 
f\bigg(t+ {2L\over c}\bigg) + q(t)-f(t) = 0 =>f(t) - f\bigg(t+ {2L\over c}\bigg) = q(t)\tag{23}
$$
By using the expression $q(t)=A \sin (w_o t)$ and by using the Fourier transformations on the above equation, I wrote down the following:
$$
F_f(jw)-e^{jw {2\pi\over c}}F_f(jw)= A{\pi\over j}\Big(\delta(w-w_o) - \delta(w+w_o)\Big) \tag{24}
$$
I expressed $F_f(jw)$ as:
$$F_f(jw)= {A{\pi\over j}\Big(\delta(w-w_o) - \delta(w+w_o)\Big)} \cdot {1\over1-e^{jw {2\pi\over c}}} \tag{25}$$
using the inverse Fourier transformations on the above equation, and then using trigonometric identities, I obtained the following expression:
$$
f(t) = {A \over 2} \Bigg( \sin (w_0 t) + \cot \bigg( w_0 {L \over c} \bigg) \cos (w_0 t) \Bigg) \tag{26}
$$
I checked on paper by using trigonometric identities if the above expression satisfies equation $(23)$. It does. I also made a plot of equation $(23)$ which shows good correspondence (the graphs are shown at the end of the question). Keep in mind that because of the cotangent function, the condition $w_0 \cdot L / c \neq n \pi$ must be satisfied. So now I derived the final form of the wave function as:
$$
u(t,x) =
{A \over 2}
H \bigg(t + {x\over c}\bigg) 
\Bigg[ \sin \Biggl(w_0\bigg(t+ {x\over c}\bigg)\Bigg) + 
\cot \bigg( w_0 {L \over c} \bigg)
\cos \Bigg( w_0\bigg(t+ {x\over c}\bigg)\Bigg) \Bigg] +
H\bigg(t- {x\over c}\bigg)
\Bigg[A \sin \Bigg(w_0\bigg(t - {x\over c}\bigg)\Bigg)-
{A \over 2}
\Bigg( \sin \Bigg(w_0 \bigg(t- {x\over c}\bigg)\Bigg) +
\cot \bigg( w_0 {L \over c} \bigg)
\cos \Bigg(w_0 \bigg(t- {x\over c}\bigg)\Bigg)\Bigg)\Bigg] \tag{27}   
$$
The problem is, the above expression does not satisfy the boundary conditions (I noticed this while plotting the wave function in Matlab), which means I made a mistake while deriving the solution to the wave equation. For example, if I insert the boundary condition $(2)$ into expression $(27)$, I get:
$$
u(0,x) = 0 =
{A \over 2}
H \bigg({x\over c}\bigg) 
\Bigg[ \sin \biggl(w_0{x\over c}\bigg) + 
\cot \bigg( w_0 {L \over c} \bigg)
\cos \bigg( w_0{x\over c}\bigg) \Bigg] +
H\bigg(-{x\over c}\bigg)
\Bigg[A \sin \bigg(-w_0{x\over c}\bigg)-
{A \over 2}
\Bigg( \sin \bigg(-w_0 {x\over c}\bigg) +
\cot \bigg( w_0 {L \over c} \bigg)
\cos \bigg(-w_0 {x\over c}\bigg)\Bigg)\Bigg] \tag{28}   
$$
If $x$ is greater then zero, then $H(x/c)$ is equal to one and $H(-x/c)$ is equal to zero. That means that I can simplify expression $(28)$ as:
$$
h(x) = 
\sin \biggl(w_0{x\over c}\bigg) + 
\cot \bigg( w_0 {L \over c} \bigg)
\cos \bigg( w_0{x\over c}\bigg) = 0 \tag{29}
$$
I posted a plot made in Matlab that shows that the above exspression is not true. The problem is, I can't determine the step in my derivation process in which I made a mistake. I also don't know if there is more then one mistake. So I am hoping someone will notice it and point it out to me.
In summary, I tried to derive a solution to the wave equation and failed. The boundary conditions are not satisfied and that proves I made a mistake somewhere in my derivation process, but I don't know where. So my question is, where are the mistakes in my derivation process and how should I correct them?
I'm sorry for the long post. Thank you for your time.


 A: I managed to solve this problem with a slightly different approach. After equation $(16)$. I wrote:
$$
W_+\bigg(t+ {x\over c}\bigg) = H\bigg(t+ {x\over c}\bigg)f\bigg(t+ {x\over c}\bigg) \tag1
$$
and:
$$
W_-\bigg(t- {x\over c}\bigg) = H\bigg(t- {x\over c}\bigg)f\bigg(t- {x\over c}\bigg) \tag2
$$
Which allowed me to write down the wave function as a sum of a wave propagating forward and a wave propagating backward:
$$ u(t,x) = W_+\bigg(t+ {x\over c}\bigg) + W_-\bigg(t- {x\over c}\bigg) \tag3 $$
After this, I did all the steps from forming equation $(17)$ to the end. I obtained the correct wave function which satisfied the boundary conditions:
$$
u(t,x) =
{A \over 2}
\Bigg[ \sin \Biggl(w_0\bigg(t+ {x\over c}\bigg)\Bigg) + 
\cot \bigg( w_0 {L \over c} \bigg)
\cos \Bigg( w_0\bigg(t+ {x\over c}\bigg)\Bigg) \Bigg] +
\Bigg[A \sin \Bigg(w_0\bigg(t - {x\over c}\bigg)\Bigg)-
{A \over 2}
\Bigg( \sin \Bigg(w_0 \bigg(t- {x\over c}\bigg)\Bigg) +
\cot \bigg( w_0 {L \over c} \bigg)
\cos \Bigg(w_0 \bigg(t- {x\over c}\bigg)\Bigg)\Bigg)\Bigg] \tag{4}   
$$
