# Solving PDE by using another function

#### Markov

##### Member
Solve

\begin{aligned} & {{u}_{tt}}={{c}^{2}}{{u}_{xx}}+A{{e}^{-x}},\text{ }0<x<L,\text{ }t>0, \\ & u(0,t)=B,\text{ }u(L,t)=M,\text{ }t>0, \\ & u(x,0)=0={{u}_{t}}(x,0),\text{ 0}<x<L. \end{aligned}

What do I need to do first? Homogenize the first boundary conditions? Or first making the equation homogeneous? What's the shorter way?

#### Jester

##### Well-known member
MHB Math Helper
First, introduce a new variable $v(t,x)$ such that $u(t,x) = v(t,x) + ax + b$ and choose $a$ and $b$ such that

$u(0,t)=B$ becomes $v(0,t) = 0$

and

$u(L,t)=M$ becomes $v(L,t) = 0$.

Then see how the PDE and IC's change.

#### Markov

##### Member
Okay you mean take $w(x,t)=u(x,t)-v(x,t)$ where $v(x,t)=B-(B-M)\dfrac xL,$ then $w(x,t)$ satisfies the first boundary conditions, is this the procedure?

#### Jester

##### Well-known member
MHB Math Helper
Next, to solve the homogenous problem

$w_{tt} = c^2 w_{xx}$

$w(0,t) = 0, w(L,t) = 0$

you would use separation of variables leading to

$u = \displaystyle\sum_{n=1}^{\infty} b_n \sin \dfrac{c n \pi}{L}t \sin \dfrac{n\pi}{L}x$.

However, since the new PDE is nonhomogeneous, you'll need to expand the source term (the exponential) in terms of a Fourier sine series and then seek a solution of the form

u = $\displaystyle\sum_{n=1}^{\infty} T_n(t) \sin \dfrac{n\pi}{L}x$.

See where that takes you.

#### Markov

##### Member
Okay, it looks a bit messy from there. I homogenized first the equation, so I let $v(x,t)=u(x,t)+\dfrac{A{{e}^{-x}}}{{{c}^{2}}}$ so that $u(x,t)=v(x,t)-\dfrac A{c^2}e^{-x}$ then $u_{tt}=v_{tt}$ and $u_x=v_x+\dfrac A{c^2}e^{-x}$ and $u_{xx}=v_{xx}-\dfrac A{c^2}e^{-x}$ so replacing this to the ODE I get $v_{tt}=c^2\left(v_{xx}-\dfrac A{c^2}e^{-x}\right)+Ae^{-x}=c^2v_{xx}.$ Now the boundaries are $u(0,t)=v(0,t)-\dfrac A{c^2}=B$ so $v(0,t)=B+\dfrac A{c^2}$ and $u(L,t)=v(L,t)-\dfrac A{c^2}e^{-L}=M$ so $v(L,t)=M+\dfrac A{c^2}e^{-L}$ and finally $u(x,0)=v(x,0)-\dfrac A{c^2}e^{-x}=0\implies v(x,0)=\dfrac A{c^2}e^{-x}$ and $u_t(x,0)=v_t(x,0)$ so the new equation equals:

\begin{aligned} & {{v}_{tt}}={{c}^{2}}{{v}_{xx}} \\ & v(0,t)=B+\frac{A}{{{c}^{2}}},\text{ }v(L,t)=M+\frac{A}{{{c}^{2}}}{{e}^{-L}} \\ & v(x,0)=\frac{A}{{{c}^{2}}}{{e}^{-x}},\text{ }{{v}_{t}}(x,0)=0. \end{aligned}

Do I need to define another function to homogenize boundary conditions? I'm worry about this since the $v(x,0)$ condition is not zero, how to proceed? Am I on the right track?

#### Markov

##### Member
I managed to get it. I was drowning myself on a glass of water, I hadn't checked my notes. Thanks for the help anyway!