# Solve the Dirichlet problem for the heat equation

1. Apr 10, 2014

### richyw

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

Solve the Dirichlet problem for the heat equation
$$u_y=u_{xx}\quad 0<x<2\pi, \: t>0$$$$u(x,0)=\cos x$$$$u(0,t)=u(2\pi,t)=e^{-t}$$

2. Relevant equations

3. The attempt at a solution

I have no idea what to do here. It seems to me like it's a mix of the solutions we learned. I have time-dependant boundary conditions, and then an initial condition. To solve this do I have to use the reference temperature to turn it into an inhomogenous equation with homogenous boundary conditions, and then the eigenfunction expansion method, or is there an easier way?

2. Apr 10, 2014

### maajdl

Do not ask yourself if it will be easy.
Just go forward, do something.
I guess you mean ut = uxx instead of uy = uxx?

Which methods have you learned?

3. Apr 10, 2014

### richyw

yes it's supposed to be a ut

I don't know what I have learned about this type of question. I don't think I can use a general formula like I could when I had homogenous BC and a homogenous PDE.

There is a chapter in my book which shows how to switch a PDE with time-dependent non-homogenous BC into a non-homogenous PDE with homogenous boundary conditions by subtracting a reference temperature, and then you have to use the eigenfunction expansion method to solve the new problem. I keep not getting anywhere when I try to do it like this though. We really only skimmed over the whole chapter so I have never really seen an example of this method being used.

4. Apr 10, 2014

### HallsofIvy

Staff Emeritus
That's a very unfortunate thing to say! I hope you didn't really mean it the way you said it. Further, whether you intended it or not, you are saying that you know how to solve this problem, you just don't want to do the work!

One way of handling non-homogeneous boundary values is to make them homogenous (Homogenize them?) by changing the variable. Since the only boundary value given is $u(0, t)= e^{-t}$, let $y(x, t)= u(x, t)- e^{-t}$ or $u(x, t)= y(x, t)+ e^{-t}$. Then $u_{xx}= y_{xx}$ and $u_{t}= y_t- e^{-t}$ so the equation becomes $y_t- e^{-t}= y_xx$ with "initial condition" $y(x, 0)= u(x, 0)- 1= cos(x)- 1$ and "boundary condition" $y((0, t)= u(0, t)- e^{-t}= e^{-t}- e^{-t}= 0$ and $y(2\pi, t)= u(2\pi, t)- e^{-t}= 0$.

That's probably what you did. Now to solve that using the "eigenfunction expansion" method, we would recognize that eigenvectors for the operator $\partial^2/\partial x$, with boundaries at x= 0 and $x= 2\pi$ are sin(nx) for n a positive integer. So you want to write $y(x)= \sum A_n(t) sin(nx)$.

Then $y_xx= y_t$ becomes $\sum -n^2 A_n(t) sin(nx)= \sum A'_n sin(nx)$ so that we must have $A'_n= -n^2A_n$ for all n.

5. Apr 10, 2014

### pasmith

In general if you can find a solution which satisfies the boundary conditions but not necessarily the initial condition, then you can add a solution which vanishes on the boundaries and satisfies the initial condition.

This one does have an easier way, because it's an extremely special case: look for a solution of the form $u(x,t) = f(t)\cos(x)$.

6. Apr 10, 2014

### richyw

Thanks, I did do up to the eigenfunction expansion (and attempted that) before I posted here. Of course I want to do the work, but I was not sure if I was even on the right track!

could you explain to me why I don't have eigenfunction $$\phi_n(x) =\sin\left( \frac{n x}{2} \right)$$and eigenvectors$$\lambda_n=\left(\frac{n}{2}\right)^2$$
I have dirichetlet type BC, and using SOV, we have shown that the solution to the eigenvalue equation $\phi''=-\lambda \phi$ is $$\phi_n(x)=\sin\left( \frac{n \pi x}{L} \right)$$ with eigenvalues $\left(\frac{n \pi}{L}\right)^2$

7. Apr 10, 2014

### richyw

ok I am completely and utterly lost on using the eigenfunction expansion method. to solve this problem. I get the equation. I'm going to type out everything I have done. Keep in mind I have never seen the eigenfunction expansion being used, there are no worked examples in my textbook as far as I know.

$$u_t=u_{xx}\quad 0<x<2\pi, \: t>0$$
$$u(x,0)=\cos x$$
$$u(0,t)=u(2\pi,t)=e^{-t}$$

so I looked for a reference temperature r(x,t) so that r(0,t)=r(2π,t) = 0
I determined that $r(t)=e^{-t}$

then I defined$$v(x,t) = u(x,t)-r(x,t)$$$$v_t=u_{xx}-r_t+r_{xx}$$$$v_t=v_{xx}+\bar{Q}$$where $\bar{Q}=e^{-t}$now I need to solve that problem with$$v(0,t)=v(2\pi,t) = 0$$$$v(x,0)=u(x,0)-r(x,0)=\cos x -1=g(x)$$

then I want to use eigenfunction expansion (I think) so I say$$v(x,t)=\sum_{n=1}^\infty a_n(t)\phi_n(x)$$ I have dirichetlet BC so $\phi_n(x) =\sin\left( \frac{n x}{2} \right)$ and the eigenvalues are $\lambda_n=\left(\frac{n}{2}\right)^2$

then to determine $a_n(0)$ I used the formula

$$a_n(0)=\frac{\int^2\pi_0 g(x)\phi_n(x)dx}{\int^L_0 \phi^2_n(x)dx}=\frac{8(1-(-1)^2)}{\pi(n^2-4n)}$$ then to figure out the $a_n(t)$ I have $$\sum^\infty_{n=1}\left[ \frac{da_n}{dt}+\lambda_n a_n\right]\phi_n(x)=\bar{Q}(x,t)$$which gives me $$\frac{da_n}{dt}+\lambda_n a_n = \bar{q}_n(t)$$where$$\frac{\int^{2\pi}_0 \bar{Q}(x)\phi_n(x)dx}{\int^{2\pi}_0 \phi^2_n(x)dx}=\frac{2((-1)^n-1)e^{-t}}{n\pi}$$which gives me the differential equation$$\frac{da_n}{dt}+\lambda_n a_n = \frac{2((-1)^n-1)e^{-t}}{n\pi}$$

and from there I do not understand what to do.

8. Apr 10, 2014

### HallsofIvy

Staff Emeritus
An "eigenvalue",0 for operator A, is a number, $\lambda$ such that $Af= \lambda f$ has non-trivial solutions. Here, the operator is $d^2/dx^2$ with domain functions that are 0 at x= 0 and $x= 2\pi$.

If f is a function such that $d^2f/dx^2= \lambda f$ then there are three cases to consider:
1) $\lambda= 0$. In that case the differential equation is $d^2f/dx^2= 0$ which as general solution $f(x)= Ax+ B$. f(0)= A(0)+ B= 0 so B= 0. Then $f(2\pi)= 2\pi A= 0$ so A= 0. That is, f(x)= 0x+ 0= 0, the "trivial solution". There is NO "non-trivial solution. 0 is NOT an eigenvalue.

2) $\lambda> 0$. To make that explicit, let $\lambda= \alpha^2$ where $\alpha$ can be any positive number. The differential equation is $d^2y/dx^2= \alpha^2 y$ which has general solution $y= Ce^{\alpha x}+ De^{-alpha x}$. $y(0)= C+ D= 0$ and $y(2\pi)= Ce^{2\alpha\pi}+ De^{-2\alpha\pi}$. From C+ D= 0, D= -C so the second equation becomes $Ce^{2\alpha\pi}- Ce^{-2\alpha\pi}= C(e^{2\alpha\pi}- e^{-2\alpha\pi})= 0$. Since $\alpha$ is not 0, one of $e^{2\alpha\pi}$ and $e^{-2\alpha\pi}$ is greater than 1 and the other is less than 1. $e^{2\alpha\pi}- e^{-2\alpha\pi}$ is NOT 0 so we must have C= 0. Then D= -C= 0 also. The only solution is $y= 0e^{\alpha x}+ 0e^{-\alpha x}= 0$, the trivial solution. Again, there is no non-trivial solution so no positive number is an eigenvalue.

3) $\lambda< 0$. To make that explicit, let $\lambda= -\alpha^2$ where $\alpha$ can be any positive number. The general solution to $d^2y/dx^2= -\alpha^2 y$ is $y(x)= C cos(\alpha x)+ D sin(\alpha x)$. $y(0)= C cos(0)+ D sin(0)= C= 0$. Then $y(2\pi)= Dsin(2\alpha \pi)= 0$.

Now, either D= 0, in which case we have the trivial solution, or $sin(2\alpha\pi)= 0$ which happens if and only if $2\alpha\pi$ is an integer multiple of $\pi$. That is $2\alpha= n$ for some integer n. In that case we have the non-trivial solution $y= C sin(nx/2)$. So $\lambda= -\alpha^2= -n^2/4$ is an eigenvalue, for n any positive integer, with corresponding eigenfunction $sin(nx/2)$.

(We need only positive integers because sine is an odd function so $Csin((-n)x/2)= -Csin(nx/2)$ and we can incorporate the negative into the constant.)

Last edited: Apr 10, 2014
9. Apr 11, 2014

### richyw

so if I can solve the equation with u(x,0)=0 and $u(0,t)=u(2\pi,t)=e^{0t}$ and solve u(x,0)=cos(x) and $u(0,t)=u(2\pi,t)=0$ and add the solutions together?