# Homework Help: 1D Heat Equation BC: Both ends insulated, IC: piecewise function

1. Oct 26, 2008

### PAR

1. Solve the one dimensional heat equation for a rod of length 1 with the following boundary and initial conditions:

BC: $$\partial$$u(0,t)/$$\partial$$t = 0
$$\partial$$u(1,t)/$$\partial$$t = 0 these are the wrong boundary conditions (see below)

Actual BC: $$\partial$$u(0,t)/$$\partial$$x = 0
$$\partial$$u(1,t)/$$\partial$$x = 0

IC:
u(x,0) = { 1 if 0$$\leq$$x$$\leq$$.5
u(x,0) = { 0 if .5<x$$\leq$$1

2. $$\partial$$u/$$\partial$$t = a2$$\partial$$$$^{2}$$u/$$\partial$$x$$^{2}$$

3.

I used separation of variables and applied the boundary conditions to get the following:
u(x,t) = e(-(a2)(n*Pi)2*t) * (B*cos(n*Pi*x)) where
n= 1, 2, 3... and B is an unknown constant.

To find B I tried applying the initial conditions and thats where I got stuck because I got.

u(x,0) = 0 = B*cos(n*Pi*x) if 0$$\leq$$x$$\leq$$.5
u(x,0) = 1 = B*cos(n*Pi*x) if .5<x$$\leq$$1

Does this mean that B has two values depending on x? And if is so are those values:

B = 0 for 0$$\leq$$x$$\leq$$.5
B = 1/cos(n*Pi*x) for .5<x$$\leq$$1

As a follow-up, will the steady state of this heat equation problem be a piecewise function?

Last edited: Oct 26, 2008
2. Oct 26, 2008

### gabbagabbahey

Shouldn't it be a sine instead of a cosine? (take a look at your BCs cos(0)=1 not 0)

Also, since that solution satisfies the heat equation and your boundary conditions for any integer value of n, shouldn't the general solution be a linear combination of each of your solutions, namely:

$u(x,t)=\sum_{n=0}^{\infty} u_n(x,t)=\sum_{n=0}^{\infty}B_ne^{-a^2n^2 \pi^2 t}sin(n \pi x)$

???

Remember, your B_n's are constants so they cannot depend on x. Use Fourier's method to determine them.

3. Oct 26, 2008

### PAR

Sorry, I miss-typed the boundary conditions, the boundary conditions are supposed to be:

$$\partial$$u(0,t)/$$\partial$$x = 0
$$\partial$$u(1,t)/$$\partial$$x = 0

I'll edit it to the correct version in the original post too.

So I think that the solution is the linear combination:

$$u_{n}(x,t) =$$$$\sum(B_{n}e^{-a^2n^2\pi^2t}cos(n\pi\\x))$$ going from n = 1 to infinity

So now I set the sum equal to initial condition right?

I get:

$$u_{n}(x,0) = 1 = \sum(B_{n}cos(n\pi\\x))$$ for 0<=x<=1/2

I use fouriers method to find the B's in each interval:

$$B_{n} = 2 \int^{1/2}_{0}cos(n\pi\\x)= 2 sin(n\pi\\x)/(n\pi)\right|^{1/2}_{0} = 2(sin(n\pi/2)/(n\pi) = 2(-1)^n/(n\pi)$$

Unfortunately I'm stuck again, when I try to solve for the B's in the interval 1/2<x<=1

I get:

$$u_{n}(x,0) = 0 = \sum(B_{n}cos(n\pi\\x))$$

$$B_{n} = 2 \int^{1}_{1/2} 0*cos(n\pi\\x) = 0$$

Is this correct? Are the B's for 1/2<x<=1 all 0?

And sorry again about giving the wrong boundary conditions!

4. Oct 26, 2008

### gabbagabbahey

Okay, so doesn't that mean that

$\sum_{n=0}^{\infty} B_n cos(n \pi x)=u(x,0)=\left\{ \begin{array}{lr} 1, & 0 \leq x \leq 0.5 \\ 0, & 0.5< x \leq 1 \end{array}$

$\Rightarrow \sum_{m=0}^{\infty} \int_0^1 B_m cos(m \pi x) cos(n \pi x)dx = \int_0^1 u(x,0) cos(n \pi x) dx=\int_0^{0.5} (1)cos(n \pi x) dx+ \int_{0.5}^1 (0)cos(n \pi x) dx$

;0)

Remember, your B_n's are constant so they must be the same for all values of x.

5. Oct 26, 2008

### PAR

Ok,

so $$\int^{1}_{0}cos(n\pi\\x)*cos(m\pi\\x) = 0$$ if $$m \neq n$$

so, I've taken the integral of

$$\int^{1}_{0}cos(n\pi\\x)^2dx$$

And assuming n = positive integer I get

$$\int^{1}_{0}cos(n\pi\\x)^2dx = 1/2$$

and I know that $$\int^{1}_{0}u(x,0)cos(n\pi\\x)dx = -1^n/(n\pi)$$

So I get

$$\sum^{\infty}_{n=1}B_{n}(1/2) = (-1)^n/(n\pi)$$

Reading from my textbook and online I am guessing I should multiply both sides by 2 (or divide by 1/2) which would yield the same answer as in my previous post:

$$B_{n} = 2(-1)^n/(n\pi)$$

But I am confused by this last step: How does multiplying by both sides by 2 "remove" the $$B_{n}$$ from out of the summation? Wouldn't it just remove the 2 from the summation and the left hand side of the equation would just be

$$\sum^{\infty}_{n=1}B_{n}$$?

I realize that I am expected to know these things before I enter a partial differential equations course, but after taking 7 college math classes I still haven't learned these basic principles of sums and it's really holding me back.

Oh, and thanks for the help so far gabbagabbahey, but I still have much to learn.

6. Oct 26, 2008

### gabbagabbahey

The summation sign is removed when you integrate $\sum_{m=0}^{\infty} \int_0^1 B_m cos(m \pi x) cos(n \pi x)dx$, because the only term that is non-zero is m=n

$\Rightarrow \sum_{m=0}^{\infty} \int_0^1 B_m cos(m \pi x) cos(n \pi x)dx=\frac{B_n}{2}+ \sum_{m \neq n} (0)B_m=\frac{B_n}{2}$

$\Rightarrow \frac{B_n}{2}=\frac{(-1)^n}{n \pi}$

or

$B_n=\frac{2(-1)^n}{n \pi}$