# How do I tweak the Fourier series solution for the particular boundary condition in the heat equation?

I'm trying to solve the one-dimensional heat equation using Fourier series:

$$\frac{\partial T}{\partial t}=-\alpha\frac{\partial^2T}{\partial x^2}$$

I know that:

$$T = k_n\cos{(nx-\varphi_n)}e^{-\alpha n^2t}$$

is a solution that satisfies the PDE, but doesn't necessary satisfy the initial, or boundary conditions. However, we also know that we may write any function as a sum of sines and cosines, which is what a Fourier series is. For a function $$f(x)$$, we may write:

$$f(x)=\frac{a_0}{2} + \sum_{n=1}^{\infty}{a_ncos(nx)+b_nsin(nx)}$$

Now, let me define $$k_n$$ as:

$$k_n^2=a_n^2+b_n^2$$

Thus, we can write:

$$a_n=k_n\cos{\varphi_n}$$

and

$$b_n=k_n\sin{\varphi_n}$$

Substituting this above, we get:

$$f(x)=\frac{a_0}{2} + \sum_{n=1}^{\infty}{k_n\cos{(nx-\varphi_n)}}$$

I made this change so that instead of restricting to sines or cosines, we can have a cosine wave, shifted by a phase angle instead.

Initial condition:

If we take the above $$f(x)$$ as the initial condition of our heat distribution, i.e

$$T(x,t=0) = f(x)$$

we would instantly get the PDE solution as:

$$T(x,t)=\frac{a_0}{2} + \sum_{n=1}^{\infty}{k_n\cos{(nx-\varphi_n)}e^{-\alpha n^2t}}$$

Boundary condition: This is where I am stuck. We can have a whole variety of boundary conditions, for the two end points of the rod. We can either maintain the temperature of the rod at the ends constant, or the heat flow through the rod at the ends constant, or the rate of heat flow, etc. All of these boundary conditions can be described as either the function values of $$T(0,t)$$ or $$T(L,t)$$, or any of the higher order derivatives of them.

At first I thought that we must tweak $$k_n$$, or $$\varphi_n$$ to get our boundary condition solved, but that doesnt seem to be the case. After careful inspection, I realize that it's the definition of $$f(x)$$ that we must consider for the boundary condition: $$f(x)$$ is a periodic extension of the heat distribution of the rod at intial time. I am aware of the half-range extensions, where we may extend as just sines, or just cosines, but I'm sure that's not what it's limited to. I believe we should be able to extend the initial condition in any way we would like, such that this extension satisfies both boundary conditions. I'm not sure how I would proceed to do this.

Any help would be appreciated.

• It is all readily expressible in $a_n$ $b_n$. Just plug in the $t$ for end points and the linearity of the Fourier transform will make sure that you will just add a couple of linear equations. It will make the equation system slightly more determined. I don't see what the problem is. Aug 2, 2019 at 16:56

Given fixed real numbers $$\theta,\eta$$, you can impose homogeneous conditions of the form $$\cos(\theta)T(a,t)+\sin(\theta)T_x(a,t)=0,\\ \cos(\eta)T(b,t)+\sin(\eta)T_x(b,t)=0.$$ This leads to a well-posed Sturm-Liouville problem in the $$x$$ coordinate after separating variables for $$T(x,t)=X(x)T(t)$$: $$X''(x)+\lambda X(x) = 0,\\ \cos(\theta)X(a)+\sin(\theta)X'(a) = 0,\\ \cos(\eta)X(b)+\sin(\eta)X'(b) = 0.$$ There will be a discrete set of $$\lambda$$ for which there are non-trivial solutions $$X_{\lambda}(x)$$. These may be written as $$\lambda_1 < \lambda_2 < \lambda_2 < \cdots$$, and the corresponding eigenfunctions $$X_{\lambda_n}(x)$$ will form an orthogonal basis for $$L^2[a,b]$$, which means that every function $$f \in L^2[a,b]$$ may be written as an $$L^2$$ convergent Fourier series sum $$f \sim \sum_{n=1}^{\infty}\frac{\int_a^b f(x')X_{\lambda_n}(x')dx'}{\int_a^b X_{\lambda_n}(x')^2dx'}X_{\lambda_n}(x).$$ The series will not necessarily converge pointwise at the enpoints because of the conditions satisfied by the functions $$X_{\lambda_n}$$ at the endpoints. If $$f$$ is smooth and satisfies the same endpoint conditions as the $$X_{\lambda_n}$$ at $$x=a,b$$, then you will get pointwise convergence.