# The heat equation

1. Mar 13, 2012

### Gregg

1. The problem statement, all variables and given/known data

F(x,t) satisfies

$$\frac{\partial^2 F(x,t)}{\partial x^2}=\frac{\partial F(x,t)}{\partial t}$$

With the following boundary conditions

$$\frac{\partial F(0,t)}{\partial x}=\frac{\partial F(1,t)}{\partial x}$$

$$F(0,t) = F(1,t)$$

$$F(x,0) = x^2 \text{ for } x \in (0,1)$$

3. The attempt at a solution

I've assumed it's separation of variables but I am unsure if I can do this

If it is

$$F(x,t) = \phi(x) G(t)$$

I end up with

$$\frac{d^2\phi}{d x^2} +\lambda \phi = 0$$

$$\frac{dG}{dt} = -\lambda G$$

So

$$\phi(x) = c_1 \cos(x\sqrt{\lambda}) + c_2 \sin(x\sqrt{\lambda})$$

I also got that the constants are

$$c_1 = -\frac{1+\cos(\sqrt{\lambda})}{\sin(\sqrt{\lambda})}$$

$$c_2 = \frac{1+\cos(\sqrt{\lambda})}{\cos(\sqrt{\lambda})-1}$$

unsure where to go from here in terms of the function phi. lambda denotes eigenfunctions?

2. Mar 13, 2012

### micromass

Staff Emeritus
Good. I hope you know Fourier series.

Now, $\lambda$ is the separation constant, so we can choose. Write

$$\lambda=n^2\pi^2$$

to simplify our notation. (it will appear later why we chose this).

Can you solve

$$\frac{dG}{dt}+\lambda G=0$$

for this choice of $\lambda$??

Now, our boundary conditions are F(0,t)=F(1,t) and another boundary condition is F(0,0)=0 (forget about all the rest for a second). What does that imply for $\phi$?? Can you use it to find the constants?

3. Mar 14, 2012

### Gregg

Why can we choose to write that for lambda?

$$\frac{dG(t)}{dt}+\lambda G(t)=0$$

so

$$G(t) = A \exp(-\lambda t)$$

$$G(t) = A \exp( -n^2\pi^2 t)$$

4. Mar 14, 2012

### Gregg

$$F(0,t) = F(1,t) \Rightarrow c_1=0$$

you get $$c_1 = -c_1$$

$$F(0,0)=0$$ does not put any extra constraint on the constants since the sine vanishes at zero.

for $$\frac{\partial F(0,t)}{\partial x} = \frac{\partial F(1,t)}{\partial x}$$

I seem to get $$c_2 = c_2 \cos (n \pi )$$

5. Mar 14, 2012

### micromass

Staff Emeritus

Because lambda is arbitrary. Every value of lambda gives rise to another solution. So I choose [itex]\lambda=n^2\pi^2[/tex]. This special choice will give us the solution we want. So other lambda's don't interest us.

I don't see how you can deduce this. The only thing that you get from this is

$$\phi(0)=\phi(1)$$

right? Which is always satisfied.

Now, F(0,0)=0 gives something interesting.

6. Mar 14, 2012

### LCKurtz

I would say choosing $\lambda$ there is putting the cart before the horse. You have$$\phi''(x)+\lambda\phi(x) = 0$$ $$\phi(0)=\phi(1),\ \phi'(0) = \phi'(1)$$You want to consider the three cases $\lambda=\mu^2>0,\ \lambda = 0,\ \lambda = -\mu^2 < 0$. I think you will find $\lambda > 0$ gives only trivial solutions while $\lambda = 0$ gives a constant. Let's look more closely at $\lambda = \mu^2 > 0$. This gives$$\phi(x) = A\cos(\mu x)+ B\sin(\mu x)$$ $$\phi'(x) = -A\mu \sin(\mu x)+ B\mu\cos(\mu x)$$Your boundary conditions give these two equations:$$A(1-\cos \mu)-B\sin \mu = 0$$ $$A\sin\mu + B(1-\cos\mu)=0$$These will have a nontrivial solution for $A$ and $B$ if the determinant of coefficients is zero. That gives the equation $(1-\cos \mu)^2+\sin^2\mu = 0$. That can happen only if both squares are zero so $\mu = 2n\pi$. What is interesting here is that, for those values of $\mu$, both equations are satisfied for all $A$ and $B$. So what you have for the solutions for $\phi$ are $\phi_n(x) = A_n\cos(2n\pi x)+ B_n\sin(2n\pi x)$ and $\lambda_n = \mu_n^2 = 4n^2\pi^2$.

7. Mar 15, 2012

### Gregg

Yes I follow that now, though the bounday conditions for lambda less than or equal to zero seem to give me no constraints on A and B rather than constants or zero. But what about $A_n$ and $B_n$ ?

What happened to Fourier.

Since $\phi_n (x)$ is a solution I suppose this sum

$\sum_{n=0}^{\infty} \phi_n(x) = \sum_{n=0}^{\infty} A_n \cos (2n \pi x) + B_n \sin (2n\pi x)$

is a more general solution?

This sort of looks more like a fourier series, are the constants now needed for the sum to converge?

8. Mar 15, 2012

### Gregg

I have forgotten about the function $F(x,t) = \phi(x) G(t)$ We have solutions of the form $F_n(x,t) = (A_n \sin (n \pi x) + B_n \cos (n \pi x) ) c_3 e^{-\lambda t}$

Ah so we have

$F(x,0) = x^2,$ $x\in [0,1]$

So this series

$F(x,0) = \sum_{n=0}^{\infty} \left( A_n \sin (n \pi x) + B_n \cos (n \pi x) \right)= x^2$

$x \in [0,1]$

So that's where Fourier comes in

9. Mar 15, 2012

### LCKurtz

You mean$$\phi_n(x) = \left( A_n \sin (2n \pi x) + B_n \cos (2n \pi x) \right)$$ and $$G_n(t) = e^{-4n^2\pi^2 t}$$so you are looking for a solution of your PDE like$$F(x,t) =a_0 + \sum_{n=0}^\infty \phi_n(x)G_n(t)= a_0 + \sum_{n=0}^\infty \left( A_n \sin (2n \pi x) + B_n \cos (2n \pi x) \right) e^{-4n^2\pi^2 t}$$It is only now that you can use the condition $$F(x,0)=x^2$$Also I have included a constant term $a_0$. You need to work the case $\lambda=0$ to verify you get a constant term.

10. Mar 15, 2012

### Gregg

$\phi''(x) = 0$

With the boundary conditions you get

$\phi(x) = \c_1$

constant

$dG/dt = 0$

so $G$ is constant

But how does this help you get the $a_0$?

Assuming the solution

$F(x,t) = a_0 + \sum_{n=0}^{\infty} \left[ A_n \sin (2n\pi x) + B_n \cos (2 n \pi x) \right] e^{-4n^2\pi^2 t}$

$F(x,0) = a_0 + \sum_{n=0}^{\infty} \left[ A_n \sin (2n\pi x) + B_n \cos (2 n \pi x) \right]$

$\int_0^1 a_0 \sin (2m\pi x) dx + \int_0^1 \sin (2m\pi x) \sum_{n=0}^{\infty} \left[ A_n \sin (2n\pi x) + B_n \cos (2 n \pi x) \right] dx = \int_0^1 x^2 \sin (2m\pi x) dx$

$\int_0^1 a_0 \cos (2m\pi x) dx + \int_0^1 \cos (2m\pi x) \sum_{n=0}^{\infty} \left[ A_n \sin (2n\pi x) + B_n \cos (2 n \pi x) \right] dx = \int_0^1 x^2 \cos (2m\pi x) dx$

And this should yield the coefficients?

$A_n = \frac{-1}{n \pi}$
$B_n = \frac{1}{n \pi}$

Those can't be right I think i've made an error

Last edited: Mar 15, 2012
11. Mar 15, 2012

### LCKurtz

It tells you $\lambda = 0$ is an eigenvalue with $\phi_0(x) = c$ and $G_0(t) = de^{-0t}$ so $\phi_0(x) G_0(t)= c d = a_0$, some constant. You add that in with the other terms.
Did you actually calculate those or get them from an answer key? Do you know how to calculate Fourier Coefficients? I may be able to get back to this later this evening.

12. Mar 16, 2012

### Gregg

i forgot exactly how to go about finding fourier coefficients. so multiplying by cosine or sine and then integrating I got those, but I think I got mixed up with the integrals.

I found that the fourier series for x^2 is

$\frac{\pi^2}{30} + \sum_{n=0}^{\infty} \frac{2(-1)^n}{5n} \cos(n\pi x)$

though Mathematica says it is

$\frac{\pi ^2}{3}-4 \text{Cos}[x]+\text{Cos}[2 x]-\frac{4}{9} \text{Cos}[3 x]+\frac{1}{4} \text{Cos}[4 x]-\frac{4}{25} \text{Cos}[5 x]+\frac{1}{9} \text{Cos}[6 x] \cdots$

So I know that my coefficients are wrong in my previous post.

What does $a_0 = \phi_0 G_0$ actually refer to?

So,

$\left|\left( \begin{array}{cc} 1-\cos (\mu ) & \sin (\mu ) \\ \sin (\mu ) & 1-\cos (\mu ) \end{array} \right)\right| = -\sin ^2(\mu )+\cos ^2(\mu )-2 \cos (\mu )+1 = 0$

This has solutions $\mu = 2n\pi$ and $n\pi+\pi/2$

Use the latter...

$F(x,0) = a_0 + \sum_{n=1}^{\infty}\left[ A_n \sin \left((n \pi + \frac{\pi}{2})x\right) + B_n \cos \left( (n \pi + \frac{\pi}{2})x \right) \right]$

$F(x,0) = a_0 + \sum_{n=1}^{\infty}\left[ A_n \cos \left(n \pi x\right) + B_n \sin \left( n \pi x \right) \right] = x^2$

It is an even function so

$F(x,0) = a_0 + \sum_{n=1}^{\infty} A_n \cos \left(n \pi x\right) = x^2$

$F(\frac{1}{2},0) = a_0 = \frac{1}{4}$

$A_n = \int_{-1}^{1} x^2 \cos (m \pi x ) dx = \frac{4(-1)^m}{m^2 \pi^2}$

apart from the constant is wrong $a_0$ I should get $\frac{1}{3}$

Ahh now it is obvious, integrate both sides between -1 and 1.

$a_0 = \int_{-1}^{1} x^2 dx = \frac{1}{3}$

$\phi(x) = \frac{1}{3} + \sum_{n=1}^{\infty} \frac{4(-1)^n}{n^2 \pi^2} \cos (n \pi x)$

$F(x,t) =\left[ \frac{1}{3} + \sum_{n=1}^{\infty} \frac{4(-1)^n}{n^2 \pi^2} \cos (n \pi x) \right] e^{- (n\pi + \frac{\pi}{2})^2 t}$

Last edited: Mar 16, 2012
13. Mar 16, 2012

### LCKurtz

No it doesn't. $\sin^2\mu + (1-\cos\mu)^2$ is only zero when both terms are zero. Only $2n\pi$ works.
That's not all that is wrong. This whole section is wrong for a couple of reasons. You aren't using the correct eigenfunctions and you don't have an even function. You only have the interval (0,1).
You need to go back to the earlier equation:$$F(x,t) = a_0 + \sum_{n=0}^\infty \left( B_n \sin (2n \pi x) + A_n \cos (2n \pi x) \right) e^{-4n^2\pi^2 t}$$which gives, when $t=0$ $$x^2 = a_0 + \sum_{n=0}^\infty \left( B_n \sin (2n \pi x) + A_n \cos (2n \pi x) \right)$$You can get the correct fomulas for the coefficients by using the orthogonality of the eigenfunctions of (0,1). Have you studied Sturm-Liouville theory?

Edit--I just noticed I had the $B_n$ and $A_n$ switched from the usual use so I changed them here, not that it makes any real difference.

Last edited: Mar 16, 2012
14. Mar 18, 2012

### Gregg

Ok I don't know what to do. It's Fourier series to solve is it not? Those sin and cosines must be a basis and each of them are orthogonal? So take the inner product (integral on (0,1) ) to eliminate them?

15. Mar 18, 2012

### LCKurtz

That's right. This series:$$x^2 = a_0 + \sum_{k=0}^\infty \left( B_k \sin (2k \pi x) + A_k \cos (2k \pi x) \right)$$ will work. Sturm-Liouville theory guarantees they are orthogonal on (0,1) so just work out the appropriate calculations. For example to calculate $B_n$ multiply both sides by $\sin(2n\pi x)$ and integrate over (0,1) and solve for it. Similarly for the others. While there may be a temptation to use the even extension of $x^2$, which is itself, on (-1,1), and go for a cosine series, I don't think there is any guarantee these functions form a basis there.

16. Mar 18, 2012

### Gregg

$A_0 = \int_{0}^{1} x^2 dx = \frac{1}{3}$

$A_n = 2 \int_{0}^{1} x^2 \cos (2 n \pi x) dx = \frac{1}{n^2 \pi^2}$

$B_n = 2 \int_{0}^{1} x^2 \sin (2 n \pi x) dx= -\frac{1}{n \pi}$

$\phi(x) = \frac{1}{3} + \sum_{n=1}^{\infty} \left[ \frac{1}{n^2 \pi^2} \cos(2 n \pi x) - \frac{1}{n \pi} \sin(2 n \pi x) \right]$ ?

Last edited: Mar 18, 2012
17. Mar 18, 2012

### LCKurtz

Yes. Those coefficients are correct. Your sum should go from 1 to ∞. If you have Maple or similar you can plot the first 10 terms or so and see it converging to the parabola on (0,1).

18. Mar 18, 2012

### LCKurtz

Remember that your solution should look like the above with your coefficients in there.

Last edited: Mar 18, 2012