# Change of variables in Heat Equation (and Fourier Series)

Q: Suppose $u(x,t)$ satisfies the heat equation for $0<x<a$ with the usual initial condition $u(x,0)=f(x)$, and the temperature given to be a non-zero constant C on the surfaces $x=0$ and $x=a$.

We have BCs $u(0,t) = u(a,t) = C.$ Our standard method for finding u doesn't work here, since $e^{-k(\frac{n\pi}a)^2t}sin(\frac{n\pi}a)$ does not satisfy these BCs.

Make a change of variable from $u$ to $v=u-C.$ Show that $v$ satisfies the heat equation with BCs $v=0$ at $x=0$ and $x=a.$

Write down the solution for $v(x,t).$Deduce an expression for $u(x,t)$ in terms of constants $c_1,c_2,\ldots,$ and write down a formula for $c_n.$

[Harder] Now suppose the BCs are $u(0,t) = C$, $u(a,t)=D$ for constants $C,D.$ How could you solve the case?

My question: These are extensions to homework which I'd like try to attempt, but I don't know where to start with the change of variable

• What if $f = 0$ ? Can you find a solution satisfying the boundary conditions ? Feb 5, 2017 at 16:14

$\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,} \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack} \newcommand{\dd}{\mathrm{d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,} \newcommand{\ic}{\mathrm{i}} \newcommand{\mc}[1]{\mathcal{#1}} \newcommand{\mrm}[1]{\mathrm{#1}} \newcommand{\pars}[1]{\left(\,{#1}\,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,} \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}} \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$

$\ds{\partiald{\mrm{u}\pars{x,t}}{t} = D\,\partiald[2]{\mrm{u}\pars{x,t}}{x}\,,\quad D > 0\,,\ x \in \pars{0,a}\,;\qquad \left\{\begin{array}{l} \ds{\mrm{u}\pars{0,t} = \mrm{u}\pars{a,t} = C\,,\quad \forall\ t > 0} \\[2mm] \ds{\mrm{u}\pars{x,0} = \mrm{f}\pars{x}} \end{array}\right.}$

Write $\ds{\,\mrm{u}\pars{x,t} = C + \sum_{n = 1}^{\infty}\mrm{a}_{n}\pars{t}\sin\pars{n\pi\,{x \over a}}}$ such that $\ds{\braces{\mrm{a}_{n}\pars{t}}}$ satisfy $$\totald{a_{n}\pars{t}}{t} = -D\,\pars{n\pi \over a}^{2}\,\mrm{a}_{n}\pars{t}$$.

The general solution is given by: $$\mrm{u}\pars{x,t} = C + \sum_{n = 1}^{\infty}\mrm{a}_{n}\pars{0}\sin\pars{n\pi\,{x \over a}} \exp\pars{-D\,\bracks{n\pi \over a}^{2}t}\label{1}\tag{1}$$

$\ds{\braces{\mrm{a}_{n}\pars{0}}}$ is determined by: \begin{align} \mrm{f}\pars{x} & = \,\mrm{u}\pars{x,0} = C + \sum_{n = 1}^{\infty}\mrm{a}_{n}\pars{0}\sin\pars{n\pi\,{x \over a}} \\[5mm] \int_{0}^{a}\mrm{f}\pars{x}\sin\pars{n\pi\,{x \over a}}\,\dd x & = C\overbrace{\int_{0}^{a}\sin\pars{n\pi\,{x \over a}}\,\dd x}^{\ds{{2a \over \pi}\,{\sin^{2}\pars{n\pi/2} \over n}}} + \sum_{m =1}^{\infty}\mrm{a}_{m}\pars{0} \overbrace{\int_{0}^{a}\sin\pars{n\pi\,{x \over a}} \sin\pars{m\pi\,{x \over a}}\,\dd x}^{\ds{{1 \over 2}\,a\,\delta_{mn}}} \end{align}

$$\bbx{\ds{% \mrm{a}_{n}\pars{0} = {2 \over a}\int_{0}^{a}\mrm{f}\pars{x}\sin\pars{n\pi\,{x \over a}}\,\dd x - {4 \over \pi}\,{\sin^{2}\pars{n\pi/2} \over n}\,C}}\qquad \pars{~\mbox{see expression}\ \eqref{1}~}$$

In your '$\bracks{Harder}$' case we add $\ds{C + \pars{D - C}\,{x \over a}}$ to the series instead of $\ds{C}$. Hereafter, the derivation is quite similar to the above one.

• Could you explain where the ${\ds{{1 \over 2}\,a\,\delta_{mn}}}$ comes from and what it means? Feb 5, 2017 at 22:40
• @user3613025 When $m \not= n$ the integral vanishes out. Otherwise, $$\int_{0}^{a}\sin^{2}\left({n\pi \over a}\,x\right)\,\mathrm{d}x = \int_{0}^{a}{1 - \cos\left(2n\pi x/a\right) \over 2}\,\mathrm{d}x = \int_{0}^{a}{1 \over 2}\,\mathrm{d}x = {1 \over 2}\,a$$ The '$\cos$-integration' vanishes out. Feb 5, 2017 at 23:39