Choose the separated cosine solutions instead:
Its derivatives are and . They vanish on the appropriate opposite sides of the square for integer , so the outward normal derivative is zero everywhere on the boundary. Also .
This is nonzero for every pair of integer indices, including a zero index. For it is the constant solution, illustrating the zero mode allowed by Neumann boundary conditions. Negative indices give the same cosine modes. The construction is the Neumann part of the Dirichlet and Neumann spectra of a square.
For , separation of variables gives . With the standard separation constants and , the zero-endpoint solutions are sines. Thus, provided ,
is nonzero, has zero value on all four sides, and satisfies .
There is a missing qualification in the printed request for arbitrary integer . The Dirichlet and Neumann spectra of a square show that a nonzero Dirichlet solution exists precisely when
When one of is zero, the displayed sine product vanishes identically, and a nonzero solution need not exist: for example or admits none. On the other hand does admit . Thus the natural intended case is two nonzero integer indices, with the stated spectral criterion covering the exceptional cases.