How solve this equation (algebraic manipulations)

I have the following equation where I want to solve for $\theta$. The difficulty is not as much in solving the equation, but rather obtaining the correct form of the solution. So this is more an algebra problem.

$$\mu^0 + kT\ln \frac{P}{P^0} = kT \ln \frac{\theta}{(1-\theta)q}$$

I should end up with this (the "Langmuir adsorption isotherm")

$$\theta = \frac{q\exp(\frac{\mu^0}{kT})\frac{P}{P^0}}{1 + q\exp(\frac{\mu^0}{kT})\frac{P}{P^0}}$$

And so I start solving for $\theta$:

$$\ln \frac{1}{\left(\frac{1}{\theta}-1\right)q} = \frac{\mu^0}{kT}+ \ln \frac{P}{P^0} = -\ln \left[\left( \frac{1}{\theta}-1 \right)q\right]$$

$$\frac{1}{\theta} = \frac{-\exp\left(\frac{\mu^0}{kT}\right) - \frac{P}{P^0}}{q}+1 = \frac{-\exp\left(\frac{\mu^0}{kT}\right) - \frac{P}{P^0} + q}{q}$$

$$\theta = \frac{q}{-\exp\left(\frac{\mu^0}{kT}\right) - \frac{P}{P^0} + q}$$

From here, I have tried numerous ways to manipulate this into the correct expression, but I just can't do it. I have tried not expanding the fractional logarithm in the earlier steps, I tried factoring out the $q$ from the logarithm. I am simply unable to obtain the correct form of the solution. So, perhaps someone else has better luck in doing this.

• $$\frac{1}{\theta} = \frac{-\frac{P^0}{P}\exp\left(\frac{\mu^0}{kT}\right) }{q}+1$$ – Kostiantyn Lapchevskyi Oct 22 '16 at 20:31
• Oh, it never occured to me to use the logarithmic rules that way! Now I get it. Man, I spent a lot of time on this without seeing that possibility! – Yoda Oct 22 '16 at 20:37
• But now I have a minus in the denominator instead of a plus.. – Yoda Oct 22 '16 at 20:41

Calculate $\dfrac\theta{1-\theta}$ first: $$\ln\frac\theta{(1-\theta)q}=\frac{\mu_0}{kT}+\ln\frac{P}{P^0}\iff\frac\theta{1-\theta}=q\,\mathrm e^{\tfrac{\mu_0}{kT}}\frac{P}{P^0}.$$ Now invert the homographic function: $$\frac\theta{1-\theta}=u\iff \theta=\frac u{1+u}.$$