Question: Solve the initial-boundary value problem for the heat equation
$u_t = u_{xx}$ for $0 < x < 1$, $t > 0$
with BCs
$u_x(t,0) = 0$, $u_x(t,1) = 0$, $t \geq 0$.
and initial condition:
$u(0,x) = f(x) = x$.
1. **Problem Statement:**
We want to solve the heat equation $$u_t = u_{xx}$$ on the interval $$0 < x < 1$$ for time $$t > 0$$ with Neumann boundary conditions $$u_x(t,0) = 0$$ and $$u_x(t,1) = 0$$ for all $$t \geq 0$$, and initial condition $$u(0,x) = x$$.
2. **Method:**
We use separation of variables and eigenfunction expansions. The boundary conditions are Neumann (zero flux), so the eigenfunctions satisfy:
$$\phi''(x) + \lambda \phi(x) = 0$$
with $$\phi'(0) = 0$$ and $$\phi'(1) = 0$$.
3. **Eigenvalues and Eigenfunctions:**
The general solution to $$\phi'' + \lambda \phi = 0$$ is:
$$\phi(x) = A \cos(\sqrt{\lambda} x) + B \sin(\sqrt{\lambda} x)$$
Applying $$\phi'(0) = 0$$:
$$\phi'(x) = -A \sqrt{\lambda} \sin(\sqrt{\lambda} x) + B \sqrt{\lambda} \cos(\sqrt{\lambda} x)$$
At $$x=0$$:
$$\phi'(0) = B \sqrt{\lambda} = 0 \implies B = 0$$
Applying $$\phi'(1) = 0$$:
$$\phi'(1) = -A \sqrt{\lambda} \sin(\sqrt{\lambda} \cdot 1) = 0$$
For nontrivial $$A \neq 0$$, we require:
$$\sin(\sqrt{\lambda}) = 0 \implies \sqrt{\lambda} = n \pi, \quad n=0,1,2,\ldots$$
Thus,
$$\lambda_n = (n \pi)^2$$
and eigenfunctions:
$$\phi_n(x) = \cos(n \pi x)$$
4. **Solution form:**
The solution is expanded as:
$$u(t,x) = \sum_{n=0}^\infty c_n e^{-\lambda_n t} \phi_n(x) = c_0 + \sum_{n=1}^\infty c_n e^{-(n \pi)^2 t} \cos(n \pi x)$$
5. **Initial condition:**
At $$t=0$$,
$$u(0,x) = f(x) = x = c_0 + \sum_{n=1}^\infty c_n \cos(n \pi x)$$
6. **Finding coefficients $$c_n$$:**
Use orthogonality of cosine functions on $$[0,1]$$:
$$c_0 = \int_0^1 x \cdot 1 \, dx = \left[ \frac{x^2}{2} \right]_0^1 = \frac{1}{2}$$
For $$n \geq 1$$:
$$c_n = 2 \int_0^1 x \cos(n \pi x) \, dx$$
Integrate by parts:
Let $$u = x$$, $$dv = \cos(n \pi x) dx$$
Then $$du = dx$$, $$v = \frac{\sin(n \pi x)}{n \pi}$$
So,
$$\int_0^1 x \cos(n \pi x) dx = \left. x \frac{\sin(n \pi x)}{n \pi} \right|_0^1 - \int_0^1 \frac{\sin(n \pi x)}{n \pi} dx$$
The first term is zero because $$\sin(n \pi) = 0$$ and at 0 it is zero.
The second integral:
$$\int_0^1 \sin(n \pi x) dx = \left[ -\frac{\cos(n \pi x)}{n \pi} \right]_0^1 = -\frac{\cos(n \pi) - 1}{n \pi}$$
Therefore,
$$\int_0^1 x \cos(n \pi x) dx = - \frac{1}{n \pi} \left(-\frac{\cos(n \pi) - 1}{n \pi} \right) = \frac{1 - \cos(n \pi)}{(n \pi)^2}$$
Recall $$\cos(n \pi) = (-1)^n$$, so:
$$c_n = 2 \cdot \frac{1 - (-1)^n}{(n \pi)^2}$$
7. **Simplify coefficients:**
- For even $$n$$, $$(-1)^n = 1$$, so $$c_n = 0$$.
- For odd $$n$$, $$(-1)^n = -1$$, so:
$$c_n = \frac{4}{(n \pi)^2}$$
8. **Final solution:**
$$u(t,x) = \frac{1}{2} + \sum_{\substack{n=1,3,5,\ldots}} \frac{4}{(n \pi)^2} e^{-(n \pi)^2 t} \cos(n \pi x)$$
This series converges to the solution of the heat equation with the given initial and boundary conditions.