I'm looking to solve the following parabolic IBVP:
$\begin{cases} u_t - u_{xx} - u = 0,\quad 0 < x < 1, \quad t>0,\\ u(0,t) = u_x(1,t) = 0,\quad t \geq 0, \\ u(x,0) = x^2(1+x), \quad 0 \leq x \leq 1. \end{cases}$
I started using the method of separation of variables, and I end up with the following eigenvalues and eigenfunction:
$\lambda_n = (\pi - \frac{1}{2})^2\pi^2, \quad X_n(x) = \sin[(n-\frac{1}{2})\pi x].$
My problem is that when it comes to finding the coefficients of the solution (which would usually be done by Fourier Sine series) I have $\sin[(n-\frac{1}{2})\pi x]$ instead of $\sin(n\pi x)$.
I've tried to find similar exercises online but the best I could find is example 6 here: http://tutorial.math.lamar.edu/Classes/DE/SeparationofVariables.aspx which seems to stop half way through.
You can reduce the equation because $$ u_t - u_{xx} - u = 0 \\ (e^{-t}u)_{t}-(e^{-t}u)_{xx} = 0. $$ That motivates the substitution $v(x,t)=e^{-t}u(x,t)$, leading to $$ v_t = v_{xx} \\ v(x,0)=u(x,0)=x^2(1+x) \\ v(0,t)=e^{-t}u(0,t)=0 \\ v_{x}(1,t)=e^{-t}u_{x}(1,t)= 0 $$ The separated solutions $v(x,t)=T(t)X(x)$ must satisfy $$ \frac{T'}{T} = \lambda,\;\; \lambda= \frac{X''}{X}\\ X(0)=0,\;\; X'(1)=0. $$ That leads to solutions $X_n(x)=\sin((n-1/2)\pi x)$ for $n=1,2,3,\cdots$, as you noted. So $\lambda_n=-(n-1/2)^2\pi^2$, and $T_n(t)=e^{-(n-1/2)^2\pi^2 t}$. The general solution is $$ v(x,t) = \sum_{n=1}^{\infty}A_n X_n(x)T_n(t), $$ and the coefficients $A_n$ are determined by the initial condition $$ x^2(1+x)=v(x,0) = \sum_{n=1}^{\infty}A_n X_n(x) $$ The Functions $X_n$ are mutually orthogonal on $[0,1]$, meaning that $$ \int_{0}^{1}X_n(x)X_m(x)dx = 0,\;\;\; n\ne m. $$ This is generally true of Sturm-Liouville eigenvalue problems such as this one: $$ X''=\lambda X,\;\;\; X(0)=0,\;\; X'(1)=0. $$ Therefore, multiplying $x^2(1+x)=\sum_{n=1}^{\infty}A_n X_n(x)$ by $X_m(x)$ and integrating over $[0,1]$ gives $$ \int_{0}^{1}x^2(1+x)X_m(x)dx = \sum_{n=1}^{\infty}A_n \int_{0}^{1}X_n(x)X_m(x)dx = A_m \int_{0}^{1}X_m(x)X_m(x)dx \\ \implies A_m = \frac{\int_{0}^{1}x^2(1+x)X_m(x)dx}{\int_{0}^{1}X_m(x)^2dx} = \frac{\int_{0}^{1}x^2(1+x)\sin((m-1/2)\pi x)dx}{\int_{0}^{1}\sin^2((m-1/2)\pi x)dx} $$ The solution $u$ is $$ u(x,t) = e^{t}v(x,t)=e^{t}\sum_{n=1}^{\infty}A_n e^{-\lambda_n t}X_n(x) $$