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}



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?



2 Answers 2


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!

  • 1
    $\begingroup$ @Luthier415Hz : What does your final sum add up to when you evaluate at $t=0$? Does your final answer satisfy $u(x,0)=-3x$? It looks like it does to me. And what about $u_x(1,t)$? Does that sum equal $1$, as required? You just have to check the conditions of the original problem, one by one. Let me know what you find. $\endgroup$ Sep 1, 2022 at 11:03
  • 1
    $\begingroup$ I found the error, I added an answer. Thanks Disintegrating $\endgroup$ Sep 1, 2022 at 12:13
  • 1
    $\begingroup$ @Luthier415Hz : I've expanded the solution to a full solution above. Everything should check out. $\endgroup$ Sep 6, 2022 at 16:55
  • 1
    $\begingroup$ Great , it looks good, but you didn't calculate the integrals. $\endgroup$ Sep 7, 2022 at 7:11
  • $\begingroup$ I chcked and it doesnt seem right. wolframalpha.com/…*%5Cexp%28-%281%2B1%2F2%29%5E2%5Cpi%5E2+t%29*%5Csin%28%281%2B1%2F2%29%5Cpi+x%29 and $\endgroup$ Sep 12, 2022 at 19:14

The right answer is to add

$u(x)=-x^2+3x$ to the solution of the homogeneous problem.

That is

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

which gives

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

This satisfies the non-homogeneous solution, giving, when inserted in the PDE with $n=1$

\begin{equation} \frac{d}{dt}\bigg[-x^2+3x+e^{-(n\pi)^2 t} \cos n\pi \frac{\sin n\pi x}{n\pi}\bigg]-\frac{d^2}{dx^2}\bigg[-x^2+3x+e^{-(n\pi)^2t} \cos n\pi\frac{\sin n\pi x}{n\pi}\bigg]=2\\ -e^{-(n\pi)^2 t} n\pi \cos n\pi \sin n\pi x - \bigg[-e^{-(n\pi)^2 t } n\pi \cos n\pi \sin n\pi x-2\bigg]=2\\ 2=2 \end{equation}

  • 1
    $\begingroup$ You're looking like a pro at these problems. Did you check $u_x(1,t)=1$? That seems to be a tough one to check. $\endgroup$ Sep 1, 2022 at 12:19
  • $\begingroup$ No, I am not sure on that one. $\endgroup$ Sep 1, 2022 at 12:22
  • 1
    $\begingroup$ Maybe you could check my solution to see if it satisfies all of the required conditions. $\endgroup$ Sep 6, 2022 at 11:02
  • $\begingroup$ Thanks Disintegration. To do that, I would need the whole solution, not only $−2x^2+x$. Or is the rest the same as mine? $\endgroup$ Sep 6, 2022 at 11:13
  • $\begingroup$ @Luther415Hz : How do your values of $\lambda$ depend on the sum index $n$? $\endgroup$ Sep 12, 2022 at 19:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .