Solution
The boundary conditions are
Let \[ u\left ( x,y\right ) =X\left ( x\right ) Y\left ( y\right ) \] Substitution in the PDE \(u_{xx}+y_{yy}=0\) leads to\begin{align*} X^{\prime \prime }Y+Y^{\prime \prime }Y & =0\\ \frac{X^{\prime \prime }}{X} & =-\frac{Y^{\prime \prime }}{Y}=-\lambda \end{align*}
Where \(\lambda \) is the separation constant. We obtain two ODE’s\begin{align} X^{\prime \prime }+\lambda X & =0\tag{1}\\ Y^{\prime \prime }-\lambda Y & =0\tag{2} \end{align}
We use the \(X\left ( x\right ) \) ODE (1) to determine the eigenvalues, since that ODE has both boundary conditions specified:\begin{align*} X^{\prime \prime }+\lambda X & =0\\ X^{\prime }\left ( 0\right ) & =0\\ X^{\prime }\left ( \pi \right ) & =0 \end{align*}
Case \(\lambda <0\)
Solution is \begin{align*} X\left ( x\right ) & =A\cosh \left ( \sqrt{-\lambda }x\right ) +B\sinh \left ( \sqrt{-\lambda }x\right ) \\ X^{\prime }\left ( x\right ) & =A\sqrt{-\lambda }\sinh \left ( \sqrt{-\lambda }x\right ) +B\sqrt{-\lambda }\cosh \left ( \sqrt{-\lambda }x\right ) \end{align*}
At \(x=0\) the above gives\begin{align*} 0 & =B\sqrt{-\lambda }\cosh \left ( 0\right ) \\ & =B\sqrt{-\lambda } \end{align*}
Hence \(B=0\) and the solution (3) reduces to\begin{align*} X\left ( x\right ) & =A\cosh \left ( \sqrt{-\lambda }x\right ) \\ X^{\prime }\left ( x\right ) & =A\sqrt{-\lambda }\sinh \left ( \sqrt{-\lambda }x\right ) \end{align*}
At \(x=\pi \) the above becomes\[ 0=A\sqrt{-\lambda }\sinh \left ( \sqrt{-\lambda }\pi \right ) \] For non-trivial solution we want \(\sinh \left ( \sqrt{-\lambda }\pi \right ) =0\), but \(\sinh \) is only zero when its argument is zero, which is not possible here, since \(\lambda \neq 0\). Therefore \(\lambda <0\) is not possible.
Case \(\lambda =0\)
Solution becomes \(X=Ax+B\). Hence \(X^{\prime }=A\). At \(x=0\) this leads to \(A=0\). Therefore the solution now becomes \(X=B\). Hence \(X^{\prime }=0\). Therefore the second boundary conditions at \(x=\pi \) is automatically satisfied. Hence the solution is \(X\left ( x\right ) =B\), a constant. We pick \(X\left ( x\right ) =1\). Therefore \(\lambda =0\) is eigenvalue with associated eigenfunction \(X_{0}\left ( x\right ) =1\).
Case \(\lambda >0\)
The solution becomes\begin{align*} X\left ( x\right ) & =A\cos \left ( \sqrt{\lambda }x\right ) +B\sin \left ( \sqrt{\lambda }x\right ) \\ X^{\prime }\left ( x\right ) & =-A\sqrt{\lambda }\sin \left ( \sqrt{\lambda }x\right ) +B\sqrt{\lambda }\cos \left ( \sqrt{\lambda }x\right ) \end{align*}
At \(x=0\) the above becomes\[ 0=B\sqrt{\lambda }\] Hence \(B=0\) and the solution reduces to\begin{align*} X\left ( x\right ) & =A\cos \left ( \sqrt{\lambda }x\right ) \\ X^{\prime }\left ( x\right ) & =-A\sqrt{\lambda }\sin \left ( \sqrt{\lambda }x\right ) \end{align*}
At \(x=\pi \) the above gives\begin{align*} 0 & =-A\sqrt{\lambda }\sin \left ( \sqrt{\lambda }\pi \right ) \\ \sin \left ( \sqrt{\lambda }\pi \right ) & =0 \end{align*}
Therefore \(\sqrt{\lambda }\pi =n\pi \) for \(n=1,2,3,\cdots \). Hence \[ \lambda _{n}=n^{2}\qquad n=1,2,3,\cdots \] And the solution (corresponding eigenfunctions) is\begin{align*} X_{n}\left ( x\right ) & =\cos \left ( \sqrt{\lambda _{n}}x\right ) \\ & =\cos \left ( nx\right ) \end{align*}
In summary, the solution to the \(X\) ODE resulted in \begin{align} X_{0}\left ( x\right ) & =1\qquad n=0\tag{3}\\ X_{n}\left ( x\right ) & =\cos \left ( nx\right ) \qquad n=1,2,3,\cdots \nonumber \end{align}
Now we solve for the \(Y\) ODE\begin{align*} Y^{\prime \prime }-\lambda Y & =0\\ Y\left ( 0\right ) & =0 \end{align*}
We are only given boundary conditions on bottom edge.
case \(\lambda =0\)\[ Y=Ay+B \] When \(y=0\) the above leads to \(0=B\). Hence the corresponding eigenfunction is \(Y_{0}\left ( y\right ) =y\).
case \(\lambda >0\)
The solution becomes\[ Y\left ( y\right ) =A\cosh \left ( \sqrt{\lambda }y\right ) +B\sinh \left ( \sqrt{\lambda }y\right ) \] At \(y=0\) the above gives\begin{align*} 0 & =A\cosh \left ( 0\right ) \\ & =A \end{align*}
Hence the solution reduces to\[ Y\left ( y\right ) =B\sinh \left ( \sqrt{\lambda }y\right ) \] Therefore the eigenfunctions for \(n=1,2,3,\cdots \) are \(Y_{n}\left ( y\right ) =\sinh \left ( ny\right ) \) since \(\lambda _{n}=n^{2}\) for \(n=1,2,3,\cdots \).
In summary, the solution to the \(Y\) ODE resulted in \begin{align} Y_{0}\left ( y\right ) & =y\qquad n=0\tag{4}\\ Y_{n}\left ( x\right ) & =\sinh \left ( ny\right ) \qquad n=1,2,3,\cdots \nonumber \end{align}
From (3,4) we see that\[ u_{n}\left ( x,y\right ) =X_{n}\left ( x\right ) Y_{n}\left ( y\right ) \] For \(n=0\) the above becomes\begin{align*} u_{0}\left ( x,y\right ) & =\left ( 1\right ) \left ( y\right ) \\ & =y \end{align*}
And for \(n=1,2,3,\cdots \)\begin{align*} u_{n}\left ( x,y\right ) & =\sinh \left ( ny\right ) \\ & =\cos \left ( nx\right ) \sinh \left ( ny\right ) \end{align*}
Using superposition, then\begin{align*} u\left ( x,y\right ) & =X\left ( x\right ) Y\left ( y\right ) \\ & =A_{0}u_{0}+\sum _{n=1}^{\infty }A_{n}u_{n}\\ & =A_{0}y+\sum _{n=1}^{\infty }A_{n}\cos \left ( nx\right ) \sinh \left ( ny\right ) \end{align*}
QED.
Solution
The boundary conditions now become as follows
From the above problem we know the general solution is\begin{equation} u\left ( x,y\right ) =A_{0}y+\sum _{n=1}^{\infty }A_{n}\cos \left ( nx\right ) \sinh \left ( ny\right ) \tag{1} \end{equation} Now we impose the remaining boundary condition \(u\left ( x,2\right ) =f\left ( x\right ) \). Therefore the above becomes\[ f\left ( x\right ) =2A_{0}+\sum _{n=1}^{\infty }A_{n}\cos \left ( nx\right ) \sinh \left ( 2n\right ) \] Multiplying both sides by \(\cos \left ( mx\right ) \) integrating w.r.t. \(x\) from \(x=0\) to \(x=\pi \) results in\begin{align*} \int _{0}^{\pi }f\left ( x\right ) \cos \left ( mx\right ) dx & =\int _{0}^{\pi }2A_{0}\cos \left ( mx\right ) dx+\left [ \int _{0}^{\pi }\sum _{n=1}^{\infty }A_{n}\cos \left ( nx\right ) \cos \left ( mx\right ) \sinh \left ( 2n\right ) dx\right ] \\ \int _{0}^{\pi }f\left ( x\right ) \cos \left ( mx\right ) dx & =\int _{0}^{\pi }2A_{0}\cos \left ( mx\right ) dx+\left [ \sum _{n=1}^{\infty }A_{n}\sinh \left ( 2n\right ) \left ( \int _{0}^{\pi }\cos \left ( nx\right ) \cos \left ( mx\right ) dx\right ) \right ] \end{align*}
case \(m=0\)\begin{align} \int _{0}^{\pi }f\left ( x\right ) dx & =\int _{0}^{\pi }2A_{0}dx\nonumber \\ & =2A_{0}\pi \nonumber \\ A_{0} & =\frac{1}{2\pi }\int _{0}^{\pi }f\left ( x\right ) dx \tag{2} \end{align}
case \(m=1,2,\cdots \)\[ \int _{0}^{\pi }f\left ( x\right ) \cos \left ( mx\right ) dx=\sum _{n=1}^{\infty }A_{n}\sinh \left ( 2n\right ) \left ( \int _{0}^{\pi }\cos \left ( nx\right ) \cos \left ( mx\right ) dx\right ) \] But \(\int _{0}^{\pi }\cos \left ( nx\right ) \cos \left ( mx\right ) dx=0\) for all \(m\neq n\) and \(\frac{\pi }{2}\) when \(m=n\). Hence the above simplifies to\begin{align*} \int _{0}^{\pi }f\left ( x\right ) \cos \left ( mx\right ) dx & =\frac{\pi }{2}A_{m}\sinh \left ( 2m\right ) \\ A_{m} & =\frac{2}{\pi \sinh \left ( 2m\right ) }\int _{0}^{\pi }f\left ( x\right ) \cos \left ( mx\right ) dx \end{align*}
Since \(m\) is summation index, we can rename it to \(n\) and the above becomes\begin{equation} A_{n}=\frac{2}{\pi \sinh \left ( 2n\right ) }\int _{0}^{\pi }f\left ( x\right ) \cos \left ( nx\right ) dx \tag{3} \end{equation} Using (2,3) in (1) gives the final solution\[ u\left ( x,y\right ) =\left ( \frac{1}{2\pi }\int _{0}^{\pi }f\left ( x\right ) dx\right ) y+\sum _{n=1}^{\infty }\left ( \frac{2}{\pi \sinh \left ( 2n\right ) }\int _{0}^{\pi }f\left ( x\right ) \cos \left ( nx\right ) dx\right ) \cos \left ( nx\right ) \sinh \left ( ny\right ) \]
\[ u_{xx}-xtu_{tt}=0 \] Let \(u=X\left ( x\right ) T\left ( t\right ) \). Substituting this into the above PDE gives\[ X^{\prime \prime }T-xtT^{\prime \prime }X=0 \] Dividing by \(XT\neq 0\) gives\[ \frac{X^{\prime \prime }}{X}-xt\frac{T^{\prime \prime }}{T}=0 \] Diving by \(x\) gives\begin{align*} \frac{1}{x}\frac{X^{\prime \prime }}{X}-t\frac{T^{\prime \prime }}{T} & =0\\ \frac{1}{x}\frac{X^{\prime \prime }}{X} & =t\frac{T^{\prime \prime }}{T}=-\lambda \end{align*}
Hence it possible to separate them. The generated ODE’s are\begin{align*} X^{\prime \prime }+\lambda xX & =0\\ T^{\prime \prime }+\lambda \frac{T}{t} & =0 \end{align*}
\[ \left ( x+t\right ) u_{xx}-u_{t}=0 \] Let \(u=X\left ( x\right ) T\left ( t\right ) \). Substituting this into the above PDE gives\[ \left ( x+t\right ) X^{\prime \prime }T-T^{\prime }X=0 \] Dividing by \(XT\neq 0\) gives\[ x\frac{X^{\prime \prime }}{X}+t\frac{X^{\prime \prime }}{X}-\frac{T^{\prime }}{T}=0 \] It is not possible to separate them.
\[ xu_{xx}+u_{xt}+tu_{tt}=0 \] Let \(u=X\left ( x\right ) T\left ( t\right ) \). Substituting this into the above PDE gives\begin{align*} xX^{\prime \prime }T-\frac{\partial }{\partial t}\left ( X^{\prime }T\right ) +tT^{\prime \prime }X & =0\\ xX^{\prime \prime }T-X^{\prime }T^{\prime }X+tT^{\prime \prime }X & =0 \end{align*}
Dividing by \(XT\neq 0\) gives\[ x\frac{X^{\prime \prime }}{X}-X^{\prime }T^{\prime }+t\frac{T^{\prime \prime }}{T}=0 \] It is not possible to separate them.
\[ u_{xx}-u_{tt}-u_{t}=0 \] Let \(u=X\left ( x\right ) T\left ( t\right ) \). Substituting this into the above PDE gives\[ X^{\prime \prime }T-T^{\prime \prime }X-T^{\prime }X=0 \] Dividing by \(XT\neq 0\) gives\begin{align*} \frac{X^{\prime \prime }}{X}-\frac{T^{\prime \prime }}{T}-\frac{T^{\prime }}{T} & =0\\ \frac{X^{\prime \prime }}{X} & =\frac{T^{\prime \prime }}{T}+\frac{T^{\prime }}{T}=-\lambda \end{align*}
It is possible to separate them. The ODE’s are\begin{align*} X^{\prime \prime }+\lambda X & =0\\ T^{\prime \prime }+T^{\prime }+\lambda T & =0 \end{align*}
Case \(\lambda <0\)
Solution is \[ X\left ( x\right ) =A\cosh \left ( \sqrt{-\lambda }x\right ) +B\sinh \left ( \sqrt{-\lambda }x\right ) \] At \(x=0\) the above gives\[ 0=A \] Hence the solution becomes\[ X\left ( x\right ) =B\sinh \left ( \sqrt{-\lambda }x\right ) \] At \(x=c\) the above becomes\[ 0=B\sinh \left ( \sqrt{-\lambda }c\right ) \] For non-trivial solution we want \(\sinh \left ( \sqrt{-\lambda }c\right ) =0\). But \(\sinh \) is zero only when its argument is zero. Which means \(\sqrt{-\lambda }c=0\) which is not possible. Hence \(\lambda <0\) is not possible.
Case \(\lambda =0\)
Solution is \[ X\left ( x\right ) =Ax+B \] At \(x=0\) the above gives\[ 0=B \] Hence the solution becomes\[ X\left ( x\right ) =B \] At \(x=c\) the above becomes\[ 0=B \] Which gives trivial solution. Hence \(\lambda =0\) is not possible.
Case \(\lambda >0\)
Solution is \[ X\left ( x\right ) =A\cos \left ( \sqrt{\lambda }x\right ) +B\sin \left ( \sqrt{\lambda }x\right ) \] At \(x=0\) the above gives\[ 0=A \] Hence the solution becomes\[ X\left ( x\right ) =B\sin \left ( \sqrt{\lambda }x\right ) \] At \(x=c\) the above becomes\[ 0=B\sin \left ( \sqrt{\lambda }c\right ) \] For non trivial solution we want \(\sin \left ( \sqrt{\lambda }c\right ) =0\) which implies \begin{align*} \sqrt{\lambda }c & =n\pi \qquad n=1,2,3,\cdots \\ \lambda _{n} & =\left ( \frac{n\pi }{c}\right ) ^{2} \end{align*}
Therefore the eigenvalues are \(\lambda _{n}=\left ( \frac{n\pi }{c}\right ) ^{2}\) for \(n=1,2,3,\cdots \) and the eigenfunctions are \(X_{n}\left ( x\right ) =\sin \left ( \frac{n\pi }{c}x\right ) \) for \(n=1,2,3,\cdots \).
Solution
Example 1 is: Solve \(u_{t}=ku_{xx}\) with \(u\left ( 0,t\right ) =0\) and \(u\left ( \pi ,t\right ) =0\). We now use initial conditions \(u\left ( x,0\right ) =\sin \left ( x\right ) \). The eigenvalues are \(\lambda _{n}=n^{2}\) for \(n=1,2,3,\cdots \) and eigenfunctions are \(\sin \left ( nx\right ) \). The general solution for this example is given in the book as\[ u\left ( x,t\right ) =\sum _{n=1}^{\infty }B_{n}e^{-kn^{2}t}\sin \left ( nx\right ) \] At \(t=0\) the above becomes\begin{equation} \sin x=\sum _{n=1}^{\infty }B_{n}\sin \left ( nx\right ) \tag{1} \end{equation} By comparing sides, we see that only \(n=1\) term exist. Hence \(B_{1}=1\) and all other terms are zero. Hence the solution is, for \(n=1\)\[ u\left ( x,t\right ) =e^{-kt}\sin \left ( x\right ) \] To verify this, we start with (1) and multiply both sides by \(\sin \left ( mx\right ) \) and integrate which gives\begin{align*} \int _{0}^{\pi }\sin x\sin \left ( mx\right ) dx & =\int _{0}^{\pi }\sum _{n=1}^{\infty }B_{n}\sin \left ( nx\right ) \sin \left ( mx\right ) dx\\ & =\sum _{n=1}^{\infty }B_{n}\left ( \int _{0}^{\pi }\sin \left ( nx\right ) \sin \left ( mx\right ) dx\right ) \end{align*}
But \(\int _{0}^{\pi }\sin \left ( nx\right ) \sin \left ( mx\right ) dx=0\) for \(m\neq n\) and \(\frac{\pi }{2}\) for \(n=m\). Hence the above gives\[ \int _{0}^{\pi }\sin x\sin \left ( mx\right ) dx=B_{m}\frac{\pi }{2}\] Similarly, \(\int _{0}^{\pi }\sin x\sin \left ( mx\right ) dx=0\) for \(m\neq 1\) and \(\frac{\pi }{2}\) when \(m=1\), therefore the above becomes\begin{align*} \frac{\pi }{2} & =B_{1}\frac{\pi }{2}\\ B_{1} & =1 \end{align*}
And all other \(B_{n}=0\). Which gives the same result obtain above, which is \(u\left ( x,t\right ) =e^{-kt}\sin \left ( x\right ) \)
Solution
We need to solve\[ u_{t}=ku_{xx}\qquad t>0,0<x<\pi \] With boundary conditions\begin{align*} u\left ( 0,t\right ) & =u_{0}\\ u\left ( \pi ,t\right ) & =0 \end{align*}
And initial conditions\[ u\left ( x,0\right ) =0 \] Solution (15) is\begin{equation} u\left ( x,t\right ) =\frac{u_{0}}{\pi }\left [ x+2\sum _{n=1}^{\infty }\frac{\left ( -1\right ) ^{n}}{n}e^{-n^{2}kt}\sin \left ( nx\right ) \right ] \tag{15} \end{equation} Replacing \(x\) by \(\pi -x\) in (15) gives\begin{align} u\left ( x,t\right ) & =\frac{u_{0}}{\pi }\left [ \left ( \pi -x\right ) +2\sum _{n=1}^{\infty }\frac{\left ( -1\right ) ^{n}}{n}e^{-n^{2}kt}\sin \left ( n\left ( \pi -x\right ) \right ) \right ] \nonumber \\ & =\frac{u_{0}}{\pi }\left ( \pi -x\right ) +2\frac{u_{0}}{\pi }\sum _{n=1}^{\infty }\frac{\left ( -1\right ) ^{n}}{n}e^{-n^{2}kt}\sin \left ( n\pi -nx\right ) \tag{2} \end{align}
Using \(\sin \left ( A-B\right ) =\sin A\cos B+\cos A\sin B\), then \[ \sin \left ( n\pi -nx\right ) =\sin \left ( n\pi \right ) \cos \left ( nx\right ) +\cos \left ( n\pi \right ) \sin \left ( nx\right ) \] But \(\sin \left ( n\pi \right ) =0\) since \(n\) is integer and \(\cos \left ( n\pi \right ) =\left ( -1\right ) ^{n}\), then \(\sin \left ( n\pi -nx\right ) =\left ( -1\right ) ^{n}\sin \left ( nx\right ) \). Substituting this in (2) gives\begin{align*} u\left ( x,t\right ) & =u_{0}-u_{0}\frac{x}{\pi }+2\frac{u_{0}}{\pi }\sum _{n=1}^{\infty }\frac{\left ( -1\right ) ^{n}}{n}e^{-n^{2}kt}\left ( -1\right ) ^{n}\sin \left ( nx\right ) \\ & =u_{0}\left [ 1-\frac{x}{\pi }+\frac{2}{\pi }\sum _{n=1}^{\infty }\frac{\left ( -1\right ) ^{2n}}{n}e^{-n^{2}kt}\sin \left ( nx\right ) \right ] \\ & =u_{0}\left [ 1-\frac{x}{\pi }+\frac{2}{\pi }\sum _{n=1}^{\infty }\frac{1}{n}e^{-n^{2}kt}\sin \left ( nx\right ) \right ] \end{align*}
Which is the result required.