Finding out the charge density (electrostatics) A solution to the potential in the  region $ -a < y <a$ , where there is charge density $\rho$ , satisfies the boundary conditions , $\phi = 0$ in the planes $ y = -a$ and $y = a$. $$ \phi = \dfrac{{\rho}_0}{{{\epsilon}_0}{\beta}^{2}}\left(1 - \dfrac{\cosh\beta y}{\cosh\beta a}\right)\cos\beta x$$
We need to find the charge density $\rho$ in this region.
I tried as follows : 
We know $\nabla^{2}\phi = - \dfrac{\rho}{\epsilon_0}$,
So , $ \dfrac{{\partial}^{2}\phi}{\partial x^{2}}+ \dfrac{{\partial}^{2}\phi}{\partial y^{2}} = - \dfrac{\rho}{\epsilon_0} $ , solving this gives :
$ \rho_0 + \rho_0 \dfrac{\cosh\beta y}{\cosh\beta a} (\cos\beta x -1) = \rho$ , 
Am I going correctly ? Should I proceed to apply boundary conditions in the next step ?
Also , how to find the particular solution $\phi_p$ from the given equation ? Could anyone help ? 
 A: The direction is correct, just note that you can write
$$
\frac{\partial^2\phi}{\partial x^2}  = - \beta^2\phi
$$
and
$$
\frac{\partial^2\phi}{\partial y^2}  = \beta^2\cdot\left( \phi -\frac{\rho_0}{\epsilon_0\beta^2}\cos{\beta x}\right)
$$
This can ease the calculations.
The result you obtain is an oscillating potential in $x$, not depending on $y$. The boundary conditions are needed when you try to solve the equation for the potential, so not for this case. The hyperbolic function in $\phi$ comes from the fact that the charge density does not depend on $y$ and from the boundary conditions.
A: Look if you substitute the boundary conditions in the given solution it will be identically satisfied, so you don't need them since those were used in the derivation of the given solution. So you have found the charge density and this should be satisfactory, though the final result should be:
$$
 \rho=-\frac{\rho_0}{\epsilon_0}\cos\beta x ,
$$
as pointed out by Fedino.
According to your second question, in order to find a particular solution of a given ordinary differential equation you can use the general approach of variation of parameters, i.e. https://en.wikipedia.org/wiki/Variation_of_parameters. For partial differential equations it is more complicated.
