A inhomogeneous heat equation with mixed conditions

heat equationpartial differential equations

I want to solve the given problem:

\begin{equation}
u_t-u_{xx}=2 \ \ \ \ \ 0<x<1, t>0 \\
u(0,t)=0, \ \ u_x(1,t)=1, \ \ \ t>0\\
u(x,0)=-x^2, \ \ \ \ 0<x<1
\end{equation}

but I am not sure I have done it correctly. This is what I did:

Step 1. Homogenize, by solving the stationary problem $u_t=0$:

\begin{equation}
-u_{xx}=2 \rightarrow u(x)-x^2+Cx+D \\
I.C. give \rightarrow u(x)=-x^2+3x
\end{equation}

The homogenized PDE is now:

\begin{equation}
u_t-u_{xx}=0 \ \ \ \ \ 0<x<1, t>0 \\
u(0,t)=0, \ \ u_x(1,t)=1, \ \ \ t>0\\
u(x,0)=-x^2+x^2-3x \rightarrow u(x,0)=-3x, \ \ \ \ 0<x<1
\end{equation}

Step 2. Solve the homogenous PDE.

Since we have mixed conditions, we need to look for a linear combination of $u(x)=A\sin\lambda x+B\cos\lambda x$ which satisfies the I.C.

We get:

\begin{equation}
u(x)=A\sin\lambda x+ B\cos\lambda x \rightarrow \ \ IC: u(0)=0 \rightarrow u(x)=A\sin\lambda x\\
u(x)=A\sin\lambda x, \rightarrow IC2: u'(1)=1,\ \ \ u'(x)= \lambda A\cos\lambda x \rightarrow 1=\lambda A\cos\lambda \rightarrow A=\frac{1}{\lambda\cos\lambda}\\
u(x)=\frac{1}{\lambda\cos\lambda}\sin\lambda x
\end{equation}

So now we have a first candidate of the function

\begin{equation}
u(x,t)=\frac{\sin\lambda x}{\lambda\cos\lambda}u(t)
\end{equation}

We find out u(t) by plugging this in the PDE, where each of the following is:

\begin{equation}
u(x,t)=\frac{\sin\lambda x}{\lambda\cos\lambda}u(t)\\
u_{xx}(x,t)=-\frac{\lambda^2\sin\lambda x}{\lambda\cos\lambda}u(t)\\
u_t(x,t)=\frac{\sin\lambda x}{\lambda\cos\lambda}u_t
\end{equation}

By inserting eacah part in the homogenized PDE we get:

\begin{equation}
\frac{\sin\lambda x}{\lambda\cos\lambda}u_t+\frac{\lambda^2\sin\lambda x}{\lambda\cos\lambda}u(t)=0\\
u(t)=C_ne^{-\lambda^2t}
\end{equation}

Step 3. Find the coefficients

So since we now have the full form of $u(x,t)$, we can use the third IC for the homogenized problem, $u(x,0)=-3x$ and use the Fourier series method to find the coefficient:

\begin{equation}
u(x,0)=-3x=\sum_{n=1}^\infty\frac{C_n}{\lambda\cos\lambda}\sin\lambda xe^0
\end{equation}

This coefficient we find by using the Fourier series form for $\beta_n=\frac{2}{L}\int_0^Lu(x,0)\sin\lambda xdx$. Here we have both $u(x,0)=-3x$ and $L=1$ so we obtain that $\frac{C_n}{\lambda\cos\lambda}=\beta_n$: This is the famous "Fourier trick" used to find the coefficients of the heat, Laplace and wave equations. So this "trick" gives:

\begin{equation}
\frac{C_n}{\lambda\cos\lambda}=2\int_0^1(-3x)\sin\lambda xdx
\end{equation}

Solving the L.H.S we get $-\frac{\cos\lambda}{\lambda}$, so the equation becomes

\begin{equation}
\frac{C_n}{\lambda\cos\lambda}=-\frac{\cos\lambda}{\lambda}
\end{equation}

Hence,

$C_n=-\cos^2\lambda$

Since the system was inhomogenous, we need to add the function $u(x,0)=-3x$

This gives the final form of $u(x,t)$

\begin{equation}
u(x,t)=-3x+\sum_{n=1}^\infty\frac{\cos\lambda}{\lambda}\sin\lambda x e^{-\lambda^2 t}
\end{equation}

But I am not sure about the last step, to add the function $u(x,0)=-3x$. Is it right to do, or not?

Thanks

Best Answer

The problem in question is $$ u_t-u_{xx}=2 \\ u(0,t)=0,\; u_x(1,t)=1 \\ u(x,0)=-x^2 $$ This needs to be transformed to a homogeneous problem in order for separation of variables to work. One way to do this is to add a function $f(x)$ to $u$ so that the differential equation and endpoint conditions are homogeneous. That requires finding a function $f$ to satisfy the following: $$ (u+f)_t-(u+f)_{xx}=0 \implies f''(x)=2 \\ u(0,t)+f(0)=0 \implies f(0)=0 \\ u_x(1,t)+f'(1)=0 \implies f'(1)=-1 $$

$f(x)=x^2-3x$ is such a solution. (Thank you @Luthier415Hz for pointing out my errors and confusion about this.)

The original problem for $u$ has now been transformed to a problem in $v=u+f$ that satisfies the following: $$ v_t=v_{xx} \\ v(0,t)=0,\;\; v_x(1,t)=0, \\ v(x,0) = -3x. $$ Separation of variables can be used to directly solve this problem because of the homogenous endpoint conditions.

The desired solution is $u=v-f$. To solve for $v$ using separation of variables, assume $v(t,x)=T(t)X(x)$. This will work because of the homogeneous endpoint conditions in $x$: $$ \frac{T'(t)}{T(t)}=\lambda = \frac{X''(x)}{X(x)} \\ X(0)=0,\;\; X'(1)=0. $$ The $X$ equation has solutions that are determined only up to a constant $C$: $$ X_n(x) = C_n\sin((n+1/2)\pi x),\;\; n=0,1,2,3,\cdots. $$ The corresponding eigenvalue parameter $\lambda$ is $$ \lambda_n = -(n+1/2)^2\pi^2,\;\; n=0,1,2,3,\cdots. $$ And the corresponding solution $T_n$ is any constant multiple of $$ T_n(t) = \exp(-(n+1/2)^2\pi^2 t) $$ This leads to the general solution for $v$: $$ v(x,t) = \sum_{n=0}^{\infty}C_n \exp(-(n+1/2)^2\pi^2 t)\sin((n+1/2)\pi x). $$ The constants $C_n$ are determined by the condition $v(x,0)=-3x$, through the orthogonality of the eigenfunctions $\{\sin((n+1/2)\pi x)\}_{n=0}^{\infty}$: $$ -3x = v(x,0)= \sum_{n=0}^{\infty}C_n\sin((n+1/2)\pi x) \\ \frac{\int_0^1 (-3x)\sin((n+1/2)\pi x)dx}{\int_0^1\sin^2((n+1/2)\pi x)dx}= C_n,\;\;\; n=0,1,2,3,\cdots. $$ What remains is to determine the constants $C_n$ by evaluating the integrals in the corresponding fractions above. The numerator for $C_n$ is \begin{align} &\int_0^1 (-3x)\sin((n+1/2)\pi x)dx \\ &= \left.\frac{3x\cos((n+1/2)\pi x)}{(n+1/2)\pi}\right|_{0}^{1} \\ & - \int_0^1 3\frac{\cos((n+1/2)\pi x)}{(n+1/2)\pi}dx \\ &= \left.-3\frac{\sin((n+1/2)\pi x)}{(n+1/2)^2\pi^2}\right|_{x=0}^{1} \\ &= \frac{3(-1)^{n+1}}{(n+1/2)^2\pi^2} \end{align} The denominator for $C_n$ is \begin{align} &\int_0^1\sin^2((n+1/2)\pi x)dx \\ & = \left.\frac{-\cos((n+1/2)\pi x)}{(n+1/2)\pi}\sin((n+1/2)\pi x)\right|_{x=0}^{1} \\ & + \int_0^1\cos^2((n+1/2)^2\pi x)dx \\ & = \int_0^1\cos^2((n+1/2)^2\pi x)dx \end{align} Therefore, \begin{align} &\int_0^1\sin^2((n+1/2)\pi x)dx \\ &=\frac{1}{2} \int_0^1\sin^2((n+1/2)\pi x)+\cos^2((n+1/2)^2\pi x) dx \\ &=\frac{1}{2}. \end{align} Finally, $$ C_n = \frac{6(-1)^{n+1}}{(n+1/2)^2\pi^2} $$ The full expression for $v$ is \begin{align} &v(x,t)=\sum_{n=0}^{\infty}C_n \exp(-(n+1/2)^2\pi^2 t)\sin((n+1/2)\pi x) \\ &= \sum_{n=0}^{\infty}\frac{6(-1)^{n+1}}{(n+1/2)^2\pi^2}\exp(-(n+1/2)^2\pi^2 t)\sin((n+1/2)\pi x). \end{align} The desired solution is $u=v-f=v-(x^2-3x)$: \begin{align} %% u(x,t)&=v(x,t)-(x^2-3x) \\ &u(x,t)= -x^2+3x \\ &+\sum_{n=0}^{\infty}\frac{6(-1)^{n+1}}{(n+1/2)^2\pi^2}\exp(-(n+1/2)^2\pi^2 t)\sin((n+1/2)\pi x) \end{align} NOTE: If I have all the details for this right, I'll be shocked!

Related Question