why is the differential of $\displaystyle \frac{x}{p} - \frac{n-x}{1-p}$ = $\displaystyle \frac{x}{p^2} - \frac{n-x}{(1-p)^2}$ and not $\displaystyle \frac{x}{p^2} + \frac{n-x}{(1-p)^2}$
why is the differential of $\displaystyle \frac{x}{p} - \frac{n-x}{1-p}$ = $\displaystyle \frac{x}{p^2} - \frac{n-x}{(1-p)^2}$ and not $\displaystyle \frac{x}{p^2} + \frac{n-x}{(1-p)^2}$
I don't think you have this correct. I assume that p is the variable you are differentiating with respect to.
$\displaystyle \begin{align*}&\frac{d}{dp} \left(\frac{x}{p}-\frac{n-x}{1-p}\right) =\\ \\&-\frac{x}{p^2} - \left(-\frac{(n-x)}{(1-p)^2}(-1)\right) = \\ \\ &-\frac{x}{p^2} - \frac{n-x}{(1-p)^2}\end{align}$
in the 2nd term the first minus sign comes from $\displaystyle \frac{d}{dp}\frac{1}{p}=-\frac{1}{p^2}$ the second comes from the $\displaystyle -p$ that's part of the denominator.
that's the form of the derivative.
$\displaystyle \frac{d}{dp}\left(\frac{n-x}{1+p}\right)=-\frac{n-x}{(1+p)^2}$
when you change p to (-p) you have another factor of -1 that has to be included
$\displaystyle \frac{d}{dp}\left(\frac{n-x}{1- p}\right)=-\frac{n-x}{(1-p)^2}(-1) =\frac{n-x}{(1-p)^2} $
Jut realised I didn't actually understand the answer given.
It's just a really basic use of the chain rule of differentiation. Chain rule - Wikipedia, the free encyclopedia
The second term is being treated as a composite function u = (1 - p) and so the -1 is just the differential of (1 - p).
Disgustingly simple.