The following is a question from Strauss:
Let $u:[0,1]^3\to\mathbb{R}$ satisfy the Laplace equation $\Delta u = u_{xx} + u_{yy} + u_{zz} = 0 $ and the Neumann boundary condition $u_z(x,y,1) = g(x,y)$ with the normal derivatives on all other faces equal to zero, and $$\int_0^1\!\!\!\!\!\int_0^1 g(x,y)\,\mathrm{d}x\,\mathrm{d}y = 0.$$ Solve for $u$.
My immediate approach is try attempt separation of variables, and write $u(x,y,z) = X(x)Y(y)Z(z)$, so that we have $$X''-\lambda_1 X = 0,\ \ Y'' - \lambda_2 Y = 0,\ \ Z'' - \lambda_3 Z = 0,\ \ \mathrm{and}\ \ \lambda_1 + \lambda_2 + \lambda_3 = 0$$ with boundary conditions $$X'(0) = X'(1) = 0,\ \ Y'(0) = Y'(1) = 0,\ Z'(0) = 0$$ so we solve to get $$\lambda_1 = \beta_1^2 = k_1^2\pi^2,\ \ \lambda_2 = \beta_2^2 = k_2^2\pi^2$$ which gives us eigenfunctions $$X(x) = \cos\beta_1 x,\ \ Y(y) = \cos\beta_2 x$$ which leaves us with the equation $Z'' = \pi^2(k_1^2 + k_2^2)Z, Z'(0)=0$.
Now, my suspicion is that the next step is to write $g$ as a fourier series $$g(x,y) = \sum_{k_1 = 0}^\infty\sum_{k_2 = 0}^\infty a_{k_1,k_2}\cos\left(\pi k_1 x\right)\cos\left(\pi k_2 y\right)$$ to obtain a solution of the form $$u(x,y,z) = \sum_{k_1 = 0}^\infty\sum_{k_2 = 0}^\infty a_{k_1,k_2}\cos\left(\pi k_1 x\right)\cos\left(\pi k_2 y\right)\frac{\cosh\left(\pi z\sqrt{k_1^2+k_2^2} \right)}{\pi\sqrt{k_1^2+k_2^2}\sinh\left(\pi\sqrt{k_1^2+k_2^2} \right)}.$$
Now, assuming sufficient regularity of $g$, and assuming that $g$ has fourier series in this form (which is probably not true in general), it is easy to see that this satisfies the boundary conditions, and has vanishing laplacian. However, is my Fourier expansion for $g$ justified, and can the solution be expressed in a nicer way?