In this paper a new method for solving optimal phasor measurement units (PMU) placement problem for full observability in power systems is proposed. A new algorithm is based on forming and solving Groebner bases set of equations for a defined optimization problem. The technique of Groebner bases is applicable wherever the problem may be presented by the set of polynomials and as such, it can be found in a variety of applied mathematics problems. Groebner bases of the set of polynomials represents the canonical form equivalent to the original set, similar to the way the row echelon form for linear systems represents the triangular form of the linear equations set. The canonical form of the Groebner bases polynomials, along with the utilization of recursive algorithms, allows the solution to be effortlessly obtained. Optimal phasor measurement units placement (OPP) problem can be presented in a linear or nonlinear polynomial form, both of which are used in this paper. The settings of OPP problem have been proposed in this paper with the inclusion of zero injection buses (ZIBs), in normal system states and considering contingency related to PMU outage. The problem formulation is defined according to the application of Groebner bases technique. The proposed model is capable of obtaining the full set of optimal solutions instead of only one or partial solutions. The efficiency of the proposed method is tested on IEEE 14-bus, IEEE 24-bus, IEEE 30-bus, IEEE 118-bus and Polish 2383-bus test system and the results are compared with those of some recently reported methods.