# PDE - Separation of Variables

erok81

## Homework Statement

Solve the boundary value problem for a string of unit length, subject to the given conditions.

$$f(x)=0.05sin \pi x, g(x)=0, c=\frac{1}{\pi}$$

## Homework Equations

Model: u(x,t)=X(x)T(t)

Which yields two separated equations by the one dimensional wave equation.

X''-kX=0 and T''-kc2T=0

## The Attempt at a Solution

This is my first problem using this new tool to solve PDE's, so I'll probably need a few tips along the way.

So I start by solving X''-kX=0 since my boundary conditions are in x. (is this right? the book's example starts like that)

This is the point I am stuck on. I think in order to start solving I need to apply the boundary conditions, I assume to avoid non trivial solutions? I can start solving my new ODE in x, but I think I am missing a step in-between?

Homework Helper
Gold Member
X''-kX=0 and T''-kc2T=0

If k>0, then you have a sign error. The equations should read

X''+kX=0 and T''+kc2T=0

otherwise you won't get periodic solutions.

This is the point I am stuck on. I think in order to start solving I need to apply the boundary conditions, I assume to avoid non trivial solutions? I can start solving my new ODE in x, but I think I am missing a step in-between?

Find the most general solution to the odes first and then apply the boundary condition.

erok81
If k>0, then you have a sign error. The equations should read

X''+kX=0 and T''+kc2T=0

otherwise you won't get periodic solutions.

Is it just set that way in order to get periodic solutions?

I got the sign that way from setting (X''/X)=k then X''=kX, setting equal to zero let me to X''-kX=0.

But then again my book sets k=mu2 where mu is > 0. But in the books example that leads to a trivial solution.Then with k=0, again trivial. So they then try, k=-mu2 < 0.

This then gives the sign switch like you mentioned and then a non-trivial answer. Does that follow with what you said - switching the sign makes it periodic, assuming that avoids the non-trivial solution. Or should all three cases be examined every time?

Oh wait....I think they just do it backwards from what I think you are doing. They use BC first to find which are non-trivial, then solve. With your method do you solve first, then apply the BC?

Find the most general solution to the odes first and then apply the boundary condition.

I'll give this a try.

Thanks for the help.

erok81
I guess my whole issue is I don't know how to use the boundary conditions. I can do the three cases, when k>0, k=0, and k<0. But then I am lost.

Homework Helper
Gold Member
But then again my book sets k=mu2 where mu is > 0. But in the books example that leads to a trivial solution.Then with k=0, again trivial. So they then try, k=-mu2 < 0.

This then gives the sign switch like you mentioned and then a non-trivial answer. Does that follow with what you said - switching the sign makes it periodic, assuming that avoids the non-trivial solution. Or should all three cases be examined every time?

Oh wait....I think they just do it backwards from what I think you are doing. They use BC first to find which are non-trivial, then solve. With your method do you solve first, then apply the BC?

In the case of a general PDE, it can be tough to apply the boundary conditions without either knowing the solution or at least some of its properties. In this case, we can find the solutions for each class of $$k$$ value and then compare to the boundary conditions. (which you still haven't completely described in your posts).

For X'' = k X, when k>0, the solutions look like real exponentials, when k=0 we have a linear function and when k<0 we get sinusoids. It would be a good exercise for you to determine exactly what boundary conditions apply to the string in this problem and determine why the k>0 and k=0 cases can't satisfy them.

Rereading your first post, you haven't really defined what the functions f(x) and g(x) refer to. Are they the values of u(x,0)? The boundary value problem also requires some information about the values of the solution at the ends of the string, which would probably be u(0,t) and u(L,t) or something similar. You should check your class notes or text to determine the proper context for this problem.

erok81
Ok, looking at it again it refers to examples that were previously in the section. I thought the problem replaced the example stuff. Here is everything that pertains to the problem.

(1) $$\frac{\partial^2u}{\partial t^2}=c^2 \frac{\partial^2u}{\partial x^2}, 0 < x < L, t > 0$$

(2) Boundary conditions: u(0,t)=0 and u(L,t)=0 for all t>0

(3) Initial conditions: u(x,0)=f(x) and ut=g(x) for 0 < x < L

Problem: solve the boundary value problem (1)-(3) for a string of unit length, subject to the given conditions.

$$f(x)=0.05sin \pi x, g(x)=0, c=\frac{1}{\pi}$$

I stupidly assumed those replaced the conditions (1)-(3), but now I see they don't.

So three cases. Solving for X''-kX=0

1. When k is positive, say k=mu2, with mu>0. Equation X becomes: X''-mu2X=0

General solution is X(x)=c1emux+c2e-mux

2. When k=0, X becomes X''=0

General solution X(x)=c1+xc2

3. When k=-mu2 with mu<0. Equation X becomes X''+muX=0.

General solution X(x)=c1cos(mux)+c2sin(mux)

So now I can apply (2) Boundary conditions: u(0,t)=0 and u(L,t)=0 for all t>0 to see which give real/trivial solutions?

Homework Helper
Gold Member
So now I can apply (2) Boundary conditions: u(0,t)=0 and u(L,t)=0 for all t>0 to see which give real/trivial solutions?

Right, you want to see if there are any values of the parameters ($$\mu$$ included) such that the boundary conditions are satisfied. After treating the 3 cases, you can solve for the time dependence and then examine the initial conditions.

erok81
Well...I got it. But I am not even remotely close to the back of the book answer.

Here's what I have.

The only one that didn't yield a trivial solution was when k=-µ2 with µ<0.

General solution X(x)=c1cos(µx)+c2sin(µx)

Applying the given boundary conditions.

X(0)=0 implies that c1=0, X(L)=0 then implies that c2sin(µL)=0.

In order for that to be true µ must equal integer values of π. Therefore µ becomes n*π/L.

Hence X(x)=sin(n*π*x/L). So inserting this value of k from before (k=-µ2) I obtain:

$$T''+(\frac{c n \pi}{L})^2 T=0$$

This then gives a general solution of $$b_n cos(\frac{c n \pi}{L}t)+b^{*}_{n}sin(\frac{c n \pi}{L})$$

Then...

$$u(x,t)=\sum^{\infty}_{n=1} sin(\frac{n \pi x}{L})*(b_n cos(\frac{c n \pi}{L}t)+b^{*}_{n}sin(\frac{c n \pi}{L})$$

So...now to solve for my bn's.

$$b_{n}=\frac{2}{L}\int^{L}_{0}0.05sin(\pi x)*sin(\frac{n \pi x}{L})dx$$

This gives me a huge answer from Maple. The solution manual says my bn should be 0. So I have made a mistake somewhere, because that definitely doesn't equal zero.

I hope this post makes sense. This problem is getting long.

Last edited:
Homework Helper
Gold Member
$$b_{n}=\frac{2}{L}\int^{L}_{0}0.05sin(\pi x)*sin(\frac{n \pi x}{L}dx$$

This gives me a huge answer from Maple. The solution manual says my bn should be 0. So I have made a mistake somewhere, because that definitely doesn't equal zero.

I hope this post makes sense. This problem is getting long.

One thing that will simplify the integral is the part of the problem that said we had a unit string, so L=1. We're still left with a kind of nontrivial integral. The easiest way to do it is use

$$\sin \theta = \frac{e^{i\theta} - e^{-i\theta}}{2i}.$$

You should find that $$b_1$$ is nonzero, but all the other $$b_{n>1}=0$$. This is a special case of orthogonal functions that you'll no doubt see more of in the future.

erok81
Oh hey, what do you know. That made a huge difference. I'm getting closer.

Thanks again for the help. Typing this up and your pointers have helped me tremendously. I'd still be stuck at step one if not for the help.

erok81
Now that I've done a few of these they are making sense. I do however have one final question...I hope. It is regarding when b1 is non-zero and the remaining bn's are zero.

Here is an example from a problem I just finished.

$$b^{*}_{n}=\frac{-2sin(n\pi)}{n\pi^{2}(n^{2}-1)}$$

The solution manual claims b1*=1/Π and the remaining bn's are zero.

First if I put in n=1 I get a singularity. Discounting that (for illustration purposes only) any integer I put in the top will yield zero.

What am I missing?

Homework Helper
Gold Member
First off, you could see if you can make sense of

$$\lim_{n\rightarrow 1} b_n^*$$

via l'Hopital's rule. Second, you could examine the integral that lead to $$b_n^*$$ and see if you get a nonsingular answer when you set $$n=1$$ explicitly.

erok81
First off, you could see if you can make sense of

$$\lim_{n\rightarrow 1} b_n^*$$

via l'Hopital's rule. Second, you could examine the integral that lead to $$b_n^*$$ and see if you get a nonsingular answer when you set $$n=1$$ explicitly.

Oh hey, what do you know. If I set n=1 in the original integral, I get 1/pi like the solution manual.

Does this usually only apply to n=1? I want to make sure I don't miss these in the future. Is the best method just to set n=1 (if that is the only case it happens) and just integrate again to check? Or is there a trick to seeing it?

Or just take $$\lim_{n\rightarrow 1} b_n^*$$ of the final answer and check that way? That seems easier to me, and I can see that it would equal 1/Pi as well.

So I guess the main question is, does that just apply to n=1?

$$\int_0^1 \sin (n\pi x) \sin(m \pi x) dx = \frac{1}{\pi(m^2-n^2)} [ n \sin( m \pi) \cos(n\pi) - m \cos(m\pi)\sin(n\pi)].$$
This is zero whenever $$n\neq m$$, but if we set $$n=m$$ on the RHS we find an indeterminate form. It's well-defined in a limit as 1/2, which is what we'd have obtained if we took $$n=m$$ before integrating.