Solution (source code)

= Solution
{c}

Set $u=X(x)Y(y)$ in <Laplace's equation>. <Separation of variables> gives
$$
X''+\lambda X=0,\qquad Y''-\lambda Y=0,\qquad X'(0)=X'(\pi)=0.
$$
The <Sturm-Liouville problem> in $x$ has the constant mode $X_0=1$ with $\lambda_0=0$, and the <eigenfunctions> $X_n=\cos(nx)$ with $\lambda_n=n^2$, $n\geq1$. Indeed, <integration by parts> makes $\lambda$ nonnegative; for $\lambda>0$ the first <Neumann boundary condition> removes the <sine> term and the second requires $\sqrt\lambda$ to be an <integer>. For $\lambda=0$, both derivative conditions make $X$ constant.

Expand the top data using a <Fourier cosine series>:
$$
g(x)=\pi^2-x^2=\frac{g_0}{2}+\sum_{n=1}^{\infty}g_n\cos(nx).
$$
The constant coefficient is
$$
g_0=\frac2\pi\int_0^\pi(\pi^2-x^2)\,dx=\frac{4\pi^2}{3}.
$$
For $n\geq1$, the constant part has zero <integral> against $\cos(nx)$, and two <integrations by parts> give
$$
\begin{aligned}
g_n&=-\frac2\pi\int_0^\pi x^2\cos(nx)\,dx\\
&=-\frac2\pi\left[
\frac{x^2\sin(nx)}n+\frac{2x\cos(nx)}{n^2}-\frac{2\sin(nx)}{n^3}
\right]_0^\pi
=\frac{4(-1)^{n+1}}{n^2}.
\end{aligned}
$$

Since the bottom value is zero, a convenient factor depending on $y$ for the nonconstant modes is $\sinh(n(y+1))$, which vanishes at $y=-1$. Its value at $y=1$ is $\sinh(2n)$. The zero mode is linear in $y$, so matching both constant boundary values gives
$$
\boxed{u(x,y)=\frac{\pi^2}{3}(y+1)
+\sum_{n=1}^{\infty}\frac{4(-1)^{n+1}}{n^2}
\frac{\sinh(n(y+1))}{\sinh(2n)}\cos(nx)}.
$$
To obtain exactly the paper's form, use the <hyperbolic-function identity>
$$
\frac{\sinh(n(y+1))}{\sinh(2n)}
=\frac{\sinh(ny)\cosh n+\cosh(ny)\sinh n}{2\sinh n\cosh n}
=\frac{\sinh(ny)+\tanh n\cosh(ny)}{2\sinh n}.
$$
Thus
$$
\boxed{u(x,y)=\frac{\pi^2}{3}(1+y)
+\sum_{n=1}^{\infty}\frac{2(-1)^{n+1}}{n^2\sinh n}
\bigl(\sinh(ny)+\tanh(n)\cosh(ny)\bigr)\cos(nx)}.
$$

Each product of <hyperbolic sine> or <hyperbolic cosine> with $\cos(nx)$ has $u_{xx}+u_{yy}=0$. The zero mode is also a <harmonic function>. On $-1\leq y\leq1$, the factor $\sinh(n(y+1))/\sinh(2n)$ lies between zero and one. Since $\sum n^{-2}$ converges, the <Weierstrass M-test> gives <uniform convergence> on the closed rectangle. The series therefore gives zero at the bottom and the continuous <Fourier cosine series> of $\pi^2-x^2$ at the top, including its endpoints. On compact subsets with $y<1$, the factors decay exponentially with $n$, justifying termwise <partial derivatives>. In particular $u_x=0$ on both open vertical edges because every differentiated <cosine> factor vanishes there. The solution has finite <Dirichlet energy>: <Fourier orthogonality> gives the $n$th nonconstant mode's energy as $(\pi/2)ng_n^2\coth(2n)=O(n^{-3})$, whose sum is finite. Here $\coth$ is the <hyperbolic cotangent>. Thus <a> proves uniqueness in that class.

There is a <corner compatibility condition for mixed boundary data> in the printed wording. The top data have $g'(\pi)=-2\pi$, but the paper writes $u_x(\pi,y)=0$ even at $y=1$. \b[The series solves the interior equation and all the open-edge boundary conditions; the literal derivative condition at $(\pi,1)$ is incompatible with the top data.] A function differentiable in $x$ along the top edge would necessarily have $u_x(\pi,1)=g'(\pi)=-2\pi$. Hence it cannot simultaneously satisfy the printed zero derivative at that corner, and there is no solution with all those literal corner requirements. The standard interpretation of this <mixed boundary condition> imposes the <Neumann boundary condition> on the open sides and the <Dirichlet boundary condition> continuously on the horizontal edges. Differentiating the series term by term on the top edge would be invalid at this corner; the uniform convergence of the undifferentiated series does not license that operation.