In this paper, two approaches are used to solve a class of the distributed optimal control problems defined on rectangular domains. In the first approach, a meshless method for solving the distributed optimal control problems is proposed; this method is based on separable representation of state and control functions. The approximation process is done in two fundamental stages. First, the partial differential equation (PDE) constraint is transformed to an algebraic system by weighted residual method, and then, Bezier curves are used to approximate the action of control and state. In the second approach, the Bernstein polynomials together with Galerkin method are utilized to solve partial differential equation coupled system, which is a necessary and sufficient condition for the main problem. The proposed techniques are easy to implement, efficient, and yield accurate results. Numerical examples are provided to illustrate the flexibility and efficiency of the proposed method.