This is a differentiation problem that I stumbled across while trying to calculate log-likelihood estimate, so it is related to statistics.

I'm having problems with the differentiation below

I can see how the

is obtained using the product rule, but I don't see how the term after that,

, was obtained. Shouldn't that term be

instead? See

how I got this term. What have I done wrong?