I'm given a problem where an ideal gas is expanded isothermally. I'm given the molar volumes from the start and the end and basically asked to find the change in Gibbs Energy.
I started with the equation
$$G=H -TS$$
We can write the general form $dG$
$$\begin{align} dG & = dH -SdT - TdS \\ & = (dE + PdV + VdP)- SdT -TdS \\ & = (TdS - PdV) + PdV + VdP - SdT - TdS \\ & = VdP -SdT \end{align}$$
It's an isothermal process $\to$ (const.) $T$. Hence $SdT \to0$
Now we are left with $dG=VdP$. We need the Gibb's energy in terms of moles and molar volumes. Hence entropy (which is zero anyway) and volume need to change to molar volume. Our new equation is in terms of moles
$$dG_m=V_mdP$$
if we assume $V_m$ to be constant which it isn't but for argument sake we can get the following relation
$$\Delta G_m = V_m\Delta P=RT \ln\Big{(}\dfrac{P_f}{P_i}\Big{)}$$
since $V_m = \frac{V}{n}=\frac{RT}{P}$ for an ideal gas.
My problem is - I would like to know if I can assume the pressure to be constant and have
$$\Delta G_m = RT \ln \Big{(}\dfrac{V_f}{V_i}\Big{)} $$
Is this equation valid for finding the molar Gibbs energy, knowing the molar volumes (initial and final) and at constant temperature.
I think it's wrong because $dG_m = V_mdP$ is valid for constant $T$ but the pressure cannot be constant. I've just been struggling with trying to find a relationship with gibbs energy and molar volume and not knowing pressures.