I have been considering when you should apply the boundary and initial conditions when solving a differential equation. As an example, I was considering the diffusion equation. Suppose I used separation of variables, setting $u(x,t)=X(x)T(t)$, to obtain
$X_n(x) = A(n)cos(\frac{n\pi x}{L}) + B(n)sin(\frac{n\pi x}{L})$, and $T_n(t) = Cexp(-\frac{n^2 \pi ^2 \lambda t}{L^2})$
Now in my lectures it seemed that the boundary conditions of $\frac{\partial {u}}{\partial x}=0$ at $x=0,L$ were applied to a single $X_n$ to obtain the argument constraints above, and eliminate the coefficient $B$. However my thoughts were that the boundary and initial conditions should be applied to the whole sum $u=\Sigma_n X_nT_n$ because:
- each $X_nT_n$ satisfies the equation itself, and therefore the whole sum satisfies the equation.
- The whole sum is the most general solution to the equation and several components of the sum may be needed to satisfy the boundary conditions. Indeed, if a single mode satisfied the boundary and initial conditions, all of the other terms may indeed be zero (or will have to cancel to zero).
So I did some of my own investigating, and I think I demonstrated that the boundary conditions satisfied with respect to x can be applied to either a single mode $X_n$ or to the whole sum $u=\Sigma_n X_nT_n$ if the boundary conditions are homogeneous. I think the initial conditions must be applied to the whole sum.
Also, I am pretty sure that when solving inomogeneous ODEs (or presumably also any PDE with forcing term) the boundary conditions must be abpplied to the complementary function plus particular integral, i.e. to the whole general solution.
I would appreciate anyone's input on applying boundary and initial conditions.