How can I solve for coefficients Bn in the sol. of heat equation / Fourier sine series?
I've discovered the solution:
$$\sum_{n=1}^{\infty} u_n(x,t)=\sum_{n=1}^{\infty} B_n \sin \bigg(\frac{n \pi x}{L} \bigg)e^{-k \bigg( \frac{n \pi}{L} \bigg)^2t}$$
and with the IC (I'm given $u(x,0)=x$):
$$u(x,0)=\sum_{n=1}^{\infty} B_n \sin \bigg(\frac{n \pi x}{L} \bigg)=x$$
How can I solve for $B_n$ in an easy to explain way?
I've done some googling (obviously), but noticed that a lot of solutions seem to rely on "exchange order of integral with infinite summation", which I find non-trivial (or at least I cannot understand how can I prove that it's possible).
Another way suggested "assume the sum is twice-differentiable", again something that I find hard to chew.
Or is it truly that solving for $B_n$s is non-trivial?
But surely there must be some explanation as to why the "exchange order of integral with infinite sum" is legit?
if your original pde was the heat equation with zero temperature at finite ends then you should have.
$$ \begin{align}\begin{cases} \frac{\partial u}{\partial t} = k\frac{\partial^{2} u}{\partial x^{2}} & 0 < x < L, t > 0 \\ u(0,t) =0 \\ u(L,t) = 0 \\ u(x,0) = f(x) \end{cases} \end{align} \tag{1}$$
which would give you
$$ u(x,t) = B \sin(\sqrt{\lambda}x) e^{-k \lambda t} \tag{2} $$
this becomes
$$ u(x,t) = \sum_{n=1}^{\infty}B_{n} \sin(\sqrt{\lambda}x) e^{-k \lambda t} \tag{3} $$
to solve for the coefficients, we note that
$$\int_{0}^{L} \sin(\frac{n \pi x}{L})\sin(\frac{m \pi x}{L}) dx = \begin{align}\begin{cases} 0 & m \neq n \\ \frac{L}{2} & m =n \end{cases} \end{align} \tag{4} $$
then we do the following. This is called Fouriers Trick. We multiply $f(x)$ by $\sin(\frac{m \pi x}{L})$ and
$$ f(x) \sin(\frac{m \pi x}{L}) = \sum_{n=1}^{\infty} B_{n} \sin(\frac{n \pi x}{L}) \sin(\frac{m \pi x}{L}) \tag{5} $$
The question is about here
When you go from step $5$ on. You take the integral from $\int_{0}^{L}$ of both sides.
$$ \int_{0}^{L} f(x) \sin(\frac{m \pi x}{L}) dx = \int_{0}^{L} \sum_{n=1}^{\infty} B_{n} \sin(\frac{n \pi x}{L})\sin(\frac{m \pi x}{L}) dx \tag{6}$$
there is a theorem on this page
Theorem: if $ \{ f_{n} \}_{n} $ is a positive sequence of integrable functions and $f = \sum_{n} f_{n} $ then
$$\int f = \sum_{n} \int f_{n} \tag{7} $$
this comes from the monotone convergence theorem.
$$ \int_{0}^{L} f(x) \sin(\frac{m \pi x}{L}) dx = \sum_{n=1}^{\infty} B_{n} \int_{0}^{L} \sin(\frac{n \pi x}{L})\sin(\frac{m \pi x}{L}) dx \tag{8}$$
now when $ m \neq n$ that is $0$ so we have
$$ \int_{0}^{L} f(x) \sin(\frac{m \pi x}{L}) dx = B_{m} \sum_{n=1}^{\infty} \int_{0}^{L} \sin^{2}(\frac{m\pi x}{L}) dx \tag{9}$$
which then yields
$$ B_{m} = \frac{\int_{0}^{L} f(x) \sin(\frac{m \pi x}{L}) dx}{ \int_{0}^{L} \sin^{2}(\frac{m\pi x}{L}) dx} = \frac{2}{L} \int_{0}^{L} f(x) \sin(\frac{m \pi x}{L}) dx \tag{10}$$