Series solution to 2D Poisson’s equation on a rectangle with Dirichlet boundary conditions.

boundary value problemfourier seriespartial differential equationspoisson's equation

I've been following this link in order to try to solve Poisson's equation on a rectangle $[L_x, L_y]$:
\begin{equation}
\left(\frac{\partial^2}{\partial x^2} + \frac{\partial^2}{\partial y^2}\right)\varphi(x, y) = f(x, y)
\end{equation}

with $\varphi = 0$ on the boundaries. They solve the eigenvalue problem $\Delta \varphi = \lambda \varphi$ to find that $\varphi(x, y) = \sin(k_x x)\sin(k_y y)$ for $k_x = m\pi/L_x$ and $k_y = n\pi/L_y$. Then they claim that $f(x, y)$ may be expanded as
\begin{equation}
f(x, y) = \sum_{k_x, k_y} B_{k_x, k_y} \sin(k_x x)\sin(k_y y)
\end{equation}

Then go on to use this to solve Poisson's equation.

I am confused, however, because it seems like we have only pinned $\varphi$ at the boundaries, and said nothing about what values $f(x, y)$ should take. However, based on this series expansion it seems impossible that $f(x, y)$ can be anything other than zero at the boundaries. How would we expand an $f(x, y)$ that is nonzero at the boundaries? Is there even necessarily a solution for such an $f(x, y)$? Does it even matter what values it takes at the boundaries? And what if we had a source term which looked like $\partial_x f(x, y)$? Could we expand it with:
\begin{equation}
f(x, y) = \sum_{k_x, k_y} B_{k_x, k_y} \cos(k_x x)\sin(k_y y)
\end{equation}

Best Answer

There are some subtleties in this procedure that haven't been addressed. When we say the set $$ \left\{\sin\left(\frac{n\pi x}{L_x}\right)\sin\left(\frac{n\pi x}{L_y}\right):n,m\in\mathbb{N}\right\} $$ forms a basis, what is meant is that it forms a basis for $L^2([0,L_x]\times[0,L_y],\mathbb{R})$. This space consists of equivalence classes of square integrable functions, that is, two functions $f$ and $g$ are considered equivalent in $L^2$ if $\int|f-g|^2=0$, or equivalently if $f=g$ alomst everywhere. In this sense, every square integrable function, even those that do not vanish on the boundary, may be uniquely written as $$ f(x)\equiv\sum_{n,m}B_{n,m}\sin\left(\frac{n\pi x}{L_x}\right)\sin\left(\frac{n\pi x}{L_y}\right) $$ with the understanding that $\equiv$ denotes equivalence in $L^2$. This sum may not converge pointwise, and indeed will not if $f(0)\neq 0$. However, with this caveat in mind, there's no loss of generality in writing a square integrable function this way.

When doing calculus on $L^2$ spaces, one should keep in mind that these functions need not be continuous, let alone differentiable (though if a class has a continuous representative, it is unique). Especially in physics, it's common to simply assume that derivatives exist and are will behaved w.r.t. summation; this can ususally be justified after the fact. Making this process more rigorous is the domain of functional analysis.

Related Question