I want to solve the following problem in Dirichlet Problem:
Let $D = \{(x, y) \in \mathbb R^2 : 0 < x < a; 0 < y < b\}$ be a rectangle with boundary $\partial D$. I want to solve Laplace equation with following the boundary condition:
$$u(x, y) = x + y; \quad (x, y) \in \partial D$$
To apply method of separation of variables, I would need homogeneous boundary condition (reference), so is this boundary condition homogeneous? Or do I have to break it down for each edge and use superposition to get to the solution? Or is there any other method to solve it?
You are right: the separation of variables in a rectangle requires homogeneous boundary conditions on two opposing sides of the rectangle. When we don't have that, one approach is to come up with a harmonic function $w$ that satisfies two of the boundary conditions; then look for $v=u-w$, which has homogeneous boundary conditions.
How to come up with $w$ depends on the boundary conditions. Polynomials are good because we can play with undetermined coefficients if needed. Basically, you start with the formula you have ($x+y$), check if this is already a harmonic function, and if not, think of something to add to it while preserving some of the boundary values.
In this case, the process of over quickly: $x+y$ is harmonic.