# Integrating factor for differential equation gamma function

Given the following differential equation $$\left(\theta + \frac{1}{1-z}\right)g(z) -\frac{dg}{dz} = \frac{z^\theta}{1-z}$$ It is known that $(1-z)e^{-\theta z}$ is an integrating factor (how?). Given this, and that $g(1)=1$ we "readily determine" (how?) that \begin{align} g(z) &= \frac{e^{\theta z}}{1-z}\int^1_z t^\theta e^{-\theta t}dt\\ & = \frac{e^{\theta z}}{1-z}\theta^{-(\theta+1)}[\Gamma(\theta+1,\theta z)-\Gamma(\theta+1,\theta)] \end{align}

The integrating factor: $$\exp\left(-\int \left( \theta + \frac 1 {1-z} \right) \ \mathrm dz\right) = \exp \left( -z\theta + \ln(1-z) \right) = (1-z)e^{-\theta z}$$
In general, the integrating factor of $\dfrac {\mathrm dg} {\mathrm dz} + p(z) g = q(z)$ is $\displaystyle \exp \left( \int p(z) \ \mathrm dz \right)$.
Then our differential equation transforms to: $$\frac {\mathrm d} {\mathrm dz} \left(g (1-z)e^{-\theta z}\right) = -\frac {z^\theta} {1-z} (1-z)e^{-\theta z}$$