# How do we choose this function?

#### evinda

##### Well-known member
MHB Site Helper
Hello!!!

I am looking at the following exercise:

Find the solution $u(t,x)$ of the problem

$$u_t-u_{xx}=2 \sin{x} \cos{x}+ 3\left( 1-\frac{x}{\pi}\right)t^2, t>0, x \in (0,\pi) \\ u(0,x)=3 \sin{x}, x \in (0,\pi) \\ u(t,0)=t^3, u(t, \pi)=0, t>0$$

At the suggested solution, it is stated that the boundaries are non-zero, so we want to set them equal to $0$.

We set $v=u-\left( 1-\frac{x}{\pi}\right) t^3-\frac{x}{\pi} \cdot 0 \Rightarrow v=u-t^3+t^3 \frac{x}{\pi}$.

Could you explain to me why we take this $v$? Is there a formula that we use that enables us to solve the problem?

#### Klaas van Aarsen

##### MHB Seeker
Staff member
At the suggested solution, it is stated that the boundaries are non-zero, so we want to set them equal to $0$.

We set $v=u-\left( 1-\frac{x}{\pi}\right) t^3-\frac{x}{\pi} \cdot 0 \Rightarrow v=u-t^3+t^3 \frac{x}{\pi}$.

Could you explain to me why we take this $v$? Is there a formula that we use that enables us to solve the problem?
Hey evinda !!

$v$ is selected so that $v(t,0)=0$ and $v(t,\pi)=0$ to simplify the problem.
Then, if we can find a solution for $v$, we can also find a solution for $u$.

We can achieve that if we pick $v(t,0)=u(t,0)-t^3$ and $v(t,\pi)=u(t,0)-0$.
Now we still need to introduce $x$ such that both conditions are satisfied.
To do so, we pick $v(t,x)=u(t,x)-A(x)\cdot t^3-B(x)\cdot 0$, where $A(x), B(x)$ are functions of $x$ such that $A(0)=1$ and $A(\pi)=0$, and $B(0)=0$ and $B(\pi)=1$.
Simplest $A$ and $B$ are the linear functions $A(x)=1-\frac x\pi$ respectively $B(x)=\frac x\pi$.
Substitute to find $v(t,x)=u(t,x)-\left(1-\frac x\pi\right)\cdot t^3-\frac x\pi\cdot 0$.

#### Country Boy

##### Well-known member
MHB Math Helper
In particular, if we have boundary conditions, u(0, t)= 0 and u(L, t)= 0 we can use a "Fourier sine series", $\sum_{n=0}^\infty A_n(t) sin(\frac{n\pi}{L}x)$ rather that the more general (and harder) "Fourier series" with both sine and cosine.