Solution 1:

Let $v(x,t)=u(x,t)-x$. Then $v$ satisfies an equivalent problem, $$ v_{tt}=v_{xx} \\ v(0,t) = u(0,t)-L0 = 0,\\ v_{x}(L,t)= u_{x}(L,t)-1= 0,\\ v(x,0) = u(x,0)-x = -x. $$ Separating variables with $v(x,t)=X(x)T(t)$ gives $$ \frac{T''}{T} = \lambda = \frac{X''}{X}. $$ The solutions in $X$ determine the allowed separation parameters $\lambda$. $\lambda = 0$ is not a valid eigenvalue. For $\lambda \ne 0$, the solutions $X_n$ are constant multiples of $$ X_n(x) = \sin(\sqrt{\lambda_n} x),\;\; \lambda_n = (n+1/2)^2\pi^2/L^2. $$ The corresponding solutions $T_n$ are $$ T_n(t)=A_n\sin(\sqrt{\lambda_n} t)+B_n\cos(\sqrt{\lambda_n} t) $$ The general solution $v$ is then given by $$ v(x,t) = \sum_{n=0}^{\infty}T_n(t)X_n(t), $$ where the constants $A_n$, $B_n$ are determined by the initial data. Because $v_{t}(x,0)=0$, then $A_n=0$ for all $n$. That leaves the $B_n$, which are determine by $$ -x = v(x,0) = \sum_{n=0}^{\infty}B_n\sin((n+1/2)\pi x/L) $$ The functions $\sin((n+1/2)\pi x/L)$ are mutually orthogonal on $[0,L]$ with respect to the inner product of $L^2[0,L]$. Hence, multiplying both sides of the above by $\sin((m+1/2)\pi x/L)$ and integrating over $[0,L]$ gives equations for the $B_m$: $$ -\int_{0}^{L}x\sin((m+1/2)\pi x/L)dx = B_m\int_{0}^{L}\sin^2((m+1/2)\pi x/L)dx $$ I'll leave these integrals to you. Finally, $u(x,t)=v(x,t)+x$ gives $$ u(x,t)=x-\sum_{n=0}^{\infty}\frac{\int_{0}^{L}x\sin((n+1/2)\pi x/L)dx}{\int_{0}^{L}\sin^2((n+1/2)\pi x/L)dx}\sin((n+1/2)\pi x/L)\cos((n+1/2)\pi t/L) $$

Solution 2:

Original equation:

$$ u_{xx} = u_{tt}. \quad (1)$$

Assume the wave solution is of the form

$$ u(x,t) = Ae^{i(kx-\omega t)} + Be^{-i(kx-\omega t)} . \quad(2)$$

Plug into the original equation:

$$ (1)\implies -k^2u(x,t) = -\omega^2 u(x,t)\implies k=\pm \omega. \quad(3)$$

Note that the two solutions for $k$ correspond to forward and backward wave components.

If only initial conditions are specified, the solution can consist of one or two kinds of waves.

If boundary conditions are specified, we need to combine both kinds of waves to get standing waves. In this case, the general solution is of the form:

$$ u(x,t) = Ae^{i(kx-\omega t)} + Be^{-i(kx-\omega t)} + Ce^{i(kx+\omega t)} + De^{-i(kx+\omega t)}. \quad (4) $$

a) Imposing boundary conditions on (4):

$$\begin{align} u(0,t) = 0 \implies (A+D)e^{-i\omega t} + (B+C) e^{i\omega t} &= 0. \quad(5)\\ u_t(0,t) = 0 \implies -i\omega (A+D)e^{-i\omega t} + i\omega (B+C) e^{i\omega t} &= 0 \\ \implies (A+D)e^{-i\omega t} - (B+C) e^{i\omega t} &= 0. \quad (6) \\ \end{align}$$

b) Imposing initial conditions: $$\begin{align} u(x,0) = 0\implies (A+C)e^{ikx} + (B+D)e^{-ikx} &= 0. \quad(7)\\ u_t(x,0) = 0\implies -i\omega (A-C)e^{ikx} + i\omega(B-D) Be^{-ikx} &= 0 \\ \implies (A-C)e^{ikx} - (B-D)e^{-ikx} &= 0. \quad(8) \end{align}$$

Thus, the first and third boundary conditions and the two initial conditions are sufficient to determine the solutions for $A,B,C,D$.

Note that we haven't used the boundary condition at $x=L$ yet:

$$ \begin{align} u_x(L,t) = 1\implies ikAe^{i(kL-\omega t)} -ik B e^{-i(kL-\omega t)} + ikCe^{i(kL+\omega t)} -ik D e^{-i(kL+\omega t)} &= 1\\ \implies Ae^{i(kL-\omega t)} - B e^{-i(kL-\omega t)} + Ce^{i(kL-\omega t)} - D e^{-i(kL-\omega t)} &= -i/k. \quad(9) \end{align} $$

Thus, the five equations $(5)$ through $(9)$ can be solved for $A, B, C, D$ and $k$. Once $k$ is obtained, we can replace it with $\omega$ because from $(3)$, we have $k=\omega$. Note that we don't need to use $k=-\omega$ because we already used it to include both forward and backward waves in the general solution (4).

Without proof, we just want to point out the physics as follows.

  • If the boundary condition at $x=L$ is specified, the waves are constrained at the two endpoints $x=0$ and $x=L$. Hence, only certain wavelengths are possible. For example, if the solutions are standing waves between the two boundaries, then $\lambda_n = L/n$ for certain values of $n \in\mathbb{N}$. That's why the RHS of $(9)$ contains $k$.

  • If the boundary condition at $x=L$ is not specified, the waves are constrained only at $x=0$. Thus, all wavelengths are possible and the temporal frequency is $\omega = k$.