Derivative of Rational Function from Lang's Algebra I'm currently working on the following exercise (Lang, IV.11(c)):

Let $D$ be the standard derivative in the polynomial ring $k[X]$ over a field $k$. Let $R(X)=c\prod_{j}(X-\alpha_{j})^{m_{j}}$ with $\alpha_{j}\in k$, $c\in k$, and $m_{j}\in\mathbb{Z}$ (so $R$ is a rational function). Show that $$\frac{R'(X)}{R(X)}=\sum_{j}\frac{m_{j}}{X-\alpha_{j}}.$$

My thoughts: I know that if $A$ is a commutative ring, then the derivative is a map $D:A[X]\to A[X]$ defined as expected: $$Df(X)=f'(X)=a_{1}+2a_{2}X+\cdots+na_{n}X^{n-1}$$ for $f(X)=a_{0}+a_{1}X+a_{2}X^{2}+\cdots+a_{n}X^{n}$. I would think that I can apply this in some sort of pairwise product rule fashion to take the derivative of $R(X)$. Or perhaps I could multiply all of the products out? However, I'm not sure how exactly to do this since we just have a general expression for a product of linear factors.
My questions: Do either of my methods mentioned above make sense? Also, the indexing set for $j$ must be finite, right? (If not, then we would be dealing with the ring of power series $k[[X]]$, not the ring of polynomials $k[X]$.)
Thanks in advance for any help.
 A: The key is to generalize the Leibniz rule $(fg)'=f'g+fg'$ to multiple factors: we have
$$D\left(\prod_j f_j\right)=\sum_if_i'\prod_{j\neq i}f_j$$
Thus, for $R(X)=c\prod_{j}(X-\alpha_{j})^{m_{j}}$ we have
\begin{align}
R'(X)
&=cD\left(\prod_{j}(X-\alpha_{j})^{m_{j}}\right)\\
&=c\sum_{i}D((X-\alpha_{i})^{m_i})\prod_{j\neq i}(X-\alpha_{j})^{m_{j}}\\
&=c\sum_{i}m_i(X-\alpha_{i})^{m_i-1}\prod_{j\neq i}(X-\alpha_{j})^{m_{j}}
\end{align}
hence
\begin{align}
\frac{R'(X)}{R(X)}
&=\frac{c\sum_{i}m_i(X-\alpha_{i})^{m_i-1}\prod_{j\neq i}(X-\alpha_{j})^{m_{j}}}{c\left(\prod_{j}(X-\alpha_{j})^{m_{j}}\right)}\\
&=\sum_{i}m_i(X-\alpha_{i})^{m_i-1}\frac{\prod_{j\neq i}(X-\alpha_{j})^{m_{j}}}{\prod_{j}(X-\alpha_{j})^{m_{j}}}\\
&=\sum_{i}m_i(X-\alpha_{i})^{m_i-1}\frac{1}{(X-\alpha_i)^{m_i}}\\
&=\sum_{i}\frac{m_i}{X-\alpha_i}\\
\end{align}
A: The formula comes at once from the fact that
$$
\frac{R^\prime(X)}{R(X)}=d\log(R(X)).
$$
If using $\log$ in an algebraic context makes you uneasy, just apply the product rule for derivatives and some algebraic manipulation.
