Let $f(z)$ and $g(z)$ be two analytic functions on an open set $D$. Show that if $f(z)$ and $g(z)$ have finitely many zeros in $D$ and they do not have common zeros, then there exist analytic functions $a(z)$ and $b(z)$ on $D$ such that $a(z)f(z)+b(z)g(z)=1$ on $D$.
I have seen similar questions but in the answers I noticed the use of Mittag-Leffler interpolation theorem and the professor of the class have not given such theorem.
I tried to prove this by defining $a(z) = \frac{1-bg}{f}$ for $z\notin Z(f)$ where $Z(f)=\{y_{1},y_{2}, ..., y_{m}\}$ represents the sets of zeros of $f$ and $a(z)=\frac{1}{g}$ for $z\in Z(f)$. For the function $b$, I defined $b(z)= \frac{1}{g} + (z-y_{1})(z-y_{2})...(z-y_{m})$ for $z\notin Z(g)$ and $b(z)=\frac{1}{f}$ for $z\in Z(g)$.
Could anyone help me in this one? Thank you.