Assuming P and g are both variables, it’s not possible to find a unique solution in one equation. The equation has an infinite number of solutions and just shows the relationship between P and g.
However, it is possible to write g in terms of P.
2g+P=25, 2g=25-P, g=½(25-P).