# How can I solve for coefficients $B_n$ in the sol. of heat equation / Fourier sine series?

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}$$

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}$$

• But are you not exchanging the integral with the summation at $(6)$. Why can you do that? Oct 31, 2018 at 23:17
• Again that is something that's done in plentiful of other "solutions", like math.stackexchange.com/questions/705096/…. But no explanation given as to why it's legit. Oct 31, 2018 at 23:19
• you can exchange the integral and series because the inner integral is a finite sum I believe. Is that what you're concerned about.
– user3417
Oct 31, 2018 at 23:29
• That's arguing backwards. So you claim that $(5)->integral->(6)$ because in $(6)$ you have definite integral inside. But why did you get it inside the sum? The question asks for "why is the fourier series integrable term-by-term". Oct 31, 2018 at 23:30
• I read the title of your question and the beginning of it and started typing, which was how to solve for $B_{n}$ and you said it was non-trivial. I imagine it has to do with this. math.stackexchange.com/questions/83721/…
– user3417
Oct 31, 2018 at 23:47