When are the coefficients of Laplace equation based on Fourier series? in various posts I have made recently on the Laplace equation, I have questioned the methods for finding the coefficients of the harmonic/hyperbolic functions (Y(y) and X(x) of U(x,y). One examples is here and another is here . However, in the first link, the author of the solution writes
"If you really want the arbitrary boundary condition u(x,b)=sinx as you wrote, you'll need to expand out sin in terms of the Xn. Using: "
This answer made me think of the given question:
How does one know when to develop a Fourier series of a coefficient for a spatial function of a Laplace problem?
Say that the x-part is hyperbolic $X(x)=\sinh\frac{n\pi}{a}x$ and the y part is trigonometric $Y(y)=sin\frac{n\pi}{a}y$, or inversely to this. What makes it inevitable to develop the coefficient in terms of a Fourier series?
In examples as  this we can see on p. 4 (bottom) that the Fourier series is made by "a whole piece" of the  X(x)-function. Indeed, for this very problem, the X(x) function is the trigonometric component of $u(x,y).$ But the developed Fourier series coefficient is made with respect to the I.C. on the y-part of $u(x,y)$.
I don't understand this fully. So what can be said?.
The Fourier coefficient is developed only when:

*

*The respective function u(x) in $u(x,y)$ is trigonometric.

*The B.C. used to form the Fourier integral act on the  $u(y)$ part in  $u(x,y)$.

?
What else can one say, since the expansion of the sine function in case 1 is clearly something else.
 A: You can expand in terms of solutions in one variable if you have a well-posed, fully self-adjoint problem in that direction. For example, suppose $p(x)$ is a real, bounded, continuously differentiable, and strictly positive function on $[a,b]$, and suppose that $q(x)$ is a bounded function on $[a,b]$. Then consider the differential operator $L_{\alpha,\beta}$ defined by
$$
    L_{\alpha,\beta}f=-\frac{d}{dx}\left(p(x)\frac{df}{dx}\right)+q(x)f(x)
$$
on the domain $\mathcal{D}(L_{\alpha,\beta})$ consisting of all twice continuously differentiable functions $f$ on $[a,b]$ which satisfy the following endpoint conditions:
$$
            \cos\alpha f(a)+\sin\alpha f'(a)=0 \\
            \cos\beta f(b)+\sin\beta f'(b)=0.
$$
Then $L_{\alpha,\beta}$ is essentially self-adjoint, meaning that its closure is self-adjoint. It automatically follows that there are eigenvalues $\lambda_1 < \lambda_2 < \lambda_3 < \cdots$ and corresponding normalized eigenfunctions $f_{n}$ such that $L_{\alpha,\beta}f_n=\lambda_n f_n$, and such that $\{ f_{n} \}_{n=1}^{\infty}$ is a complete orthonormal basis of $L^2[a,b]$. (Here $\alpha,\beta$ are used only as a convenient parameterization of the endpoint conditions.)
The inverse operator is compact because of how it takes $L^2$ functions to twice absolutely continuous functions on $[a,b]$. And that's how you end up with a discrete set of eigenvalues $\lambda_1 < \lambda_2 < \lambda_3 < \cdots$ and a set of eigenfunctions $\{ f_{n} \}_{n=1}^{\infty}$ corresponding to these eigenvalues. The eigenfunction spaces are one-dimensional, and all eigenfunctions taken together form a complete orthogonal basis of $L^2[a,b]$. So, every $f \in L^2[a,b]$ may be written as
$$
              f(x) = \sum_{n=1}^{\infty}\frac{\langle f,\varphi_n\rangle}{\langle \varphi_n,\varphi_n\rangle}\varphi_n(x) .
$$
This expansion is guaranteed to converge in $L^2[a,b]$, which can be proved using $L^2$ theory only. But, in fact, you'll also have pointwise almost every convergence as well.
The Fourier expansions associated with a Sturm-Liouville operator may switch from being discrete to being "continuous" Fourier integral types of expansions, or even mixed continuous and discrete, when either the interval of consideration is infinite, or when $p$ vanishes at one or both endpoints of the interval $(a,b)$. For example, the radial equation for the hydrogen isotope has both discrete eigenvalues, and has a continuum of spectrum above a certain escape energy. These correspond to bound and unbound states of the atom. The unbound states can have any energy in a continuum, but the bound states must have energies levels that are in a set of discrete values that correspond to specific orbits.
ADDED TO ADDRESS YOUR CASE: To explain more, suppose that you want to solve the Laplace equation
$$
              \Delta f = 0, \\
                 a \le x \le b, \\
                 c \le y \le d,
$$
subject to boundary conditions on the four edges:
$$
               f(x,c) = f_1(x),\;\; f(x,d) = f_2(x),\;\; a \le x \le b, \\
               f(a,y) = f_3(y),\;\; f(b,y) = f_4(y),\;\; c \le y \le d.
$$
Then you can solve 4 problems, each one where you specify $f$ to be $0$ on 3 of the 4 edges, and equal to the desired function on the remaining edge. Adding the 4 solutions gives the desired, full solution.
For example, consider the case where $f_2,f_3,f_4$ are $0$, and $f_1$ is not; this is one of the four cases to consider. When you separate variables, the functions in $y$ must vanish at the endpoints $y=c,d$. So you have a nice Sturm-Liouville eigenfunction problem. The standard separation of variables gives
$$
             \Delta (XY) = 0 \\
              X^{''}Y+XY^{''}=0 \\
              \frac{X^{''}}{X}=-\frac{Y^{''}}{Y} \\
        \frac{X^{''}}{X}=\lambda,\;\; -\lambda=\frac{Y^{''}}{Y}
$$
The conditions in $x$ do nothing to determine the value of $\lambda$. The values of $\lambda$ are determined by
$$
                 Y^{''}(y)+\lambda Y(y)=0,\;\; Y(c)=Y(d)=0.
$$
The solutions where $Y(c)=0$ and $Y'(c)=1$ (ignoring $Y(d)$ for the moment) have the form
$$
                     Y_{\lambda}(y)=\frac{\sin(\sqrt{\lambda}(y-c))}{\sqrt{\lambda}}=\sum_{n=0}^{\infty}(-1)^n\frac{\lambda^n(y-c)^{2n+1}}{(2n+1)!}
$$
NOTE: Adding the normalization $Y_{\lambda}'(c)=1$ forces the above to work in the limiting case as $\lambda\rightarrow 0$. In fact, this general approach will guarantee that the resulting $Y_{\lambda}(y)$ is an entire function of $\lambda$ for every fixed $y\in [c,d]$. $Y_{0}(y)=y-c$ is the correct solution for $\lambda=0$, and it is obtained as a limiting case of the above as $\lambda\rightarrow 0$.
The equation $Y(d)=0$ becomes the eigenvalue equation in $\lambda$:
\begin{align}
            &\sin(\sqrt{\lambda}(d-c))=0 \\
      &\implies \sqrt{\lambda_n}=\frac{n\pi}{d-c},\;\; n=1,2,3,\cdots, \\
       &\implies \lambda_n=\frac{n^2\pi^2}{(d-c)^2},\;\; n=1,2,3,\cdots.
\end{align}
$n=0$ is not a valid case, as was explained above. The eigenfunctions are
$$
         \varphi_n(y)=\sin\left(n\pi\frac{y-c}{d-c}\right),\;\; c \le y \le d,\;\; n=1,2,3,\cdots.
$$
$\{ \varphi_n \}_{n=1}^{\infty}$ is a complete orthogonal set of eigenfunctions on $[c,d]$, which is exactly what is needed to solve the problem.
A: Thanks Disintegration, this is a whole lot more to think about than I thought!! It's a great answer.
What about the fact that when you form the Ansatz for a Laplace problem (say $u_n(x,y)=\cos\frac{n\pi}{b}x\sinh\frac{n\pi}{b}y$), you need to use the specific boundary conditions that are non-zero when forming the series expansion of $u(x,y)$ (i.e. nonzero B.C.: $u(a,y)=f(y))$. Once you know that that series expansion is related to the non-zero boundary conditions on a specific dimension, say the y-dimension (as in the given example of BC) , then you know that the Fourier series is made on the y-part of the function $u(x,y)$ (here $\sinh\frac{n\pi}{b} y$) of that series expansion at $y=a$ (thus, $\sinh\frac{n\pi}{b} a$ where a is the upper limit of the x-dimension.
So you have $u(x,a)=\sum_{n=1}^\infty D_n\sinh\frac{n\pi}{b} a\cos\frac{n\pi}{b}x $ .
Then $D_n\sinh\frac{n\pi}{b} a$ is the coefficient when you look at the series expansion as a Fourier series with respect to the $x$-part. Therefore the Fourier series looks like:
$u(x,a)=\sum_{n=1}^\infty c_n\cos\frac{n\pi}{b}x$ .
This means: The Fourier coefficient $c_n=D_n\sinh\frac{n\pi}{b} a$.
The Fourier series of $u(x,y)$ at $u(a,y)$ in the y-dimension is:
$c_n=\int_0^b f(y)cos\frac{n\pi}{a}ydy$
and
$D_n=\frac{c_n}{\sinh\frac{n\pi}{b} a}$
So the final form is
$u(x,a)=\sum_{n=1}^\infty \frac{\int_0^b f(y)cos\frac{n\pi}{a}ydy}{\sinh\frac{n\pi}{b} a}\cos\frac{n\pi}{b}x$ .
Conclusively:
If the BC is by some function of $y$ ( that is $f(y)$, the Fourier coefficient is made on the y-part of $u(x,y)$. If it is  by some function of $x$ (which is $f(x)$, the Fourier coefficient is made on the  x-part.
