# Heat equation problem so confusing

## Homework Statement

The problem is f(x) = sin2πx - (1/πsquare)*sinπx

and its given Bn sin (nπx) = f(x)

Question is find Bn.

## Homework Equations

Bn = 2/L ∫ (sin2πx - (1/πsquare)*sinπx) * sin(nπx/L) where L is 1

## The Attempt at a Solution

I did
[/B]
∫ sin2πx * sin (nπx) - (1/πsquare)*sin square πx
then I tried changing it to cos but it doesn't make sense, for the first term ∫sin2πx * sin (nπx)
∫sin2πx * sin (nπx) = -1/2 ∫cos(2π+nπ)-cos(2π-nπ)

But how do i actually integrate the above with the n in it i am so confused.....I know cosnπ = (-1)^n but I can only use that after final integration and even if I finally somehow manage to integrate it, it will be changed to sinnπ. Please can anyone help!!!
. Is there any simple way to do this?

haruspex
Homework Helper
Gold Member
The problem is f(x) = sin2πx - (1/πsquare)*sinπx

and its given Bn sin (nπx) = f(x)
That doesn't make sense. Please correct the problem statement.

Chestermiller
Mentor
Did you mean to have a summation sign in front of the Bnsin(nπx)?

Ray Vickson
Homework Helper
Dearly Missed

## Homework Statement

The problem is f(x) = sin2πx - (1/πsquare)*sinπx

and its given Bn sin (nπx) = f(x)

Question is find Bn.

## Homework Equations

Bn = 2/L ∫ (sin2πx - (1/πsquare)*sinπx) * sin(nπx/L) where L is 1

## The Attempt at a Solution

I did
[/B]
∫ sin2πx * sin (nπx) - (1/πsquare)*sin square πx
then I tried changing it to cos but it doesn't make sense, for the first term ∫sin2πx * sin (nπx)
∫sin2πx * sin (nπx) = -1/2 ∫cos(2π+nπ)-cos(2π-nπ)

But how do i actually integrate the above with the n in it i am so confused.....I know cosnπ = (-1)^n but I can only use that after final integration and even if I finally somehow manage to integrate it, it will be changed to sinnπ. Please can anyone help!!!
. Is there any simple way to do this?

$$\sum_{n=1}^{\infty} B_n \sin(n \pi x) =\sin(2 \pi x) - \frac{1}{\pi^2} \sin(\pi x)$$

$$\sum_{n=1}^{\infty} B_n \sin(n \pi x) =\sin(2 \pi x) - \frac{1}{\pi^2} \sin(\pi x)$$

Yesss! I didn't know how to insert the symbols like that, but yes that's exactly my question. Is there any simple way to find Bn? Many thanks

Chestermiller
Mentor
Yesss! I didn't know how to insert the symbols like that, but yes that's exactly my question. Is there any simple way to find Bn? Many thanks
Just write out the first two terms of the summation on the left hand side and see what you get.

Chet

Just write out the first two terms of the summation on the left hand side and see what you get.

Chet

Sorry how do i do that? is it just Bn Sin(πx) + Bn sin (2πx)

I just used n =1 and n =2. Is that correct?

Chestermiller
Mentor
Sorry how do i do that? is it just Bn Sin(πx) + Bn sin (2πx)

I just used n =1 and n =2. Is that correct?
No. It's B1sin(πx)+B2sin(2πx).

Now compare that with the right hand side of your equation.

Chet

No. It's B1sin(πx)+B2sin(2πx).

Now compare that with the right hand side of your equation.

Chet

So B1 = -1/π square and B2 = 0, right? So do I just take Bn as -1/π square then? Isn't Bn a general constant for all the B values in the summation? I am just confused how two different B values can have the similar Bn value.

Sorry I meant B2 = 1

Chestermiller
Mentor
So do I just take Bn as -1/π square then?
No. You take B1=-1/π2, B2 = 1, B3...B = 0
Isn't Bn a general constant for all the B values in the summation? I am just confused how two different B values can have the similar Bn value.
I don't understand this question.

Chet

No. You take B1=-1/π2, B2 = 1, B3...B = 0

I don't understand this question.

Chet

You know heat equation solution is in a format of T(x,t) = Bn*sin(nπx)*e^-(nsquare*pi square* t) - T(x). So you are saying I will have one T(x,t) equation with B1 and another T(x,t) equation with B2? Do I add up both the equations together to get a final T(x,t) solution.

Chestermiller
Mentor
You know heat equation solution is in a format of T(x,t) = Bn*sin(nπx)*e^-(nsquare*pi square* t) - T(x). So you are saying I will have one T(x,t) equation with B1 and another T(x,t) equation with B2? Do I add up both the equations together to get a final T(x,t) solution.

You seem very confused. This is not the proper venue to teach you the entire solution approach over again. You need to go back and review your notes and text.

Chet

O

You seem very confused. This is not the proper venue to teach you the entire solution approach over again. You need to go back and review your notes and text.

Chet

No I am just confused which format should I present my answer. Do I just put the summation sign infront of Bn and then write when n = 1 bn = -1/pi square. And when n = 2 Bn= 1.

Ray Vickson
Homework Helper
Dearly Missed
You know heat equation solution is in a format of T(x,t) = Bn*sin(nπx)*e^-(nsquare*pi square* t) - T(x). So you are saying I will have one T(x,t) equation with B1 and another T(x,t) equation with B2? Do I add up both the equations together to get a final T(x,t) solution.

When you write "nsquare" do you mean n^2? By pi square do you mean pi^2? Where is the summation in front of your nth term? (In text you can just write sum_{n} B_b... if you don't want to try using LaTeX and you don't want to use fancy symbols.

Yes exactly that's what I mean. And yes there will be the summation sign, apologies. So is that it then? I just write T(x,t) = sum_{n}B_n *sin(nπx)*e^-(n^2*pi^2* t) - T(x). Then I just mention when n =1 and 2 there will be corresponding B values. Will that be the final answer?

Ray Vickson
Homework Helper
Dearly Missed
Yes exactly that's what I mean. And yes there will be the summation sign, apologies. So is that it then? I just write T(x,t) = sum_{n}B_n *sin(nπx)*e^-(n^2*pi^2* t) - T(x). Then I just mention when n =1 and 2 there will be corresponding B values. Will that be the final answer?

Why bother with the summation? You just have two terms, so just writing them out in detail answers the question.

LCKurtz
Homework Helper
Gold Member
To the OP: Setting your heat equation problem aside, what you need to understand is that some FS are finite. For example if you want to expand ##f(x) = 5\sin(3x) + 3\sin(4x)## in a half range sine expansion on ##(0,\pi)## you are wanting to write$$5\sin(3x) + 3\sin(4x) = \sum_{n=1}^\infty b_n \sin(nx) = b_1\sin(x)+b_2\sin(2x) + b_3\sin(3x)+b_4\sin(4x)+...$$As you noticed in your original post, solving for the ##b_n## can be very tedious and requires working the integrals for ##b_3## and ##b_4## separately. Actually, I don't think you got that far in those calculations. But looking at the above equation you can see by inspection that taking ##b_3=5,~b_4=3## and all the other ##b_n=0## makes the two sides identical. The FS for this function has finitely many nonzero terms, and in fact, the function itself is its own FS.

Similarly, in your solution, you will have only a couple of nonzero terms in your FS and consequently won't need any infinite sum in your answer. Just write out the nonzero terms.

To the OP: Setting your heat equation problem aside, what you need to understand is that some FS are finite. For example if you want to expand ##f(x) = 5\sin(3x) + 3\sin(4x)## in a half range sine expansion on ##(0,\pi)## you are wanting to write$$5\sin(3x) + 3\sin(4x) = \sum_{n=1}^\infty b_n \sin(nx) = b_1\sin(x)+b_2\sin(2x) + b_3\sin(3x)+b_4\sin(4x)+...$$As you noticed in your original post, solving for the ##b_n## can be very tedious and requires working the integrals for ##b_3## and ##b_4## separately. Actually, I don't think you got that far in those calculations. But looking at the above equation you can see by inspection that taking ##b_3=5,~b_4=3## and all the other ##b_n=0## makes the two sides identical. The FS for this function has finitely many nonzero terms, and in fact, the function itself is its own FS.

Similarly, in your solution, you will have only a couple of nonzero terms in your FS and consequently won't need any infinite sum in your answer. Just write out the nonzero terms.

Alright so my solution will be like this :

T(x,t) = b1sin(πx)*e^-(n^2*pi^2* t)+b2sin(2πx)*e^-(n^2*pi^2* t) - T(x).

Is that correct for the final answer?

LCKurtz
Homework Helper
Gold Member
Alright so my solution will be like this :

T(x,t) = b1sin(πx)*e^-(n^2*pi^2* t)+b2sin(2πx)*e^-(n^2*pi^2* t) - T(x).

Is that correct for the final answer?

No. You have undefined ##n##'s on the right side and undefined ##b_1## and ##b_2## on the left.

No. You have undefined ##n##'s on the right side and undefined ##b_1## and ##b_2## on the left.

The n's are going to be 1 and 2 respectively. B1 = -1/pie square and b2 = 1. Is that correct now?

LCKurtz
Homework Helper
Gold Member
If you wrote that out I think it would finally make sense. Is it correct? Who knows? You never wrote out the heat equation or showed your work getting the solution.

∑n=1∞Bnsin(nπx)=sin(2πx)−1π2sin(πx)​
\sum_{n=1}^{\infty} B_n \sin(n \pi x) =\sin(2 \pi x) - \frac{1}{\pi^2} \sin(\pi x)

How would I go about finding Bn if the right hand side was instead cos(2πx) - 1/π^2 *(sin(πx)? Can you please tell me. Thanks.

$$\sum_{n=1}^{\infty} B_n \sin(n \pi x) =\sin(2 \pi x) - \frac{1}{\pi^2} \sin(\pi x)$$

How would I go about finding Bn if the right hand side was instead cos(2πx) - 1/π^2 *(sin(πx)? Can you please tell me. Thanks.

Ray Vickson
Homework Helper
Dearly Missed
How would I go about finding Bn if the right hand side was instead cos(2πx) - 1/π^2 *(sin(πx)? Can you please tell me. Thanks.

You wouldn't. The formula ##f(x) \equiv \sum_{n} B_n \sin(n \pi x)## describes an odd function of ##x##---that is--a function giving ##f(-x) = - f(x)##. Your new function does not have this property, so cannot be expressed in the form you want.

You wouldn't. The formula ##f(x) \equiv \sum_{n} B_n \sin(n \pi x)## describes an odd function of ##x##---that is--a function giving ##f(-x) = - f(x)##. Your new function does not have this property, so cannot be expressed in the form you want.

Okay fine. So it will be Summation of An cos (nπx) = cos(2πx) - 1/π^2 *(sin(πx)

Now how will I solve this....Do I really need to integrate or I can compare sides and find coefficient. Please tell me...

Ray Vickson
Homework Helper
Dearly Missed
Okay fine. So it will be Summation of An cos (nπx) = cos(2πx) - 1/π^2 *(sin(πx)

Now how will I solve this....Do I really need to integrate or I can compare sides and find coefficient. Please tell me...
Okay fine. So it will be Summation of An cos (nπx) = cos(2πx) - 1/π^2 *(sin(πx)

Now how will I solve this....Do I really need to integrate or I can compare sides and find coefficient. Please tell me...

What you wrote is incorrect: the summation will not be ##\sum_n A_n \cos(n \pi x)## and not be ##\sum_n B_n \sin(n \pi x)##, but both.

You really do need to do some reading on these issues; look up Fourier series, and make sure you understand the material before trying to use it. Make sure you go through some of the illustrative examples that will be present in any textbook that treats the subject.

• Chestermiller
What you wrote is incorrect: the summation will not be ##\sum_n A_n \cos(n \pi x)## and not be ##\sum_n B_n \sin(n \pi x)##, but both.

You really do need to do some reading on these issues; look up Fourier series, and make sure you understand the material before trying to use it. Make sure you go through some of the illustrative examples that will be present in any textbook that treats the subject.

No offence, but its easy to advice then actually do. I have tried it enough times already, all the text book examples have simple initial conditions, I haven't found a single example where it has trigonometric terms in the question and also as initial condition, so its not so easy to understand, specially when I am new to this entire topic. So maybe you can link me some solved examples similar to this question instead of just lecturing if you really want me to do some reading.

Ray Vickson
Homework Helper
Dearly Missed
No offence, but its easy to advice then actually do. I have tried it enough times already, all the text book examples have simple initial conditions, I haven't found a single example where it has trigonometric terms in the question and also as initial condition, so its not so easy to understand, specially when I am new to this entire topic. So maybe you can link me some solved examples similar to this question instead of just lecturing if you really want me to do some reading.

The idea of examples is that they illustrate a method; it is then up to you to apply the method in situations that are NOT covered in the textbook.

You can find relevant articles yourself; just Google "Fourier Series", and you will find dozens of web pages at various levels of sophistication. YOU choose the ones you want. I have no way of knowing which of the many articles out there are the ones that will "speak to you".

Last edited:
Chestermiller
Mentor
I tend to agree with Ray. But, maybe you can give us an example of a specific problem you are struggling with (from start to finish, not just the final equation), and we can help you through it. I don't think that the equation you presented in the initial post of this thread is a correct relationship for any heat equation problem that I have ever seen (and I've seen lots of them).

Chet