# Formal Solution for Heat Equation using Fourier Series

1. Feb 3, 2012

### RayonG

1. The problem statement, all variables and given/known data
Find a formal solution of the heat equation u_t=u_xx subject to the following:
u(0,t)=0
u_x(∏,t)=0
u(x,0)=f(x)

for 0≤x≤∏ and t≥0

2. Relevant equations
u(x,t)=X(x)T(t)

3. The attempt at a solution
I first began with a separation of variables.

T'(t)=λT(t)

T(t) = Ce^(λt).

X''(x)=λX(x)
The boundary conditions show that X(0)=0 and X'(∏)=0.

There are three general cases for the solution X(x).

Case 1: When λ=0, I get X(x)=Ax+B, and using the boundary conditions get A=B=0.
So the solution is a trivial solution (not what I need).

Case 2: When λ=μ^2 >0, then X(x)=Acosh(μx)+Bsinh(μx) and X'(x)=Aμsinh(μx)+Bμcosh(μx).
Again, using the boundary conditions lead to C=D=0, leading to the trivial solution X(x)=0.

Case 3: When λ=-μ^2 <0, then X(x)=Acos(μx)+Bsin(μx). X'(x)=-Aμsin(μx)+Bμcos(μx).

This is where I'm stuck. After solving I get A=0 and B≠0, as cos(μ∏)=0. How do I continue?

The solution is along the lines of f(x)=u(x,0)= Summation of n=1 to infinity of (Bn*sin(nx)), but clearly that is wrong. Help?

EDIT: You don't have to show that the fourier series obtained converges to the solution.
After looking at it some more, I think that X(x)=sin(μx). λ_n=-(μ_n)^2=-n^2/2 (where n is a positive integer). Would that be right?

Last edited: Feb 4, 2012
2. Feb 4, 2012

### RayonG

So now I have X(x)=sin((n+0.5)x) where n is a positive integer.

Using u_n(x,t)=$$\sum_{n=1}^{\infty}b_n*T_n(t)*X_n(x)$$ and plug in t=0,

So

u(x,0)=f(x)=$$\sum_{n=1}^{\infty}b_n*sin((n+0.5)x)$$.

Now does b_n = the fourier sine series?

3. Feb 4, 2012

### fluidistic

I am a bit lost. How do you get λ_n=-(μ_n)^2=-n^2/2? I get $\lambda_n=-\frac{n^2\pi ^2}{\Pi^2}$.
How do you get $X(x)=sin((n+0.5)x)$? I get $X(x)= B_n \sin \left ( \frac{n\pi x}{\Pi} \right )$.
I don't know if your b_n's are equal to the sine Fourier series coefficients.
I'll wait for someone more experienced than me to answer.

4. Feb 4, 2012

### RayonG

I realized that my edit was incorrect. I corrected with my next post.
I'm also new to this forum, and forgive me since I meant ∏ to be equal to $\pi$.

Since cos(μ$\pi$)=0. μ$\pi$=n$\pi$+$\pi$/2 where n=positive integer.

Then I get,

X(x) = Bsin((n+0.5)x).

I don't know if I'm doing this right, this is just my way of going about it, and I need verification.

5. Feb 4, 2012

### LCKurtz

The cosine is function is zero at odd multiples of $\pi/2$. So you get$$\mu_n = \frac {(2n-1)}{2}$$
and you have$$X_n(x) = \sin(\frac {(2n-1)}{2}x)$$Next you will solve for $T_n(t)$.

I'm guessing you have studied Sturm-Liouville expansions which is what you will need when it comes time to write down the Fourier Coefficients.

Last edited: Feb 4, 2012
6. Feb 4, 2012

### RayonG

Do you mean that X'(x)=cos((n-0.5)x) and so X(x)=sin((n-0.5)x)?

T_n(t) would be Ce^((λ_n)t).

And no, I have not learned Sturm-Liouville expansions, so I'm taking a guess that B_n is the Fourier sine series...

7. Feb 4, 2012

### LCKurtz

Yes, that's what I meant. Thanks for noting that and I have edited it. So, yes, you would have $$T_n(t) = c^{\lambda_n t}$$ giving$$u(x,t) = \sum_{n=1}^\infty c_nX_n(x)T_n(t) = \sum_{n=1}^\infty c_n\sin(\frac{2n-1}{2}x)e^{-(\frac {2n-1}{2})^2t}$$And, setting $t=0$, your initial condition gives, as you have noted,$$f(x) = u(x,0) = \sum_{n=1}^\infty c_n\sin(\frac{2n-1}{2}x)$$Now, the problem is as I think you understand, that this isn't the standard Fourier sine series. That would have been the case if your sine functions had been $\sin(nx)$. As a consequence you can't assume that $c_n$ is given by the usual half range formula for the coefficient for the sine series. That would have given you$$c_n=b_n=\frac 2 \pi \int_0^\pi f(x)\sin(\frac{2n-1}{2}x)\ dx$$That may in fact be a very good guess because it sometimes works out that way. But, as you realize, it is just a guess. You won't be able to check it until you have studied Sturm Liouville theory which give the formula for $c_n$ in expansions like this. At this point, if I were you, I would make that guess but raise the issue with your teacher.

8. Feb 4, 2012

### RayonG

Thanks for the input!
As of right now, I'll just write down what I can (it's only a homework problem). I'll ask my professor on Monday (perhaps he is using this problem as a direct link to teaching us the Sturm Liouville theory).

9. Feb 4, 2012

### LCKurtz

Maybe so. Perhaps you can report back here after you talk to your professor.

10. Feb 5, 2012

### fluidistic

I'm trying to solve this problem because I'm currently studying exactly the same stuff.
When doing separation of variables, for the third case when calculating $X(x)$...
I get as you get, $X(x)=A\cos (\mu x )+B \sin (\mu x )$. Since $X(0)=0$, this means $A=0$. So I am left with $X(x)=B\sin (\mu x)$. Using the boundary condition $X(\pi )=0$, I get that either $B=0$ (again trivial solution that we don't care of) or $\sin (\mu x )=0$. For the latter to happen, $\mu _n \pi$ must equal $n\pi$ with $n\in \mathbb{N}$. So I get that $\mu _n \in \mathbb{N}$. Therefore I get $X_n (x)=B_n \sin (nx)$ with $n \in \mathbb{N}$. This differs from your answer guys. Why were you looking when the cosine is worth 0? I didn't get that part.

11. Feb 5, 2012

### LCKurtz

His boundary condition at $\pi$ was different: $u_x(\pi, t) = 0$ which gives $X'(\pi) = 0$, not $X(\pi)=0$.

12. Feb 5, 2012

### fluidistic

Whoops, thanks for pointing this out. Going to try out tomorrow.

13. Feb 6, 2012

### fluidistic

Ok guys I get your result.
I have that $f(x)=\sum _{n=0}^{\infty } c_n \sin \left [ \left ( n+\frac{1}{2} \right ) \pi x \right ]$.
Using Evans' book definition for the Fourier coefficients, $c_n=\frac{1}{||\sin \left [ \left ( n+\frac{1}{2} \right ) \pi x \right ] ||^2} \int _0 ^\pi f(x) \sin \left [ \left ( n+\frac{1}{2} \right ) \pi x \right ]dx$ where $||\sin \left [ \left ( n+\frac{1}{2} \right ) \pi x \right ] ||^2=\int _0 ^ \pi \sin \left [ \left ( n+\frac{1}{2} \right ) \pi x \right ]^2dx=\frac{\pi}{2}-\frac{\sin (\pi ^2 (2n+1))}{2\pi n + \pi}=\pi /2$.
Therefore $c_n=\frac{2}{\pi} \int _0 ^\pi f(x)\sin \left [ \left ( n+\frac{1}{2} \right ) \pi x \right ] dx$ which is worth your educated guess LCKurtz.
There's no mention of S-T theory for this part.
I'd appreciate any comment of how S-T theory can be applied here.

14. Feb 6, 2012

### LCKurtz

I don't have Evans' book. But here's a brief explanation of the connection.

The Sturm-Liouville theory covers eigenvalue problems of the form$$(r(x)y'(x))'+ (q(x)+\lambda w(x))y = 0$$with appropriate boundary conditions. The theory shows that the eigenvalues are real and you get an infinite collection of eigenfunctions $\{\phi_n(x)\}$which can be used in general Fourier expansions. The usual Fourier Series expansions are a special case. I'm glossing over many details, which you can find on the internet, but the relevance to the above problem is that the eigenfunctions are orthogonal to each other with respect to the weight function w(x). So you get an expansion of the form$$f(x) = \sum_{k=0}^\infty c_n\phi_k(x)$$If you define an inner product by$$(f,g)=\int_a^bf(x)\overline g(x)w(x)\, dx$$the orthogonality is respect to that inner product and is referred to as orthogonality with respect to the weight function $w(x)$. In our problem, everything is real and $(a,b)=(0,\pi)$, and $w(x)=1$. If you take the inner produce of the series with $\phi_n$ you get$$(f,\phi_n) = \sum_{k=0}^\infty c_k(\phi_k,\phi_n) = c_n(\phi_n, \phi_n)$$
$$c_n = \frac {(f,\phi_n)}{(\phi_n, \phi_n)}$$In our problem$$\phi_n(x)=\sin(\frac{2n-1} 2x)$$ When you work out that denominator, as you have done when you worked out the norm formula, it gives you the $2/\pi$, which is what you get when you guess using the standard Fourier coefficient formulas. Luckily, the weight function was 1.

15. Feb 6, 2012

### RayonG

According to my professor, LCKurtz was right.

The solution is f(x)=u(x,0)=$$\sum_{n=1}^{\infty}b_n*sin((n+0.5)x)$$

where

B_n=(2/$\pi$)$\int_{0}^{\pi}f(x)*sin((n+0.5)x)dx$.

As far as deriving b_n, my professor told me it was a guess. I suppose he'll teach us later on or something.

16. Feb 7, 2012

### fluidistic

Thank you LCKurtz, that was very informative. (I notice I made a small error for the expressions, I have an extra factor "pi" inside the sine function which souldn't be there).