# Homework Help: Series solution to a PDE

1. Jul 13, 2012

### Dens

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

Consider the PDE

which has the solution

3. The attempt at a solution

So what I am having trouble is solving it using this method.

I am going to say that my $$u(x,t) = \sum_{n=1}^{\infty} u_n(t) \sin(nx)$$ and $$x \sin(t) = \sum_{n=1}^{\infty}h_n(t)\sin(nx)$$

The reason I chose sine for my inhomogeneous term is because my book recommends it. But I think it is because if I use cosine, I would get a $$\frac{a_0}{2}$$ term and it would be difficult.

To solve for the coefficients of $$h_n(t)$$, I get $$h_n(t) = \frac{2}{\pi}\int_{0}^{\pi} x\sin(t) \sin(nx) dx = \frac{2\sin(t)(-1)^n}{n}$$

Substituting everything into $$u_{tt} = u_{xx} + x\sin(t)$$ gives me

$$\sum_{n=1}^{\infty}u''_n(t) \sin(nx) + \sum_{n=1}^{\infty}u_n(t)n^2\sin(nx) = \sum_{n=1}^{\infty}\frac{2\sin(t)(-1)^n}{n}\sin(nx)$$

Dividing out that sine, I'll get

$$\sum_{n=1}^{\infty}u''_n(t) + \sum_{n=1}^{\infty}u_n(t)n^2 = \sum_{n=1}^{\infty}\frac{2\sin(t)(-1)^n}{n}$$

Here is where I am stuck, can someone tell me what value of n to use?

Because I could get an ODE with many ns

Did I overlooked something?

Thank you very much

2. Jul 13, 2012

### schliere

Why are you saying that

$x sin(t)=\sum_{n=1}^{∞}h_n(t)sin(nx)$

?

What if you chose a solution that was periodic in time with an unknown function of x, rather than the other way around?

Last edited: Jul 13, 2012
3. Jul 13, 2012

### Dens

It's a technique my book uses.

You recommend using $$\sum_{n=1}^{∞}h_n(x)\sin(nt)$$?

4. Jul 14, 2012

### schliere

Nevermind, that way should work. However, you seem to have miscalculated your h_n. One trick you can do (if you have time and the ability to do so) is to plot the series (to a reasonable amount of terms) and see if it matches the function you're trying to represent.

Anyway, you're actually on your way. Continue for the "nth" value of n. Basically you take away all the summations and you can solve the second-order ODE for a function of t. You should be able to find the n's in the x function by using the boundary conditions and for the n's in the time function by using the initial conditions.

5. Jul 14, 2012

### Dens

That can't be right because I used WolframAlpha to compute the integral.

http://www.wolframalpha.com/input/?i=Integrate[x*Sin[t]*Sin[n*x]%2C{x%2C0%2CPi}]

The sine disappears because n is an integer

6. Jul 14, 2012

### Dens

Alright, I tried a new technique. Instead of worrying about the ns that may vary. I used a substitution $$a = 2\frac{(-1)^n}{n}$$

So my ODE becomes

$$u'' + n^2 u = a\sin(t)$$

Solving http://www.wolframalpha.com/input/?i=u%27%27+%2B+n^2+u+%3D+a*sin[t]

I get

$$u(t) = 2\frac{(-1)^n\sin(t)}{n(n^2 - 1)} + c_1 \sin(nt) + c_2 \cos(nt)$$

Hence

$$u(x,t) = \sum_{n=1}^{\infty} \left (2\frac{(-1)^n\sin(t)}{n(n^2 - 1)} + c_1 \sin(nt) + c_2 \cos(nt) \right )\sin(nx)$$

Okay so my answer now looks MORE identical to the solution. But something is still off