I want to do a partial fraction on
\begin{equation} \frac{z}{(z-4)(z+\frac{1}{2})} \end{equation}
Method one, which apparently is wrong: \begin{equation} \frac{z}{(z-4)(z+\frac{1}{2})}=\frac{A}{z-4}+\frac{B}{z+\frac{1}{2}} \end{equation}
\begin{array} f A(z+\frac{1}{2})+B(z-4)=Az+\frac{1}{2}A+Bz-4B ;\\ Az+Bz=z \rightarrow A=1-B\\ \frac{1}{2}A-4B=0 \rightarrow A-8B=0 \\ A=\frac{8}{9}, B=\frac{1}{9} \end{array}
which gives
\begin{equation} \frac{8}{9}\frac{1}{z-4}+\frac{1}{9}\frac{1}{z+\frac{1}{2}} \end{equation}
Then , the second method which is a reference from an exam correction, which is deemed right, disregards for the existence of z in the numerator at first:
\begin{equation} \frac{1}{(z-4)(z+\frac{1}{2})}=\frac{A}{z-4}+\frac{B}{z+\frac{1}{2}} \end{equation}
\begin{array} f A(z+\frac{1}{2})+B(z-4)=Az+\frac{1}{2}A+Bz-4B ;\\ Az+Bz=0 \rightarrow A=-B\\ \frac{1}{2}A-4B=1 \rightarrow B=-1/4 + A/8 \\ A=\frac{2}{9}, B=-\frac{2}{9} \end{array}
Then at the end, the author inserts z back in the numerator, obtaining:
\begin{equation} \frac{2}{9}\frac{z}{z-4}-\frac{2}{9}\frac{z}{z+\frac{1}{2}} \end{equation}
So why was the former wrong, when it follows all the rules of partial fractions? And why is the second right, when z is not included in the partial fraction decomposition?
Thanks
Both methods are algebraically correct. That is, both methods yield new functions that are the same as the original function.
Your method is the correct way to carry out the partial fraction decomposition algorithm. Moreover, your method results in the outcome desired from the partial fraction algorithm—a sum of rational functions, each of which has a denominator with a single distinct irreducible factor, and a numerator whose degree is less than the degree of the irreducible factor in its denominator. The professor's method yields a result without this last property.
(The reason we want this last property, in a calculus context at least, is that there are standard and often immediate methods for integrating that type of rational function, whereas a function like $\frac z{z-4}$ still requires further algebraic preprocessing to be integrated.)