My teacher told us that $$ \ln Z = \frac{PV}{kT} $$ is the equation of state for an ideal gas, being $Z$ the grand canonical partition function and $k$ the Boltzmann constant. Where does this formula come from? (we then used this formula for studying Bose-Einstein and Fermi-Dirac systems).

I have tried the following: in the grand canonical ensemble I know that $\Xi = -kT \ln Z $ is the grand canonical potential. Also, from thermodynamics, I know that the grand canonical potential differential is $ d\Xi = -S~dT - P~dV - N~d\mu $ so, integrating, $ \Xi = -PV + f(\mu,T) $ where $f$ is some unknown function. Equating this two facts about $\Xi$ gives $$ \ln Z = \frac{PV - f(\mu,T)}{kT} $$ but how can be shown that $f(\mu,T)=0$?