If the Laplace equation $$u_{xx}+u_{yy}=0, 1<x<2,1<y<2$$ with the boundary conditions
$$u_x(1,y)=y,u_x(2,y)=5,u_y(x,1)=a\frac{x^2}{7}, u_y(x,2)=x$$ has a solution, then find the constant $a$.
I tried it by necessary condition for existence of solution i.e. $\int_R f(s)=0$, where I assume rectangle $R$ is with vertices $A,B,C$ and $D$ in clocking directions. Now $\int_{AB}\frac{ax^2}{7}dx+\int_{BC}5dy+\int_{CD}xdx+\int_{DA}ydy=0$. Which gives $\int_1^2\frac{ax^2}{7}dx+\int_1^25dy+\int_2^1xdx+\int_2^1ydy=0$, so that $\frac{a}{3}+5=0$ and hence $a=-15$ but answer is given $15$. Where I did mistake ? Thank you.
You have to take care of the direction of the outward normal to the boundary. The integration of PDE which is $\Delta u=0$ on the domain $\Omega=[1,2]\times[1,2]$ gives using the divergence theorem: $$\int_{\partial\Omega}\nabla u\cdot n d\sigma=0$$ where $n$ is the outward normal to $\partial\Omega$. This normal is equal to $(0,-1)$ on $\{y=1\}$, to $(1,0)$ on $\{x=2\}$, to $(0,1)$ on $\{y=2\}$ and to $(-1,0)$ on $\{x=1\}$, thus your computation should rather be: $$\int_{AB}-\frac{ax^2}7 dx+\int_{BC} 5 dy+\int_{CD}xdx+\int_{DA} -y dy=0$$ which is $-\frac a3+5+\frac32-\frac32=0$ so that we find $a=15$.