<s>[INST] Piecewise function as initial condition in Heat Equation exercise - Confirm solution I have $u_t = u_{xx}$ for $0<x<1$, 
$u(0,t) = 0, \; 0 \leq t < \infty$
$u(1,t) = 0, \; 0 \leq t < \infty$
$u(x,0) = \varphi(x), \; 0 \leq x \leq 1$ where $\varphi(x) = \begin{cases} 
      \frac{5x}{2}, 0 < x < \frac{2}{3} \\
      3-2x, \frac{2}{3} < x < 1
   \end{cases}$ 
I know the general solution to the heat equation written as $u_t = \alpha^2 u_{xx}$ for $0 < x< l$, $t > 0$  
$u(0,t) = 0, \; u(l,t) = 0$ for all $t > 0$ and $u(x,0) = f(x)$ for all $0<x<l$ is $u(x,t) = \sum_{k=1}^{\infty} \beta_k \sin(\frac{k\pi}{l}x)e^{\frac{-\alpha^2 \pi^2 k^2 t}{l^2}}$ where $\beta_k = \frac{2}{l}\int_0^l sin(\frac{k \pi x}{l})dx$. This is derived directly from applying the method of separation of variables. 
I've never had a piece-wise function as the initial condition for this sort of exercise so I want to confirm my thoughts for the solution. I think $u(x,t) = \sum_{k=1}^{\infty} \beta_k \sin(\frac{k\pi}{1}x)e^{\frac{-\alpha^2 \pi^2 k^2 t}{1^2}}$ where $\beta_k = \begin{cases} \frac{2}{\frac{2}{3}}\int_0^\frac{2}{3} \frac{5x}{2}\sin(\frac{k \pi}{1}x)e^{\frac{-1^2 \pi^2 k^2 t}{1^2}} ,\; 0 < x<\frac{2}{3} \\ \frac{2}{1}\int_\frac{2}{3}^1 (3-2x)\sin(\frac{k \pi}{1}x)e^{\frac{-1^2 \pi^2 k^2 t}{1^2}} ,\; \frac{2}{3} < x<1\end{cases}$.
Is this correct?
 [/INST] Yes, this is correct, it is just an integration by part.
</s>