For which real values of $\alpha$ PDE $\Delta u(x,y)+2u(x,y)=x-\alpha$ has at least one weak solution? Problem. Consider boundary value problem:
\begin{cases}
\Delta u(x,y)+2u(x,y)=x-\alpha,  & \text{in $\Omega$,} \\
u(x,y)=0, & \text{on $\partial\Omega$,}  \\
\end{cases}
where $\alpha$ is real, $\Delta u = \frac{\partial^2 u}{\partial x^2} + \frac{\partial^2 u}{\partial y^2}$  and $\Omega=(0,\pi)\times(0,\pi)$. The question is for which $\alpha$ we have at least one weak solution for this PDE.
Function $u$ is said to be weak solution to this problem iff $u\in H_0^1(\Omega)$ and equation is satisfied in sence of distributions.
Solution. To solve this problem we should use Fredholm alternitive. For our case it takes the form (formally):

$Lu=f$ has solution for all permissable $f$ that satisfies
  $(f,v)_{L^2(\Omega)}=\int_\Omega fv\,dx=0$, where v is solution for
  adjoint homogeneous equation $L^*v=0$.

Adjoint homogeneous equation has next form:
\begin{cases}
\Delta v(x,y)+2v(x,y)=0,  & \text{in $\Omega$,} \\
v(x,y)=0, & \text{on $\partial\Omega$,}  \\
\end{cases}
To solve it you can use method called separation of variables, on rectangle variables are separated very easy. You get $v(x,y)=C\,sinx\,siny$, where $C$ is arbitrary constant. We fix $C=1$.
Now we can easily find for which $f$ our main equation has at least one solution.
$$(f,v)_{L^2(\Omega)}=\int_\Omega fv\,dx=\int_\Omega(x-\alpha)sinx\,siny\,dx=2\pi-4\alpha=0 \text{ when } \alpha=\frac{Pi}{2}$$

Your solution is essentially correct; just one small mistake (with the integral over $\Omega$). Hint:

 The integral over $\Omega$ equals $2 \pi - 4 \alpha$

