First, lets multiply both sides of the equation by 'a':

Now we have to move all the terms that have the variable 'a' to the left side of the equation:

Notice that now we have that 'a' is common factor on the left side, then we can factor it and get the following:

therefore, a=1/(g-2)